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

Go to the documentation of this file.
00001 
00030 #ifndef _MCPREQUEST_H
00031 #define _MCPREQUEST_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 MCPREQUEST "McpRequest"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define MCPREQUESTIDNUMBER 20
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class McpRequestInfoStruct {
00054         public:         std::string source;
00055                 Writable< ConnectionStrategy  > strategy;
00056                 Writable< StatusMode  > status;
00057                 Writable< std::string  > stream;
00058                 MessageType mType;
00059                 std::string target;
00060                 Time timestamp;
00061                 Writable< std::string  > robotModule;
00062                 Writable< std::string  > type;
00063                 Writable< std::string  > gblname;
00064         };
00065 
00066         
00067         class McpRequestDataStruct {
00068         public:         std::string source;
00069                 RunState state;
00070                 std::string target;
00071                 Time timestamp;
00072         };
00073   
00079         class McpRequest : virtual public Capability {
00080 
00081         public:
00087                explicit McpRequest(const std::string & streamname);            
00088 
00094                McpRequest(const ConnectionStrategy & strategy,const std::string & gblName);
00095 
00101                McpRequest(const std::string & streamname,const std::string & gblName);
00102                
00103                ~McpRequest();
00104 
00105 
00109                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00110 
00111                
00116                McpRequestDataStruct data;    
00117                
00121                McpRequestInfoStruct info;
00122                
00126                McpRequestInfoStruct requests;
00127                
00128                //RobotObject imps
00129                void runUpdate();
00130                void setManager(CommsManager *myManager_);
00131                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<McpRequestInfoStruct,McpRequestDataStruct> *> (object);}
00132                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00133                void activateSupplier();
00134                void activateConsumer();
00135                std::string getInterfaceName(){ return MCPREQUEST;}
00136                void setStreamName(const std::string & name);
00137                void setGlobalName(const std::string & name);
00138                bool newData();
00139                bool newInfo();
00140                void setAutoPing(const bool & val);
00141                void doPing();
00142                //              int getID(){return MCPREQUESTIDNUMBER;}
00143 
00147                bool getQueueMode(){return m_queue;};
00148 
00152                void setQueueMode(const bool & val);
00153                
00158                McpRequestDataStruct getNextData();
00159                
00164                McpRequestInfoStruct getNextInfo();
00165 
00169                McpRequestInfoStruct getNextRequest(){return getNextInfo();}
00170 
00171                void publishData();
00172                void publishInfo();
00173                //void publishRequest();
00174                
00175         protected:
00176                COMObject<McpRequestInfoStruct, McpRequestDataStruct> *myCOMObject;
00177 
00178                bool m_queue;
00179 
00180                //notes that the object should be initialized as soon as a streamname is received
00181                bool m_initialize;
00182                std::queue<McpRequestDataStruct> m_dataVector;
00183                std::queue<McpRequestInfoStruct> m_infoVector;
00184                std::queue<McpRequestInfoStruct> m_requestVector;
00185         
00186         };
00187 
00188 }
00189 
00190 
00191 #endif

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