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

Go to the documentation of this file.
00001 
00030 #ifndef _BLOBFINDER_H
00031 #define _BLOBFINDER_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 BLOBFINDER "BlobFinder"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define BLOBFINDERIDNUMBER 0
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051         class Blob {
00052         public:         int width;
00053                 std::string colorName;
00054                 Point origin;
00055                 int pixelsCovered;
00056                 Point centroid;
00057                 int height;
00058         };
00059 
00060         
00061         class BlobFinderInfoStruct {
00062         public:         std::string source;
00063                 Writable< std::vector< std::string > > searchColors;
00064                 std::string target;
00065                 Time timestamp;
00066                 Writable< bool  > deleteBlobs;
00067                 MessageType mType;
00068         };
00069 
00070         
00071         class BlobFinderDataStruct {
00072         public:         std::string source;
00073                 std::vector< Blob > foundBlobs;
00074                 Time timestamp;
00075         };
00076   
00082         class BlobFinder : virtual public Capability {
00083 
00084         public:
00090                explicit BlobFinder(const std::string & streamname);            
00091 
00097                BlobFinder(const ConnectionStrategy & strategy,const std::string & gblName);
00098 
00104                BlobFinder(const std::string & streamname,const std::string & gblName);
00105                
00106                ~BlobFinder();
00107 
00108 
00112                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00113 
00114                
00119                BlobFinderDataStruct data;    
00120                
00124                BlobFinderInfoStruct info;
00125                
00129                BlobFinderInfoStruct requests;
00130                
00131                //RobotObject imps
00132                void runUpdate();
00133                void setManager(CommsManager *myManager_);
00134                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<BlobFinderInfoStruct,BlobFinderDataStruct> *> (object);}
00135                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00136                void activateSupplier();
00137                void activateConsumer();
00138                std::string getInterfaceName(){ return BLOBFINDER;}
00139                void setStreamName(const std::string & name);
00140                void setGlobalName(const std::string & name);
00141                bool newData();
00142                bool newInfo();
00143                void setAutoPing(const bool & val);
00144                void doPing();
00145                //              int getID(){return BLOBFINDERIDNUMBER;}
00146 
00150                bool getQueueMode(){return m_queue;};
00151 
00155                void setQueueMode(const bool & val);
00156                
00161                BlobFinderDataStruct getNextData();
00162                
00167                BlobFinderInfoStruct getNextInfo();
00168 
00172                BlobFinderInfoStruct getNextRequest(){return getNextInfo();}
00173 
00174                void publishData();
00175                void publishInfo();
00176                //void publishRequest();
00177                
00178         protected:
00179                COMObject<BlobFinderInfoStruct, BlobFinderDataStruct> *myCOMObject;
00180 
00181                bool m_queue;
00182 
00183                //notes that the object should be initialized as soon as a streamname is received
00184                bool m_initialize;
00185                std::queue<BlobFinderDataStruct> m_dataVector;
00186                std::queue<BlobFinderInfoStruct> m_infoVector;
00187                std::queue<BlobFinderInfoStruct> m_requestVector;
00188         
00189         };
00190 
00191 }
00192 
00193 
00194 #endif

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