00001 00030 #ifndef _WALLBUILDER_H 00031 #define _WALLBUILDER_H 00032 #include <WritableType.H> 00033 #include <Capability.H> 00034 #include <COMObject.H> 00035 #include <queue> 00036 #include <vector> 00037 00038 // $Id: Type.H 66 2007-01-23 20:53:23Z fwph $ 00039 00040 #define WALLBUILDER "WallBuilder" 00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this 00042 // system will probably go away soon... 00043 //#define WALLBUILDERIDNUMBER 40 00044 00045 namespace WURDE { 00046 class Capability; 00047 class CommsManager; 00048 class Logger; 00049 00050 00051 class WallSpec { 00052 public: Point point0; 00053 std::string name; 00054 Point point1; 00055 }; 00056 00057 00058 class WallBuilderInfoStruct { 00059 public: Writable< bool > deleteWalls; 00060 std::string source; 00061 std::string target; 00062 Writable< std::vector< WallSpec > > wallList; 00063 Time timestamp; 00064 MessageType mType; 00065 }; 00066 00067 00068 class WallBuilderDataStruct { 00069 public: std::string source; 00070 Time timestamp; 00071 }; 00072 00078 class WallBuilder : virtual public Capability { 00079 00080 public: 00086 explicit WallBuilder(const std::string & streamname); 00087 00093 WallBuilder(const ConnectionStrategy & strategy,const std::string & gblName); 00094 00100 WallBuilder(const std::string & streamname,const std::string & gblName); 00101 00102 ~WallBuilder(); 00103 00104 00108 void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName); 00109 00110 00115 WallBuilderDataStruct data; 00116 00120 WallBuilderInfoStruct info; 00121 00125 WallBuilderInfoStruct requests; 00126 00127 //RobotObject imps 00128 void runUpdate(); 00129 void setManager(CommsManager *myManager_); 00130 void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<WallBuilderInfoStruct,WallBuilderDataStruct> *> (object);} 00131 void disconnect(){if(myCOMObject){myCOMObject->disconnect();}} 00132 void activateSupplier(); 00133 void activateConsumer(); 00134 std::string getInterfaceName(){ return WALLBUILDER;} 00135 void setStreamName(const std::string & name); 00136 void setGlobalName(const std::string & name); 00137 bool newData(); 00138 bool newInfo(); 00139 void setAutoPing(const bool & val); 00140 void doPing(); 00141 // int getID(){return WALLBUILDERIDNUMBER;} 00142 00146 bool getQueueMode(){return m_queue;}; 00147 00151 void setQueueMode(const bool & val); 00152 00157 WallBuilderDataStruct getNextData(); 00158 00163 WallBuilderInfoStruct getNextInfo(); 00164 00168 WallBuilderInfoStruct getNextRequest(){return getNextInfo();} 00169 00170 void publishData(); 00171 void publishInfo(); 00172 //void publishRequest(); 00173 00174 protected: 00175 COMObject<WallBuilderInfoStruct, WallBuilderDataStruct> *myCOMObject; 00176 00177 bool m_queue; 00178 00179 //notes that the object should be initialized as soon as a streamname is received 00180 bool m_initialize; 00181 std::queue<WallBuilderDataStruct> m_dataVector; 00182 std::queue<WallBuilderInfoStruct> m_infoVector; 00183 std::queue<WallBuilderInfoStruct> m_requestVector; 00184 00185 }; 00186 00187 } 00188 00189 00190 #endif