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

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