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 "creaSystem.h"
00051 #include <list>
00052
00053 namespace bbtk
00054 {
00055
00056
00057
00058
00059 class BBTK_EXPORT ComplexBlackBox : public bbtk::BlackBox
00060 {
00061 BBTK_OBJECT_INTERFACE(ComplexBlackBox);
00062 friend class ComplexBlackBoxDescriptor;
00063 typedef BlackBox Superclass;
00064 public:
00065
00066
00068 BlackBoxDescriptor::Pointer bbGetDescriptor() const { return mDescriptor.lock(); }
00070
00072 BlackBox::Pointer bbClone(const std::string& name);
00073
00075 void Clear();
00077 void SetAsPrototype() { mLockedDescriptor.reset(); }
00079 bool IsAPrototype() const { return (!mLockedDescriptor); }
00080
00081 std::string bbGetNameWithParent() const;
00082
00083 void bbExecute(bool force = false);
00084
00085 Data bbGetOutput( const std::string &label );
00086 Data bbGetInput ( const std::string &label );
00087 void bbSetOutput( const std::string &name, Data data);
00088 void bbSetInput ( const std::string &name, Data data,
00089 bool setModified = true);
00090 void bbBruteForceSetInputPointer( const std::string &name,
00091 void* data,
00092 bool setModified = true);
00093
00095 virtual void bbConnectInput( const std::string& name, Connection* c);
00097 virtual void bbConnectOutput( const std::string& name, Connection* c);
00098
00099 BlackBox::Pointer bbGetBlackBox( const std::string& name );
00100
00102 typedef std::map<std::string, BlackBox::Pointer> BlackBoxMapType;
00103
00104 const BlackBoxMapType& bbGetBlackBoxMap() { return mBlackBoxMap; }
00105
00106 void bbPrintBlackBoxes();
00107
00115 void bbInsertHTMLGraph( std::ofstream& s,
00116 int detail,
00117 int level,
00118 bool instanceOrtype,
00119 const std::string& output_dir,
00120 bool relative_link );
00121
00125 virtual void bbWriteDotFileBlackBox(FILE *ff,
00126 BlackBox::Pointer parentblackbox,
00127 int detail, int level,
00128 bool instanceOrtype,
00129 bool relative_link );
00130
00131 virtual void bbWriteDotInputOutputName(FILE *ff,
00132 bool inputoutput,
00133 int detail, int level);
00134
00135 virtual BlackBox::Pointer bbFindBlackBox(const std::string &blackboxname);
00136
00137
00138 void Check(bool recursive=true);
00139
00140
00141
00142 protected:
00143
00144
00145 static ComplexBlackBox::Pointer
00146 New(const std::string &name,
00147 ComplexBlackBoxDescriptor::Pointer desc);
00148
00149 private:
00151 ComplexBlackBox(const std::string &name,
00152 ComplexBlackBoxDescriptor::Pointer desc);
00154 ComplexBlackBox(ComplexBlackBox& from, const std::string &name);
00155
00156 protected:
00157
00158
00159
00160 void bbAddBlackBox( BlackBox::Pointer );
00161 void bbAddToExecutionList( const std::string& name );
00162 void bbUnsafeAddBlackBox( BlackBox::Pointer );
00163 void bbRemoveBlackBox( const std::string& name,
00164 bool remove_connections = true);
00165 void bbAddConnection( Connection::Pointer );
00166
00167
00168
00169 BlackBox::Pointer bbUnsafeGetBlackBox( const std::string& name );
00170
00172 void bbAllocateConnectors();
00173 void bbDesallocateConnectors();
00174
00175 private:
00176
00177
00178
00180
00181
00182
00183
00184
00186 ComplexBlackBoxDescriptor::Pointer mLockedDescriptor;
00188 ComplexBlackBoxDescriptor::WeakPointer mDescriptor;
00189
00191 BlackBoxMapType mBlackBoxMap;
00192
00193
00195 typedef std::list<Connection::Pointer> ConnectionListType;
00197 ConnectionListType mConnectionList;
00198
00200 std::vector<std::string> mExecutionList;
00201
00202 };
00203
00204
00205
00206
00207
00208 }
00209
00210
00211
00212
00213
00214 #endif
00215