From: eduardo.davila@creatis.insa-lyon.fr Date: Thu, 9 Jan 2025 07:30:15 +0000 (+0100) Subject: Clean code X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9ac85e8a9eefef4cd9d37757ba5d4d47db61794d;p=bbtk.git Clean code --- diff --git a/kernel/src/bbtkBlackBox.h b/kernel/src/bbtkBlackBox.h index 6da0d20..d81ff21 100644 --- a/kernel/src/bbtkBlackBox.h +++ b/kernel/src/bbtkBlackBox.h @@ -77,9 +77,7 @@ namespace bbtk { BBTK_ABSTRACT_OBJECT_INTERFACE(BlackBox); - public: - //================================================================== // Types //================================================================== @@ -98,7 +96,6 @@ namespace bbtk InputConnectorMapType; //================================================================== - //================================================================== /// @name Pipeline processing methods /// Methods which participate to pipeline processing. @@ -108,16 +105,11 @@ namespace bbtk //@} //================================================================== - - - - //================================================================== /// Returns a pointer on a clone of the box with name virtual BlackBox::Pointer bbClone(const std::string& name) = 0; //================================================================== - //================================================================== /// @name General accessors /// Methods which give access to general informations on the box @@ -130,7 +122,6 @@ namespace bbtk const std::string& bbGetTypeName() const { return bbGetDescriptor()->GetTypeName(); } - /// Returns the name of the BlackBox (instance) const std::string& bbGetName() const { return bbmName; } @@ -146,8 +137,6 @@ namespace bbtk //@} //================================================================== - - //================================================================== /// @name Inputs/Outputs related methods /// Methods related to the box inputs and outputs @@ -165,7 +154,6 @@ namespace bbtk /// Gets the data of the input called as a string using an Adaptor if possible (else returns empty string) std::string bbGetInputAsString( const std::string &input); - /// Sets the data of the input called . /// If update_time is false then does not update ChangeTime of input virtual void bbSetInput( const std::string &name, Data data, @@ -175,7 +163,6 @@ namespace bbtk void* data, bool update_time = true) =0; - /// Returns true iff the BlackBox has an output of name label virtual bool bbHasOutput(const std::string& label) const; /// Gets the output type of a given label @@ -188,7 +175,6 @@ namespace bbtk /// Sets the data of the output called virtual void bbSetOutput( const std::string &name, Data data) = 0; - /// Returns the input connectors map InputConnectorMapType& bbGetInputConnectorMap() { return mInputConnectorMap; } @@ -202,7 +188,6 @@ namespace bbtk const BlackBoxInputConnector& bbGetInputConnector(const std::string& n) const { return *(mInputConnectorMap.find(n)->second); } - /// Returns the output connectors map OutputConnectorMapType& bbGetOutputConnectorMap() { return mOutputConnectorMap; } @@ -222,8 +207,6 @@ namespace bbtk /// Prints the Help on the BlackBox type virtual void bbGetHelp(bool full=true) const; - - //================================================================== /// @name Output signals / observers related methods /// Methods related to signals emitted by outputs and the @@ -249,7 +232,6 @@ namespace bbtk OutputChangeCallbackType f); //================================================================== - //================================================================== /// Signals that the BlackBox outputs have been modified /// (without marking the box as MODIFIED because its output state is ok : don't care if you understand : use it !). @@ -284,11 +266,6 @@ namespace bbtk //================================================================== //@} - - - - - //================================================================== /// @name Common inputs / outputs to all boxes //@{ @@ -341,7 +318,6 @@ namespace bbtk bool relative_link ) {} - //================================================================== /// @name Window related methods //@{ @@ -367,7 +343,6 @@ namespace bbtk //JCP 09-06-09 protected: - //================================================================== /// @name User redefinable methods /// Virtual methods which can be redefined by inherited classes @@ -400,7 +375,6 @@ namespace bbtk // @} //================================================================== - //================================================================== /// Write Graphviz-dot description in file. @@ -435,8 +409,6 @@ namespace bbtk BlackBox(BlackBox& from, const std::string &name); //================================================================== - - //================================================================== /// @name Pipeline processing methods /// Methods which participate to pipeline processing. @@ -455,7 +427,6 @@ namespace bbtk IOStatus bbUpdateInputs(); //================================================================== - //================================================================== /// Actual CreateWindow method (vitual) /// Overloaded in AtomicBlacBox and descendants @@ -474,7 +445,6 @@ namespace bbtk } //================================================================== - //================================================================== /// Actual processing method (vitual) /// Overloaded in AtomicBlacBox and descendants @@ -491,7 +461,6 @@ virtual void bbComputePostProcessStatus(); //@} //================================================================== - //================================================================== /// Signals that the input whose connector is c has changed /// and propagates the info downward @@ -500,8 +469,6 @@ virtual void bbComputePostProcessStatus(); IOStatus s); //================================================================== - - //================================================================== /// @name Box con(des)struction / initi(fin)alization methods //@{ @@ -538,7 +505,6 @@ virtual void bbComputePostProcessStatus(); /// (like a constructor does) virtual void bbRecursiveInitializeProcessing() {} - /// Abstract prototype of the method which /// calls bbUserFinalizeProcessing for its own class and then /// recursively calls itself for the parent black box. @@ -588,7 +554,6 @@ virtual void bbComputePostProcessStatus(); //================================================================== protected: - //================================================================== /// Black box objects have a special deleter /// which must take care of releasing the descriptor @@ -624,7 +589,6 @@ virtual void bbComputePostProcessStatus(); return 0; } //================================================================== - //================================================================== private: //================================================================== @@ -649,7 +613,6 @@ virtual void bbComputePostProcessStatus(); BlackBox::WeakPointer bbmParent; //================================================================== - //================================================================== // ATTRIBUTES /// Map that contains the output connectors of the black box @@ -658,12 +621,10 @@ virtual void bbComputePostProcessStatus(); InputConnectorMapType mInputConnectorMap; //================================================================== - bool bbLetRecursiveExecuteManualMode; }; // Class BlackBox - /// Convenient macro to create output observer callbacks (freehand functions) from object and method pointer (see samples/SampleOutputObserver) #define BBTK_MAKE_OUTPUT_OBSERVER(OBJECT,METHOD) \ boost::bind( METHOD, OBJECT, _1, _2, _3) diff --git a/packages/std/src/bbstdReadColumnsDouble.cxx b/packages/std/src/bbstdReadColumnsDouble.cxx index 92f0557..0d3d21d 100644 --- a/packages/std/src/bbstdReadColumnsDouble.cxx +++ b/packages/std/src/bbstdReadColumnsDouble.cxx @@ -67,8 +67,8 @@ void ReadColumnsDouble::Process() } fclose(ff1); } else { // else ff1 - printf("bbcreaMaracasVisuReadAxisTree3D::Process ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() ); - } //ff1 + printf("ReadColumnsDouble::Process ...Error... reading file InputFileName_Points:%s\n", bbGetInputFileName().c_str() ); + } //ff1 i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); } i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); } diff --git a/packages/std/src/bbstdReadColumnsInt.cxx b/packages/std/src/bbstdReadColumnsInt.cxx index 5a0c08a..faf915b 100644 --- a/packages/std/src/bbstdReadColumnsInt.cxx +++ b/packages/std/src/bbstdReadColumnsInt.cxx @@ -67,7 +67,7 @@ void ReadColumnsInt::Process() } fclose(ff1); } else { // else ff1 - printf("ReadColumnsDouble::Process ...Error... reading file FileName <%s>\n", bbGetInputFileName().c_str() ); + printf("ReadColumnsDouble::Process ...Error... reading file FileName:%s\n", bbGetInputFileName().c_str() ); } //ff1 i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); } i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); } diff --git a/packages/std/src/bbstdReadColumnsString.cxx b/packages/std/src/bbstdReadColumnsString.cxx index 2860219..64318bc 100644 --- a/packages/std/src/bbstdReadColumnsString.cxx +++ b/packages/std/src/bbstdReadColumnsString.cxx @@ -31,7 +31,6 @@ #include "bbstdReadColumnsString.h" #include "bbstdPackage.h" - #include namespace bbstd @@ -61,7 +60,6 @@ void ReadColumnsString::Process() { fgets( tmpValue , 500, ff1 ); } - while (!feof(ff1)) { for( i=0 ; i%s", bbGetInputFileName().c_str() ); - } //ff1 - + printf("ReadColumnsString::Process ...Error... reading file InputFileName_Points:%s\n", bbGetInputFileName().c_str() ); + } //ff1 i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); } i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); } i=3; if (i<=bbGetInputDimension()) { bbSetOutputlstData3( *(tlst[i-1]) ); } @@ -88,47 +85,42 @@ void ReadColumnsString::Process() i=7; if (i<=bbGetInputDimension()) { bbSetOutputlstData7( *(tlst[i-1]) ); } i=8; if (i<=bbGetInputDimension()) { bbSetOutputlstData8( *(tlst[i-1]) ); } i=9; if (i<=bbGetInputDimension()) { bbSetOutputlstData9( *(tlst[i-1]) ); } - } -//===== + +//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ReadColumnsString::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputSkipLines(0); bbSetInputDimension(1); - bbSetInputFileName(""); - + bbSetInputFileName(""); } -//===== + +//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ReadColumnsString::bbUserInitializeProcessing() { - // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers -// if any - - +// if any } -//===== + +//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ReadColumnsString::bbUserFinalizeProcessing() { - // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any - } -} -// EO namespace bbstd + +}// EO namespace bbstd