bbtkConnection.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
00041 #ifndef __bbtkConnection_h__
00042 #define __bbtkConnection_h__
00043
00044 #include "bbtkSystem.h"
00045 #include "bbtkObject.h"
00046
00047 #include <string>
00048
00049 namespace bbtk
00050 {
00051
00052 class Factory;
00053 BBTK_FORWARD_DECLARE_POINTER(Factory);
00054 class BlackBox;
00055 BBTK_FORWARD_DECLARE_POINTER(BlackBox);
00056 class BlackBoxInputConnector;
00057 class BlackBoxOutputConnector;
00058
00060 typedef unsigned char IOStatus;
00062 const IOStatus UPTODATE = 0;
00064 const IOStatus MODIFIED = 1;
00066 const IOStatus OUTOFDATE = 2;
00067
00068 BBTK_EXPORT const std::string& GetIOStatusString( IOStatus );
00069
00070
00071 class BBTK_EXPORT Connection : public Object
00072 {
00073 BBTK_OBJECT_INTERFACE(Connection);
00074 typedef Object Superclass;
00075 public:
00076
00077 static Pointer New(BlackBoxPointer from, const std::string& output,
00078 BlackBoxPointer to, const std::string& input,
00079 const FactoryPointer f);
00080 static Pointer New(BlackBoxPointer from, const std::string& output,
00081 BlackBoxPointer to, const std::string& input);
00083
00084
00085
00086
00093 void RecursiveExecute();
00094
00096 void OnOutputChange(BlackBoxPointer, const std::string&,
00097 IOStatus);
00098
00099 std::string GetFullName() const;
00100
00102 BlackBoxPointer GetOriginalBlackBoxFrom() const { return mOriginalFrom.lock(); }
00104 BlackBoxPointer GetOriginalBlackBoxTo() const { return mOriginalTo.lock(); }
00106 const std::string& GetOriginalBlackBoxFromOutput() const { return mOriginalOutput; }
00108 const std::string& GetOriginalBlackBoxToInput() const { return mOriginalInput; }
00109
00111 BlackBoxPointer GetBlackBoxFrom() const { return mFrom; }
00113 BlackBoxPointer GetBlackBoxTo() const { return mTo; }
00115 const std::string& GetBlackBoxFromOutput() const { return mOutput; }
00117 const std::string& GetBlackBoxToInput() const { return mInput; }
00118
00120 void SetBlackBoxFrom(BlackBoxPointer b) { mFrom = b; }
00122 void SetBlackBoxTo(BlackBoxPointer b) { mTo = b; }
00124 void SetBlackBoxFromOutput(const std::string& o) { mOutput = o; }
00126 void SetBlackBoxToInput(const std::string& o) { mInput = o; }
00127
00129 void Check() const;
00130
00131 protected:
00133 BlackBoxPointer mFrom;
00134 BlackBoxWeakPointer mOriginalFrom;
00136 std::string mOutput;
00137 std::string mOriginalOutput;
00139
00141 BlackBoxPointer mTo;
00142 BlackBoxWeakPointer mOriginalTo;
00144 std::string mInput;
00145 std::string mOriginalInput;
00147
00149 BlackBoxPointer mAdaptor;
00150
00152 const FactoryWeakPointer mFactory;
00153
00155 bool mFromAny;
00156
00158 bool mToAny;
00159
00160
00162 bool mDoDynamicCast;
00163
00167
00168
00169 public:
00170 void TransferData();
00171
00172 private:
00174 Connection(BlackBoxPointer from, const std::string& output,
00175 BlackBoxPointer to, const std::string& input,
00176 const FactoryPointer f);
00178 Connection(BlackBoxPointer from, const std::string& output,
00179 BlackBoxPointer to, const std::string& input);
00180
00181 };
00182
00183 }
00184
00185 #endif
00186