Elem.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                         Elem.h - Copyright klank
00021 
00022 
00023 **************************************************************************/
00024 
00025 
00026 #ifndef ELEM_H
00027 #define ELEM_H
00028 
00029 #include <string>
00030 #include <vector>
00031 #include "ElemTypes.h"
00032 
00033 
00034 #include <boost/thread.hpp>
00035 
00036 #define XML_PROPERTY_ELEMID "ElemID"
00037 #define XML_PROPERTY_PPID "CreatorPP"
00038 
00039 #define XML_NODE_ELEMENT "Elem"
00040 
00041 
00042 #define FORBIDDEN_ID_RANGE_MIN 700000
00043 
00044 namespace cop
00045 {
00046 
00047   class XMLTag;
00048   class Sensor;
00049 
00060   class Elem
00061   {
00062   public:
00066     Elem( );
00070     Elem ( ObjectID_t id );
00071 
00075     virtual ~Elem( );
00076 
00077     // Static Public attributes
00078     //
00079     static ObjectID_t m_LastID;
00080     // Public attributes
00081     //
00082     ObjectID_t m_ID;
00087     XMLTag* Save(bool full_pose = false);
00094     static Elem* ElemFactory(XMLTag* tag);
00098     virtual Elem* Duplicate(bool bStaticCopy = true);
00102     virtual std::string GetNodeName() const {return XML_NODE_ELEMENT;}
00103 
00107     virtual ElemType_t GetType() const {return ELEM;}
00111     virtual void Show(Sensor* ){};
00115     virtual void SetLastPerceptionPrimitive(PerceptionPrimitiveID_t id){m_creator = id;}
00119     virtual PerceptionPrimitiveID_t GetLastPerceptionPrimitive(){return m_creator;}
00123     virtual unsigned long date() const
00124     {
00125       return m_timestamp;
00126     }
00127     void Touch();
00128     void SetTimeStamp(unsigned long timestamp)
00129     {
00130       m_timestamp = timestamp;
00131     }
00132 
00133     void SetFullPose(bool fullPose){m_fullPose = fullPose;}
00134 
00135     /***********************************************************************
00136     * Evaluate                                                     */
00137     /************************************************************************
00138     * @brief Puts a result to a descriptor to set its quality.
00139     * @param eval a value from 0.0 (bad) to 1.0 (good)
00140     * @param weight a value describing the influence of the former
00141     *        m_qualityMeasure
00142     *************************************************************************/
00143     virtual void Evaluate(const double eval, const double weight){}
00144 
00145 
00146   protected:
00150     virtual void SaveTo(XMLTag* )      {}
00154     virtual void SetData(XMLTag* data);
00155 
00156     bool m_fullPose;
00157 
00158     typedef boost::mutex::scoped_lock ElemWriteLock;
00159     boost::mutex m_mutexElems;
00160 
00161   private:
00162    unsigned long m_timestamp;
00163    PerceptionPrimitiveID_t m_creator;
00164 
00165   };
00166 }
00167 #endif // ELEM___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