SkelGIS  3.0
/home/helene/Documents/These/SkelGIS/SkelGIS_Library/SkelGIS_V3/skelgis/util/dmatrix_vector.hpp
Go to the documentation of this file.
00001 /*! \file dmatrix_vector.hpp
00002  *  \brief Definitions of the object DMatrix_vector used by the user when he's manipulating AppyList skeleton.
00003  */
00004 #ifndef DMATRIX_VECTOR_H
00005 #define DMATRIX_VECTOR_H
00006 
00007 #include <vector>
00008 
00009 namespace skelgis{
00010 
00011   //================================================================================
00012   //! DMatrix_vector class
00013   /*!
00014     template of DMatrix_vector of SkelGIS. This is the first specialization of the DMatrix_vector.
00015     This object has to be used for ApplyList skeleton.
00016     \tparam T is the type of data stored in all DMatrix of the DMatrix_vector
00017     \tparam R is the overlap distance for all DMatrix in DMatrix_vector
00018     \tparam line is the parallel distribution used for all Dmatrix in DMatrix_vector
00019   */
00020   //-------------------------------------------------------------------------------
00021   template<class T,int R,bool line=true> struct DMatrix_vector
00022   //-------------------------------------------------------------------------------
00023   {
00024   protected :
00025     //! std::vector to store pointers on DMatrix_impl
00026     /*!
00027       This is what is actually stored in the DMatrix_vector to hide pointers.
00028     */
00029     std::vector<DMatrix_impl<T,R>* > data;
00030 
00031   public:
00032     //-------------------------------------------------------------------------------
00033     //! default constructor of DMatrix_vector
00034     //-------------------------------------------------------------------------------
00035     DMatrix_vector(){}
00036     //-------------------------------------------------------------------------------
00037     //! destructor of the DMatrix_vector
00038     //-------------------------------------------------------------------------------
00039     ~DMatrix_vector(){}
00040     //-------------------------------------------------------------------------------
00041     //! push_back method of the DMatrix_vector class
00042     /*!
00043       This method add a new DMatrix element at the end of the DMatrix_vector. It works as the push_back method of the std::vector object.
00044       \param m is the new DMatrix to add
00045     */
00046     //-------------------------------------------------------------------------------
00047     inline void push_back(DMatrix<T,R>& m){data.push_back(m.getDMatrix());}
00048     //-------------------------------------------------------------------------------
00049     //! operator [] of DMatrix_vector
00050     /*!
00051       Similar to table brackets or to std::vector brackets to access an element of the DMatrix_vector
00052       \param n is the index element to access in the DMatrix_vector
00053       \return Returns a pointer to the element at position n in the DMatrix_vector.
00054     */
00055     //-------------------------------------------------------------------------------
00056     inline DMatrix_impl<T,R> * operator[](int n){return data[n];}
00057     //-------------------------------------------------------------------------------
00058     //! size method of the DMatrix_vector class
00059     /*!
00060       This method returns the size of the DMatrix_vector, in other words the number of elements.
00061     */
00062     //-------------------------------------------------------------------------------
00063     inline int size(){return data.size();}
00064     //-------------------------------------------------------------------------------
00065     //! clear method of the DMatrix_vector class
00066     /*!
00067       Removes all elements from the DMatrix_vector, leaving the container with a size of 0
00068     */
00069     //-------------------------------------------------------------------------------
00070     inline void clear(){data.clear();}
00071     //-------------------------------------------------------------------------------
00072   };
00073   //-------------------------------------------------------------------------------
00074 
00075   //================================================================================
00076   //! DMatrix_vector class
00077   /*!
00078     template of DMatrix_vector of SkelGIS. This is the first specialization of the DMatrix_vector.
00079     specialization with line=false
00080     a specialization with R=0 is not usefull for DMatrix_vector
00081     This object has to be used for ApplyList skeleton.
00082     \tparam T is the type of data stored in all DMatrix of the DMatrix_vector
00083     \tparam R is the overlap distance for all DMatrix in DMatrix_vector
00084   */
00085   //-------------------------------------------------------------------------------
00086   template<class T,int R> struct DMatrix_vector<T,R,false>
00087   //-------------------------------------------------------------------------------
00088   {
00089   protected :
00090     //! std::vector to store pointers on DMatrix_impl
00091     /*!
00092       This is what is actually stored in the DMatrix_vector to hide pointers.
00093     */
00094     std::vector<DMatrix_impl<T,R,false>* > data;
00095 
00096   public:
00097     //-------------------------------------------------------------------------------
00098     //! default constructor of DMatrix_vector
00099     //-------------------------------------------------------------------------------
00100     DMatrix_vector(){}
00101     //-------------------------------------------------------------------------------
00102     //! destructor of the DMatrix_vector
00103     //-------------------------------------------------------------------------------
00104     ~DMatrix_vector(){}
00105     //-------------------------------------------------------------------------------
00106     //-------------------------------------------------------------------------------
00107     //! push_back method of the DMatrix_vector class
00108     /*!
00109       This method add a new DMatrix element at the end of the DMatrix_vector. It works as the push_back method of the std::vector object.
00110       \param m is the new DMatrix to add
00111     */
00112     //-------------------------------------------------------------------------------
00113     inline void push_back(DMatrix<T,R,false>& m){data.push_back(m.getDMatrix());}
00114     //-------------------------------------------------------------------------------
00115     //! operator [] of DMatrix_vector
00116     /*!
00117       Similar to table brackets or to std::vector brackets to access an element of the DMatrix_vector
00118       \param n is the index element to access in the DMatrix_vector
00119       \return Returns a pointer to the element at position n in the DMatrix_vector.
00120     */
00121     //-------------------------------------------------------------------------------
00122     inline DMatrix_impl<T,R,false> * operator[](int n){return data[n];}
00123     //-------------------------------------------------------------------------------
00124     //! size method of the DMatrix_vector class
00125     /*!
00126       This method returns the size of the DMatrix_vector, in other words the number of elements.
00127     */
00128     //-------------------------------------------------------------------------------
00129     inline int size(){return data.size();}
00130     //-------------------------------------------------------------------------------
00131     //! clear method of the DMatrix_vector class
00132     /*!
00133       Removes all elements from the DMatrix_vector, leaving the container with a size of 0
00134     */
00135     //-------------------------------------------------------------------------------
00136     inline void clear(){data.clear();}
00137     //-------------------------------------------------------------------------------
00138   };
00139   //-------------------------------------------------------------------------------
00140 
00141 }
00142 
00143 #endif
 All Classes Files Functions Variables Defines