/home/fwph/code/wurde/rde/core/capabilities/MCPControl.H

Go to the documentation of this file.
00001 
00030 #ifndef _MCPCONTROL_H
00031 #define _MCPCONTROL_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 MCPCONTROL "MCPControl"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define MCPCONTROLIDNUMBER 18
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class MCPControlInfoStruct {
00054         public:         std::string source;
00055                 std::string target;
00056                 Time timestamp;
00057                 MessageType mType;
00058         };
00059 
00060         
00061         class MCPControlDataStruct {
00062         public:         std::string source;
00063                 std::string target;
00064                 Time timestamp;
00065                 RunState state;
00066         };
00067   
00073         class MCPControl : virtual public Capability {
00074 
00075         public:
00081                explicit MCPControl(const std::string & streamname);            
00082 
00088                MCPControl(const ConnectionStrategy & strategy,const std::string & gblName);
00089 
00095                MCPControl(const std::string & streamname,const std::string & gblName);
00096                
00097                ~MCPControl();
00098 
00099 
00103                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00104 
00105                
00110                MCPControlDataStruct data;    
00111                
00115                MCPControlInfoStruct info;
00116                
00120                MCPControlInfoStruct requests;
00121                
00122                //RobotObject imps
00123                void runUpdate();
00124                void setManager(CommsManager *myManager_);
00125                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<MCPControlInfoStruct,MCPControlDataStruct> *> (object);}
00126                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00127                void activateSupplier();
00128                void activateConsumer();
00129                std::string getInterfaceName(){ return MCPCONTROL;}
00130                void setStreamName(const std::string & name);
00131                void setGlobalName(const std::string & name);
00132                bool newData();
00133                bool newInfo();
00134                void setAutoPing(const bool & val);
00135                void doPing();
00136                //              int getID(){return MCPCONTROLIDNUMBER;}
00137 
00141                bool getQueueMode(){return m_queue;};
00142 
00146                void setQueueMode(const bool & val);
00147                
00152                MCPControlDataStruct getNextData();
00153                
00158                MCPControlInfoStruct getNextInfo();
00159 
00163                MCPControlInfoStruct getNextRequest(){return getNextInfo();}
00164 
00165                void publishData();
00166                void publishInfo();
00167                //void publishRequest();
00168                
00169         protected:
00170                COMObject<MCPControlInfoStruct, MCPControlDataStruct> *myCOMObject;
00171 
00172                bool m_queue;
00173 
00174                //notes that the object should be initialized as soon as a streamname is received
00175                bool m_initialize;
00176                std::queue<MCPControlDataStruct> m_dataVector;
00177                std::queue<MCPControlInfoStruct> m_infoVector;
00178                std::queue<MCPControlInfoStruct> m_requestVector;
00179         
00180         };
00181 
00182 }
00183 
00184 
00185 #endif

Generated on Thu Feb 1 15:31:53 2007 for WURDE by  doxygen 1.5.1