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

Go to the documentation of this file.
00001 
00030 #ifndef _IMAGEDISPLAY_H
00031 #define _IMAGEDISPLAY_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 IMAGEDISPLAY "ImageDisplay"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define IMAGEDISPLAYIDNUMBER 12
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class ImageDisplayInfoStruct {
00054         public:         std::string source;
00055                 Writable< bool  > displayImage;
00056                 std::string target;
00057                 Time timestamp;
00058                 Writable< std::string  > currentImage;
00059                 Writable< std::string  > currentSet;
00060                 MessageType mType;
00061         };
00062 
00063         
00064         class ImageDisplayDataStruct {
00065         public:         std::vector< std::string > imageSets;
00066                 std::string source;
00067                 Time timestamp;
00068                 std::vector< std::string > availableImages;
00069         };
00070   
00076         class ImageDisplay : virtual public Capability {
00077 
00078         public:
00084                explicit ImageDisplay(const std::string & streamname);          
00085 
00091                ImageDisplay(const ConnectionStrategy & strategy,const std::string & gblName);
00092 
00098                ImageDisplay(const std::string & streamname,const std::string & gblName);
00099                
00100                ~ImageDisplay();
00101 
00102 
00106                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00107 
00108                
00113                ImageDisplayDataStruct data;    
00114                
00118                ImageDisplayInfoStruct info;
00119                
00123                ImageDisplayInfoStruct requests;
00124                
00125                //RobotObject imps
00126                void runUpdate();
00127                void setManager(CommsManager *myManager_);
00128                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<ImageDisplayInfoStruct,ImageDisplayDataStruct> *> (object);}
00129                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00130                void activateSupplier();
00131                void activateConsumer();
00132                std::string getInterfaceName(){ return IMAGEDISPLAY;}
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 IMAGEDISPLAYIDNUMBER;}
00140 
00144                bool getQueueMode(){return m_queue;};
00145 
00149                void setQueueMode(const bool & val);
00150                
00155                ImageDisplayDataStruct getNextData();
00156                
00161                ImageDisplayInfoStruct getNextInfo();
00162 
00166                ImageDisplayInfoStruct getNextRequest(){return getNextInfo();}
00167 
00168                void publishData();
00169                void publishInfo();
00170                //void publishRequest();
00171                
00172         protected:
00173                COMObject<ImageDisplayInfoStruct, ImageDisplayDataStruct> *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<ImageDisplayDataStruct> m_dataVector;
00180                std::queue<ImageDisplayInfoStruct> m_infoVector;
00181                std::queue<ImageDisplayInfoStruct> m_requestVector;
00182         
00183         };
00184 
00185 }
00186 
00187 
00188 #endif

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