#include <bbtkAtomicBlackBox.h>
Public Member Functions | |
bbtk::BlackBoxDescriptor::Pointer | bbGetDescriptor () const |
Data | bbGetOutput (const std::string &label) |
Gets the output Data of a given label. | |
Data | bbGetInput (const std::string &label) |
Gets the input Data of a given label. | |
void | bbSetOutput (const std::string &name, Data data) |
Sets the data of the output called <name>. | |
void | bbSetInput (const std::string &name, Data data, bool setModified=true) |
Sets the data of the input called <name>. | |
void | bbBruteForceSetInputPointer (const std::string &name, void *data, bool setModified=true) |
Sets the data of the input called <name>. | |
std::string | GetObjectInfo () const |
size_t | GetObjectSize () const |
size_t | GetObjectRecursiveSize () const |
virtual IOStatus | bbBackwardUpdate (Connection::Pointer caller) |
Main processing method of the box. | |
Protected Member Functions | |
AtomicBlackBox (const std::string &name, bool alloc=true) | |
Constructor with the AtomicBlackBox's instance name. | |
AtomicBlackBox (AtomicBlackBox &from, const std::string &name, bool alloc=true) | |
Constructor from an existing box (copy) with a new instance name. | |
virtual | ~AtomicBlackBox () |
Destructor. | |
virtual void | bbLockDescriptor ()=0 |
virtual void | bbProcess () |
virtual void | bbUserProcess () |
virtual void | bbUserConstructor () |
User callback called in the box contructor. | |
virtual void | bbUserCopyConstructor () |
User callback called in the box copy constructor. | |
virtual void | bbUserDestructor () |
User callback called in the box destructor. | |
Protected Attributes | |
bbtk::BlackBoxDescriptor::Pointer | bbmDescriptorPointer |
Private Member Functions | |
AtomicBlackBox () |
Definition at line 77 of file bbtkAtomicBlackBox.h.
bbtk::AtomicBlackBox::AtomicBlackBox | ( | const std::string & | name, | |
bool | alloc = true | |||
) | [protected] |
Constructor with the AtomicBlackBox's instance name.
Definition at line 42 of file bbtkAtomicBlackBox.cxx.
References bbtkDebugMessage.
00043 : BlackBox(name) 00044 { 00045 bbtkDebugMessage("object",3, 00046 "==> AtomicBlackBox::AtomicBlackBox(\"" 00047 <<name<<"\")"<<std::endl); 00048 bbtkDebugMessage("object",3, 00049 "<== AtomicBlackBox::AtomicBlackBox(\"" 00050 <<name<<"\")"<<std::endl); 00051 }
bbtk::AtomicBlackBox::AtomicBlackBox | ( | AtomicBlackBox & | from, | |
const std::string & | name, | |||
bool | alloc = true | |||
) | [protected] |
Constructor from an existing box (copy) with a new instance name.
Constructor from an existing box (copy) with a new name.
Definition at line 56 of file bbtkAtomicBlackBox.cxx.
References bbtkDebugMessage.
00059 : BlackBox(from,name) 00060 { 00061 bbtkDebugMessage("object",3, 00062 "==>AtomicBlackBox::AtomicBlackBox(" 00063 <<from.bbGetFullName()<<",\"" 00064 <<name<<"\")"<<std::endl); 00065 bbtkDebugMessage("object",3, 00066 "<==AtomicBlackBox::AtomicBlackBox(" 00067 <<from.bbGetFullName()<<",\"" 00068 <<name<<"\")"<<std::endl); 00069 00070 }
bbtk::AtomicBlackBox::~AtomicBlackBox | ( | ) | [protected, virtual] |
Destructor.
Definition at line 76 of file bbtkAtomicBlackBox.cxx.
References bbtkDebugMessage.
00077 { 00078 bbtkDebugMessage("object",3,"==> AtomicBlackBox::~AtomicBlackBox()" 00079 <<std::endl); 00080 bbtkDebugMessage("object",3,"<== AtomicBlackBox::~AtomicBlackBox()" 00081 <<std::endl); 00082 }
bbtk::AtomicBlackBox::AtomicBlackBox | ( | ) | [inline, private] |
Default constructor is private : derived classes must use the constructor with the AtomicBlackBox's name
Definition at line 179 of file bbtkAtomicBlackBox.h.
bbtk::BlackBoxDescriptor::Pointer bbtk::AtomicBlackBox::bbGetDescriptor | ( | ) | const [inline] |
Definition at line 82 of file bbtkAtomicBlackBox.h.
Referenced by bbBruteForceSetInputPointer(), bbGetInput(), bbGetOutput(), bbSetInput(), and bbSetOutput().
00083 { 00084 return bbmDescriptorPointer; 00085 }
Data bbtk::AtomicBlackBox::bbGetOutput | ( | const std::string & | label | ) |
Gets the output Data of a given label.
Definition at line 159 of file bbtkAtomicBlackBox.cxx.
References bbGetDescriptor(), bbtkDebugDecTab, and bbtkDebugMessageInc.
00160 { 00161 bbtkDebugMessageInc("Data",7, 00162 "AtomicBlackBox::bbGetOutput(\""<<name<<"\") [" 00163 <<bbGetFullName()<<"]" 00164 <<std::endl); 00165 00166 Data p = ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor() 00167 ->GetOutputDescriptor(name))->GetGetFunctor()->Get(this); 00168 00169 bbtkDebugDecTab("Data",7); 00170 return p; 00171 }
Data bbtk::AtomicBlackBox::bbGetInput | ( | const std::string & | label | ) |
Gets the input Data of a given label.
Gets the input Data of a given name.
Definition at line 177 of file bbtkAtomicBlackBox.cxx.
References bbGetDescriptor(), bbtkDebugDecTab, and bbtkDebugMessageInc.
00178 { 00179 bbtkDebugMessageInc("Data",7, 00180 "AtomicBlackBox::bbGetInput(\""<<name<<"\") [" 00181 <<bbGetFullName()<<"]" 00182 <<std::endl); 00183 00184 Data p = ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor() 00185 ->GetInputDescriptor(name))->GetGetFunctor()->Get(this); 00186 00187 bbtkDebugDecTab("Data",7); 00188 return p; 00189 }
void bbtk::AtomicBlackBox::bbSetOutput | ( | const std::string & | name, | |
Data | data | |||
) |
Sets the data of the output called <name>.
Definition at line 195 of file bbtkAtomicBlackBox.cxx.
References bbGetDescriptor(), bbtkDebugDecTab, and bbtkDebugMessageInc.
00196 { 00197 bbtkDebugMessageInc("Data",7, 00198 "AtomicBlackBox::bbSetOutput(\""<<name<<"\",data) [" 00199 <<bbGetFullName()<<"]" 00200 <<std::endl); 00201 00202 ((AtomicBlackBoxOutputDescriptor*)bbGetDescriptor() 00203 ->GetOutputDescriptor(name))->GetSetFunctor()->Set(this,data); 00204 00205 bbtkDebugDecTab("Data",7); 00206 }
void bbtk::AtomicBlackBox::bbSetInput | ( | const std::string & | name, | |
Data | data, | |||
bool | setModified = true | |||
) |
Sets the data of the input called <name>.
Definition at line 212 of file bbtkAtomicBlackBox.cxx.
References bbGetDescriptor(), bbtkDebugDecTab, and bbtkDebugMessageInc.
00216 { 00217 bbtkDebugMessageInc("Data",7, 00218 "AtomicBlackBox::bbSetInput(\""<<name<<"\",data) [" 00219 <<bbGetFullName()<<"]" 00220 <<std::endl); 00221 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor()->GetInputDescriptor(name))->GetSetFunctor()->Set(this,data); 00222 00223 if (setModified) 00224 { 00225 bbSetModifiedStatus(); 00226 } 00227 00228 bbtkDebugDecTab("Data",7); 00229 }
void bbtk::AtomicBlackBox::bbBruteForceSetInputPointer | ( | const std::string & | name, | |
void * | data, | |||
bool | setModified = true | |||
) |
Sets the data of the input called <name>.
Definition at line 235 of file bbtkAtomicBlackBox.cxx.
References bbGetDescriptor(), bbtkDebugDecTab, and bbtkDebugMessageInc.
00240 { 00241 bbtkDebugMessageInc("Data",7, 00242 "AtomicBlackBox::bbBruteForceSetInputPointer(\"" 00243 <<name<<"\",data) [" 00244 <<bbGetFullName()<<"]" 00245 <<std::endl); 00246 ((AtomicBlackBoxInputDescriptor*)bbGetDescriptor() 00247 ->GetInputDescriptor(name))->GetSetFunctor() 00248 ->BruteForceSetPointer(this,data); 00249 00250 if (setModified) 00251 { 00252 bbSetModifiedStatus(); 00253 } 00254 00255 bbtkDebugDecTab("Data",7); 00256 }
std::string bbtk::AtomicBlackBox::GetObjectInfo | ( | ) | const |
Definition at line 262 of file bbtkAtomicBlackBox.cxx.
References bbtk::i.
00263 { 00264 std::stringstream i; 00265 return i.str(); 00266 }
size_t bbtk::AtomicBlackBox::GetObjectSize | ( | ) | const |
Definition at line 270 of file bbtkAtomicBlackBox.cxx.
Referenced by GetObjectRecursiveSize().
size_t bbtk::AtomicBlackBox::GetObjectRecursiveSize | ( | ) | const |
Definition at line 277 of file bbtkAtomicBlackBox.cxx.
References GetObjectSize().
00278 { 00279 size_t s = GetObjectSize(); 00280 return s; 00281 }
virtual void bbtk::AtomicBlackBox::bbLockDescriptor | ( | ) | [protected, pure virtual] |
IOStatus bbtk::AtomicBlackBox::bbBackwardUpdate | ( | Connection::Pointer | caller | ) | [virtual] |
Main processing method of the box.
Recursive pipeline processing in backward direction (recursion is in backward direction however execution always goes forward).
Definition at line 89 of file bbtkAtomicBlackBox.cxx.
References bbProcess(), bbtkDebugMessage, bbtkDebugMessageInc, bbtk::MODIFIED, bbtk::UPDATING, and bbtk::UPTODATE.
00090 { 00091 bbtkDebugMessageInc("process",3, 00092 "=> AtomicBlackBox::bbBackwardUpdate(" 00093 <<(caller?caller->GetFullName():"0")<<") [" 00094 <<bbGetFullName()<<"]"<<std::endl); 00095 00096 bbtkDebugMessage("process",5,"Initial Status = "<<bbGetStatus() 00097 <<std::endl); 00098 bbtkDebugMessage("process",5,"BoxProcessMode = " 00099 <<bbGetInputBoxProcessMode()<<std::endl); 00100 00101 00102 if ( ( bbGetStatus() == MODIFIED ) || 00103 ( bbBoxProcessModeIsAlways() ) ) 00104 { 00105 00106 bbSetStatus(UPDATING); 00107 00108 bool wasExecuting = bbGlobalGetSomeBoxExecuting(); 00109 bbGlobalSetSomeBoxExecuting(true); 00110 00111 // Updates its inputs 00112 IOStatus s = bbUpdateInputs(); 00113 00114 bbtkDebugMessage("process",6,"Inputs post-update status = "<<s<<std::endl); 00115 // If all inputs are in UPTODATE post-update status 00116 // and mProcessMode is not "Always" 00117 // then the box is now UPTODATE 00118 IOStatus new_status; 00119 if ( ( s == UPTODATE ) && 00120 ( ! bbBoxProcessModeIsAlways() ) ) 00121 { 00122 new_status = UPTODATE; 00123 } 00124 else 00125 { 00126 // else it remains MODIFIED 00127 new_status = MODIFIED; 00128 } 00129 bbSetStatus(new_status); 00130 00131 // User process 00132 bbProcess(); 00133 00134 // Displays the window (WxBlackbox) 00135 bbShowWindow(caller); 00136 00137 bbGlobalSetSomeBoxExecuting(wasExecuting); 00138 00139 } 00140 else 00141 { 00142 bbtkDebugMessage("process",5,"Up-to-date : nothing to do"<<std::endl); 00143 } 00144 00145 bbtkDebugMessage("process",5,"Final Status = " 00146 <<bbGetStatus()<<std::endl); 00147 bbtkDebugMessage("process",3, 00148 "<= AtomicBlackBox::bbBackwardUpdate() [" 00149 <<bbGetFullName()<<"]"<<std::endl); 00150 00151 00152 return bbGetStatus(); 00153 00154 }
virtual void bbtk::AtomicBlackBox::bbProcess | ( | ) | [inline, protected, virtual] |
Calls the user defined processing method. Overloaded in WxBlackBox to handle widget creation and show
Definition at line 149 of file bbtkAtomicBlackBox.h.
Referenced by bbBackwardUpdate().
00149 { this->bbUserProcess(); }
virtual void bbtk::AtomicBlackBox::bbUserProcess | ( | ) | [inline, protected, virtual] |
User callback which computes the outputs as a function of the inputs. It is assumed to be deterministic and thus is only called is the inputs have changed (i.e. if the black box is marked as modified)
Definition at line 156 of file bbtkAtomicBlackBox.h.
References bbtkWarning.
00157 { 00158 bbtkWarning("AtomicBlackBox::bbUserProcess() not overloaded for box '" 00159 <<bbGetFullName() 00160 <<"' : the box does nothing. Is it a bug or a feature ?" 00161 <<std::endl); 00162 }
virtual void bbtk::AtomicBlackBox::bbUserConstructor | ( | ) | [inline, protected, virtual] |
virtual void bbtk::AtomicBlackBox::bbUserCopyConstructor | ( | ) | [inline, protected, virtual] |
User callback called in the box copy constructor.
Definition at line 169 of file bbtkAtomicBlackBox.h.
virtual void bbtk::AtomicBlackBox::bbUserDestructor | ( | ) | [inline, protected, virtual] |
bbtk::BlackBoxDescriptor::Pointer bbtk::AtomicBlackBox::bbmDescriptorPointer [protected] |
Definition at line 185 of file bbtkAtomicBlackBox.h.