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

Go to the documentation of this file.
00001 
00030 #ifndef _FOO_H
00031 #define _FOO_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 FOO "Foo"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define FOOIDNUMBER 8
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class FooInfoStruct {
00054         public:         Writable< float  > maxRange;
00055                 std::string source;
00056                 std::string target;
00057                 Time timestamp;
00058                 Writable< float  > angleMin;
00059                 Writable< float  > angleMax;
00060                 MessageType mType;
00061         };
00062 
00063         
00064         class FooDataStruct {
00065         public:         std::string source;
00066                 Time timestamp;
00067                 std::vector< float > ranges;
00068                 int size;
00069         };
00070   
00076         class Foo : virtual public Capability {
00077 
00078         public:
00084                explicit Foo(const std::string & streamname);           
00085 
00091                Foo(const ConnectionStrategy & strategy,const std::string & gblName);
00092 
00098                Foo(const std::string & streamname,const std::string & gblName);
00099                
00100                ~Foo();
00101 
00102 
00106                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00107 
00108                
00113                FooDataStruct data;    
00114                
00118                FooInfoStruct info;
00119                
00123                FooInfoStruct requests;
00124                
00125                //RobotObject imps
00126                void runUpdate();
00127                void setManager(CommsManager *myManager_);
00128                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<FooInfoStruct,FooDataStruct> *> (object);}
00129                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00130                void activateSupplier();
00131                void activateConsumer();
00132                std::string getInterfaceName(){ return FOO;}
00133                void setStreamName(const std::string & name);
00134                void setGlobalName(const std::string & name);
00135                bool newData();
00136                bool newInfo();
00137                void setAutoPing(const bool & val);
00138                void doPing();
00139                //              int getID(){return FOOIDNUMBER;}
00140 
00144                bool getQueueMode(){return m_queue;};
00145 
00149                void setQueueMode(const bool & val);
00150                
00155                FooDataStruct getNextData();
00156                
00161                FooInfoStruct getNextInfo();
00162 
00166                FooInfoStruct getNextRequest(){return getNextInfo();}
00167 
00168                void publishData();
00169                void publishInfo();
00170                //void publishRequest();
00171                
00172         protected:
00173                COMObject<FooInfoStruct, FooDataStruct> *myCOMObject;
00174 
00175                bool m_queue;
00176 
00177                //notes that the object should be initialized as soon as a streamname is received
00178                bool m_initialize;
00179                std::queue<FooDataStruct> m_dataVector;
00180                std::queue<FooInfoStruct> m_infoVector;
00181                std::queue<FooInfoStruct> m_requestVector;
00182         
00183         };
00184 
00185 }
00186 
00187 
00188 #endif

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