SkelGIS  3.0
/home/helene/Documents/These/SkelGIS/SkelGIS_Library/SkelGIS_V3/skelgis/data_structures/DDAG/ddag.hpp
Go to the documentation of this file.
00001 /*! \file ddag.hpp
00002  *  \brief Definitions of the object DDAG used by the user. Three template specializations are available.
00003  *  DDAG is the structure of the tree, not data. data are stored in DProperty objects.
00004  *  DDAG is an interface to the DDAG_impl
00005  */
00006 #ifndef DDAG_H
00007 #define DDAG_H
00008 
00009 #include "ddag_impl.hpp"
00010 
00011 namespace skelgis{
00012   
00013   //-------------------------------------------------------------------------------
00014   //!  base template class of Distributed DAG
00015   /*!
00016     This template class defines the base distributed dag
00017     This basic template does not have an implementation, only specializations have
00018     direction of the DAG is not usefull the input file of the user precise the direction
00019     no parameter on the physical border because roots and leafs nodes are always managed in a different way than standard elements (different neighborhood etc.)
00020     \tparam node is a boolean parameter to indicate if computations on nodes are needed for this DDAG
00021     \tparam edge is a boolean parameter to indicate if computations on edges are needed for this DDAG
00022   */
00023   //-------------------------------------------------------------------------------
00024   template<bool node, bool edge> struct DDAG;
00025   //-------------------------------------------------------------------------------
00026   //!  First specialization of the DDAG class
00027   /*!
00028     This is the more complex case where both nodes and edges have to be computed
00029   */
00030   //-------------------------------------------------------------------------------
00031   template<> struct DDAG<true,true>
00032   //-------------------------------------------------------------------------------
00033   {
00034   protected:
00035     DDAG_impl<true,true> * ddag;
00036   public:
00037     DDAG(const char * file)
00038     {
00039       ddag = new DDAG_impl<true,true>(file);
00040     }
00041     ~DDAG()
00042     {
00043       delete ddag;
00044     }
00045     
00046     static bool const nod = true;
00047     static bool const edg = true;
00048 
00049     //-------------------------------------------------------------------------------
00050     //! get the pointer to the DDAG_impl
00051     /*!
00052       \return the pointer to the DDAG_impl
00053     */
00054     //-------------------------------------------------------------------------------
00055     DDAG_impl<true,true> * getDDAG_impl(){return ddag;}
00056     //-------------------------------------------------------------------------------
00057   };
00058   //-------------------------------------------------------------------------------
00059   //!  Second specialization of the DDAG class
00060   /*!
00061     Computations on edges only
00062   */
00063   //-------------------------------------------------------------------------------
00064   template<> struct DDAG<false,true>
00065   //-------------------------------------------------------------------------------
00066   {
00067   protected:
00068     DDAG_impl<false,true> * ddag;
00069   public:
00070     DDAG(const char * file)
00071     {
00072       ddag = new DDAG_impl<false,true>(file);
00073     }
00074     ~DDAG()
00075     {
00076       delete ddag;
00077     }
00078     
00079     static bool const nod = false;
00080     static bool const edg = true;
00081 
00082     DDAG_impl<false,true> * getDDAG_impl(){return ddag;}
00083   };
00084   //-------------------------------------------------------------------------------
00085   //!  Third specialization of the DDAG class
00086   /*!
00087     Computations on nodes only
00088   */
00089   //-------------------------------------------------------------------------------
00090   template<> struct DDAG<true,false>
00091   //-------------------------------------------------------------------------------
00092   {
00093   protected:
00094     DDAG_impl<true,false> * ddag;
00095   public:
00096     DDAG(const char * file)
00097     {
00098       ddag = new DDAG_impl<true,false>(file);
00099     }
00100     ~DDAG()
00101     {
00102       delete ddag;
00103     }
00104 
00105     static bool const nod = true;
00106     static bool const edg = false;
00107 
00108     DDAG_impl<true,false> * getDDAG_impl(){return ddag;}
00109   };
00110   //-------------------------------------------------------------------------------
00111 };
00112 
00113 #endif
 All Classes Files Functions Variables Defines