Reading.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009 by Ulrich Friedrich Klank <klank@in.tum.de>
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 3 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 /************************************************************************
00020                         READING_H - Copyright klank
00021 
00022 **************************************************************************/
00023 
00024 
00025 #ifndef READING_H
00026 #define READING_H
00027 
00028 #include <string>
00029 #include <map>
00030 #include <stdio.h>
00035 #define XML_NODE_IMAGEFILE "ImageFile"
00036 #define XML_ATTRIBUTE_FILENAME "FileName"
00037 #define XML_ATTRIBUTE_IMGTYPE "ImgType"
00038 
00039 enum ReadingType_t
00040 {
00041   ReadingType_HalconImage,
00042   ReadingType_IplImage,
00043   ReadingType_PointCloud
00044 };
00045 
00046 namespace cop
00047 {
00048   class XMLTag;
00049   class RelPose;
00050   class ReadingConverter;
00051 
00052   /******************************************************************
00053   *           class Reading                                         */
00059   class Reading
00060   {
00061   public:
00062 
00063     // Constructors/Destructors
00064     //
00065 
00066 
00070     Reading (ReadingType_t type) :
00071         m_readingType(type),
00072         m_usageCount(0),
00073         m_timestamp((unsigned long)time(NULL)),
00074         m_relPose(NULL)
00075     {}
00076 
00082     static Reading* ReadingFactory( XMLTag* tag);
00083 
00087     virtual void SetData(XMLTag* tag){}
00088 
00093     virtual ~Reading ( );
00094 
00098     virtual XMLTag* Save() = 0;
00099 
00103     virtual Reading* Clone() = 0;
00104 
00108     void Hold()
00109     {
00110         m_usageCount++;
00111     }
00115     void Free(){
00116         m_usageCount--;
00117     }
00121     ReadingType_t GetType() const{printf("Requested reading type: %d\n", m_readingType); return m_readingType;}
00125     void SetPose(RelPose* parent);
00129     RelPose* GetPose() const
00130     {
00131         return m_relPose;
00132     }
00133 
00134     Reading* ConvertTo(ReadingType_t type);
00135 
00139     virtual unsigned long date() const
00140     {
00141         return m_timestamp;
00142     }
00143 
00144 
00145   public:
00146       static std::map<std::pair<ReadingType_t, ReadingType_t> , ReadingConverter*> s_conv;
00147       ReadingType_t m_readingType;
00148       int m_usageCount;
00149       unsigned long m_timestamp;
00150       RelPose* m_relPose;
00151   };
00152 
00153   /******************************************************************
00154   *           class ReadingConverter                                */
00159   class ReadingConverter
00160   {
00161   public:
00162     static ReadingConverter* ReadingConverterFactory(std::string name);
00163     virtual Reading* Convert(Reading* in) = 0;
00164     virtual ReadingType_t TypeIn() = 0;
00165     virtual ReadingType_t TypeOut() = 0;
00166   };
00167 
00168 }
00169 #endif // READING_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cognitive_perception
Author(s): Ulrich F Klank
autogenerated on Thu May 23 2013 07:38:34