bbtkComplexBlackBox.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00043 #ifndef __bbtkComplexBlackBox_h__
00044 #define __bbtkComplexBlackBox_h__
00045
00046 #include "bbtkBlackBox.h"
00047 #include "bbtkComplexBlackBoxDescriptor.h"
00048
00049
00050 #include <list>
00051
00052 namespace bbtk
00053 {
00054
00055
00056
00057
00058 class BBTK_EXPORT ComplexBlackBox : public bbtk::BlackBox
00059 {
00060 BBTK_OBJECT_INTERFACE(ComplexBlackBox);
00061 friend class ComplexBlackBoxDescriptor;
00062 typedef BlackBox Superclass;
00063 public:
00064
00065
00067 BlackBoxDescriptor::Pointer bbGetDescriptor() const { return mDescriptor.lock(); }
00069
00071 BlackBox::Pointer bbClone(const std::string& name);
00072
00074 void Clear();
00076 void SetAsPrototype() { mLockedDescriptor.reset(); }
00078 bool IsAPrototype() const { return (!mLockedDescriptor); }
00079
00080 std::string bbGetNameWithParent() const;
00081
00082 void bbExecute(bool force = false);
00083
00084 Data bbGetOutput( const std::string &label );
00085 Data bbGetInput ( const std::string &label );
00086 void bbSetOutput( const std::string &name, Data data);
00087 void bbSetInput ( const std::string &name, Data data,
00088 bool setModified = true);
00089 void bbBruteForceSetInputPointer( const std::string &name,
00090 void* data,
00091 bool setModified = true);
00092
00094 virtual void bbConnectInput( const std::string& name, Connection* c);
00096 virtual void bbConnectOutput( const std::string& name, Connection* c);
00097
00098 BlackBox::Pointer bbGetBlackBox( const std::string& name );
00099
00101 typedef std::map<std::string, BlackBox::Pointer> BlackBoxMapType;
00102
00103 const BlackBoxMapType& bbGetBlackBoxMap() { return mBlackBoxMap; }
00104
00105 void bbPrintBlackBoxes();
00106
00114 void bbInsertHTMLGraph( std::ofstream& s,
00115 int detail,
00116 int level,
00117 bool instanceOrtype,
00118 const std::string& output_dir,
00119 bool relative_link );
00120
00124 virtual void bbWriteDotFileBlackBox(FILE *ff,
00125 BlackBox::Pointer parentblackbox,
00126 int detail, int level,
00127 bool instanceOrtype,
00128 bool relative_link );
00129
00130 virtual void bbWriteDotInputOutputName(FILE *ff,
00131 bool inputoutput,
00132 int detail, int level);
00133
00134 virtual BlackBox::Pointer bbFindBlackBox(const std::string &blackboxname);
00135
00136
00137 void Check(bool recursive=true);
00138
00139
00140
00141 protected:
00142
00143
00144 static ComplexBlackBox::Pointer
00145 New(const std::string &name,
00146 ComplexBlackBoxDescriptor::Pointer desc);
00147
00148 private:
00150 ComplexBlackBox(const std::string &name,
00151 ComplexBlackBoxDescriptor::Pointer desc);
00153 ComplexBlackBox(ComplexBlackBox& from, const std::string &name);
00154
00155 public:
00156 IOStatus bbBackwardUpdate(Connection::Pointer caller);
00157
00158 void bbSetModifiedStatus(BlackBoxInputConnector* c);
00159
00160 protected:
00161
00162
00163
00164 void bbAddBlackBox( BlackBox::Pointer );
00165 void bbAddToExecutionList( const std::string& name );
00166 void bbUnsafeAddBlackBox( BlackBox::Pointer );
00167 void bbRemoveBlackBox( const std::string& name,
00168 bool remove_connections = true);
00169 void bbAddConnection( Connection::Pointer );
00170
00171
00172
00173 BlackBox::Pointer bbUnsafeGetBlackBox( const std::string& name );
00174
00176 void bbAllocateConnectors();
00177 void bbDesallocateConnectors();
00178
00179 private:
00180
00181
00182
00184
00185
00186
00187
00188
00190 ComplexBlackBoxDescriptor::Pointer mLockedDescriptor;
00192 ComplexBlackBoxDescriptor::WeakPointer mDescriptor;
00193
00195 BlackBoxMapType mBlackBoxMap;
00196
00197
00199 typedef std::list<Connection::Pointer> ConnectionListType;
00201 ConnectionListType mConnectionList;
00202
00204 std::vector<std::string> mExecutionList;
00205
00206 };
00207
00208
00209
00210
00211
00212 }
00213
00214
00215
00216
00217
00218 #endif
00219