00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CActionCollection_H 00029 #define CActionCollection_H 00030 00031 #include <mrpt/slam/CAction.h> 00032 #include <mrpt/slam/CActionRobotMovement2D.h> 00033 #include <mrpt/utils/CSerializable.h> 00034 00035 namespace mrpt 00036 { 00037 namespace slam 00038 { 00039 // This must be added to any CSerializable derived class: 00040 DEFINE_SERIALIZABLE_PRE( CActionCollection ) 00041 00042 00047 class MRPTDLLIMPEXP CActionCollection : public mrpt::utils::CSerializable 00048 { 00049 // This must be added to any CSerializable derived class: 00050 DEFINE_SERIALIZABLE( CActionCollection ) 00051 00052 protected: 00055 std::deque<CActionPtr> m_actions; 00056 00057 public: 00060 CActionCollection(); 00061 00064 CActionCollection( CAction &a ); 00065 00068 CActionCollection(const CActionCollection &o ); 00069 00072 CActionCollection& operator = (const CActionCollection &o ); 00073 00076 ~CActionCollection(); 00077 00080 typedef std::deque<CActionPtr>::iterator iterator; 00081 00084 typedef std::deque<CActionPtr>::const_iterator const_iterator; 00085 00097 const_iterator begin() const { return m_actions.begin(); } 00098 00110 iterator begin() { return m_actions.begin(); } 00111 00123 const_iterator end() const { return m_actions.end(); } 00124 00136 iterator end() { return m_actions.end(); } 00137 00138 00141 iterator erase( const iterator &it); 00142 00145 void clear(); 00146 00151 CActionPtr get(size_t index); 00152 00160 template <typename T> 00161 typename T::SmartPtr getActionByClass( const size_t &ith = 0 ) const 00162 { 00163 MRPT_TRY_START; 00164 size_t foundCount = 0; 00165 const mrpt::utils::TRuntimeClassId* class_ID = T::classinfo; 00166 for (const_iterator it = begin();it!=end();it++) 00167 if ( (*it)->GetRuntimeClass()->derivedFrom( class_ID ) ) 00168 if (foundCount++ == ith) 00169 return typename T::SmartPtr(*it); 00170 return typename T::SmartPtr(); // Not found: return empty smart pointer 00171 MRPT_TRY_END; 00172 } 00173 00174 00177 void insert(CAction &action); 00178 00181 size_t size(); 00182 00186 CActionRobotMovement2DPtr getBestMovementEstimation() const; 00187 00191 CActionRobotMovement2DPtr getMovementEstimationByType( CActionRobotMovement2D::TEstimationMethod method); 00192 00196 void eraseByIndex(const size_t & index); 00197 00198 00199 }; // End of class def. 00200 00201 00202 } // End of namespace 00203 } // End of namespace 00204 00205 #endif
Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Thu Feb 26 02:14:51 EST 2009 |