SkelGIS
3.0
|
00001 /*! \file dpmap_vector.hpp 00002 * \brief Definitions of the object DPMap_vector used by the user when he's manipulating AppyList skeleton on DDAG. 00003 */ 00004 #ifndef DPMAP_VECTOR_H 00005 #define DPMAP_VECTOR_H 00006 00007 #include <vector> 00008 00009 namespace skelgis{ 00010 00011 //================================================================================ 00012 //! DPMap_vector class 00013 /*! 00014 */ 00015 //------------------------------------------------------------------------------- 00016 template<class DPMapType> struct DPMap_vector 00017 //------------------------------------------------------------------------------- 00018 { 00019 protected : 00020 //! std::vector to store pointers on DPMap_Nodes_impl or DPMap_Edges_impl 00021 /*! 00022 This is what is actually stored in the DPMap_vector to hide pointers. 00023 */ 00024 std::vector<typename DPMapType::impl_type *> data; 00025 00026 public: 00027 //------------------------------------------------------------------------------- 00028 //! default constructor of DMatrix_vector 00029 //------------------------------------------------------------------------------- 00030 DPMap_vector(){} 00031 //------------------------------------------------------------------------------- 00032 //! destructor of the DMatrix_vector 00033 //------------------------------------------------------------------------------- 00034 ~DPMap_vector(){} 00035 //------------------------------------------------------------------------------- 00036 //! push_back method of the DPMap_vector class 00037 /*! 00038 This method add a new DPMap element at the end of the DPMap_vector. It works as the push_back method of the std::vector object. 00039 \param dp is the new DPMap to add 00040 */ 00041 //------------------------------------------------------------------------------- 00042 inline void push_back(DPMapType& dp){data.push_back(dp.getDPMap());} 00043 //------------------------------------------------------------------------------- 00044 //! operator [] of DPMap_vector 00045 /*! 00046 Similar to table brackets or to std::vector brackets to access an element of the DPMap_vector 00047 \param n is the index element to access in the DPMap_vector 00048 \return Returns a pointer to the element at position n in the DPMap_vector. 00049 */ 00050 //------------------------------------------------------------------------------- 00051 inline DPMapType operator[](int n){return DPMapType(data[n]);} 00052 //------------------------------------------------------------------------------- 00053 //! get impl of dpmap of DPMap_vector 00054 /*! 00055 directly get what is in the DPMap_vector 00056 \param i is the index to get 00057 \return Return the DPMap_.._impl 00058 */ 00059 //------------------------------------------------------------------------------- 00060 inline typename DPMapType::impl_type* getImpl(unsigned int i){return data[i];} 00061 //------------------------------------------------------------------------------- 00062 //! size method of the DPMap_vector class 00063 /*! 00064 This method returns the size of the DPMap_vector, in other words the number of elements. 00065 */ 00066 //------------------------------------------------------------------------------- 00067 inline int size(){return data.size();} 00068 //------------------------------------------------------------------------------- 00069 //! clear method of the DPMap_vector class 00070 /*! 00071 Removes all elements from the DPMap_vector, leaving the container with a size of 0 00072 */ 00073 //------------------------------------------------------------------------------- 00074 inline void clear(){data.clear();} 00075 //------------------------------------------------------------------------------- 00076 }; 00077 } 00078 00079 #endif