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

Go to the documentation of this file.
00001 
00030 #ifndef _PLAYBACKCONTROL_H
00031 #define _PLAYBACKCONTROL_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 PLAYBACKCONTROL "PlaybackControl"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define PLAYBACKCONTROLIDNUMBER 24
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class PlaybackControlInfoStruct {
00054         public:         std::string source;
00055                 Writable< RunState  > playbackControl;
00056                 Writable< Time  > fakeTimeOffset;
00057                 Writable< Time  > duration;
00058                 Writable< Time  > zeroTime;
00059                 Writable< int  > loop;
00060                 MessageType mType;
00061                 std::string target;
00062                 Time timestamp;
00063                 Writable< Time  > localFakeTime;
00064                 Writable< float  > multiplier;
00065         };
00066 
00067         
00068         class PlaybackControlDataStruct {
00069         public:         std::string source;
00070                 Time timestamp;
00071         };
00072   
00078         class PlaybackControl : virtual public Capability {
00079 
00080         public:
00086                explicit PlaybackControl(const std::string & streamname);               
00087 
00093                PlaybackControl(const ConnectionStrategy & strategy,const std::string & gblName);
00094 
00100                PlaybackControl(const std::string & streamname,const std::string & gblName);
00101                
00102                ~PlaybackControl();
00103 
00104 
00108                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00109 
00110                
00115                PlaybackControlDataStruct data;    
00116                
00120                PlaybackControlInfoStruct info;
00121                
00125                PlaybackControlInfoStruct requests;
00126                
00127                //RobotObject imps
00128                void runUpdate();
00129                void setManager(CommsManager *myManager_);
00130                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<PlaybackControlInfoStruct,PlaybackControlDataStruct> *> (object);}
00131                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00132                void activateSupplier();
00133                void activateConsumer();
00134                std::string getInterfaceName(){ return PLAYBACKCONTROL;}
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 PLAYBACKCONTROLIDNUMBER;}
00142 
00146                bool getQueueMode(){return m_queue;};
00147 
00151                void setQueueMode(const bool & val);
00152                
00157                PlaybackControlDataStruct getNextData();
00158                
00163                PlaybackControlInfoStruct getNextInfo();
00164 
00168                PlaybackControlInfoStruct getNextRequest(){return getNextInfo();}
00169 
00170                void publishData();
00171                void publishInfo();
00172                //void publishRequest();
00173                
00174         protected:
00175                COMObject<PlaybackControlInfoStruct, PlaybackControlDataStruct> *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<PlaybackControlDataStruct> m_dataVector;
00182                std::queue<PlaybackControlInfoStruct> m_infoVector;
00183                std::queue<PlaybackControlInfoStruct> m_requestVector;
00184         
00185         };
00186 
00187 }
00188 
00189 
00190 #endif

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