DGtal 0.3.0

SpaceND.h

Go to the documentation of this file.
00001 
00017 #pragma once
00018 
00033 #if defined(SpaceND_RECURSES)
00034 #error Recursive header files inclusion detected in SpaceND.h
00035 #else // defined(SpaceND_RECURSES)
00036 
00037 #define SpaceND_RECURSES
00038 
00039 #if !defined SpaceND_h
00040 
00041 #define SpaceND_h
00042 
00044 // Inclusions
00045 #include <iostream>
00046 #include "DGtal/base/Common.h"
00047 #include "DGtal/kernel/CInteger.h"
00048 #include "DGtal/kernel/CUnsignedInteger.h"
00049 #include "DGtal/kernel/CSignedInteger.h"
00050 #include "DGtal/kernel/PointVector.h"
00052 
00053 namespace DGtal
00054 {
00055 
00057   // class SpaceND
00094   template < Dimension dim,
00095              typename TInteger = DGtal::int32_t >
00096   class SpaceND
00097   {
00098     //Integer must be a model of the concept CInteger.
00099     BOOST_CONCEPT_ASSERT(( CInteger<TInteger> ) );
00100  
00101    //Integer must be signed to characterize a ring.
00102     BOOST_CONCEPT_ASSERT(( CSignedInteger<TInteger> ) );
00103 
00104   public:
00106     typedef TInteger Integer;
00108     typedef typename IntegerTraits<Integer>::UnsignedVersion UnsignedInteger;
00109     
00111     typedef UnsignedInteger Size;
00112     
00113     
00115     typedef PointVector<dim,Integer> Point;
00116 
00118     typedef PointVector<dim,Integer> Vector;
00119 
00121     typedef SpaceND<dim, Integer> Space;
00122 
00124     typedef DGtal::Dimension Dimension;
00125     
00127     static const Dimension dimension = dim;
00128 
00130     template <Dimension codimension>
00131     struct Subcospace
00132     {
00133       typedef SpaceND < dim - codimension, Integer > Type;
00134     };
00135    
00137     template <Dimension subdimension>
00138     struct Subspace
00139     {
00140       typedef SpaceND<subdimension, Integer> Type;
00141     };
00142 
00145     typedef typename boost::array<double,dim> RealPoint;
00146 
00147     // ----------------------- Standard services ------------------------------
00148   public:
00149 
00154     SpaceND() {};
00155 
00159     ~SpaceND() {};
00160 
00164     template <Dimension subdimension>
00165     static
00166     typename Subspace<subdimension>::Type subspace()
00167     {
00168       ASSERT( subdimension <= dim );
00169       return SpaceND<subdimension, Integer>();
00170     }
00171 
00172 
00176     template <Dimension codimension>
00177     static
00178     typename Subcospace<codimension>::Type subcospace()
00179     {
00180       ASSERT( codimension <= dim );
00181       return SpaceND < dim - codimension, Integer > ();
00182     }
00183 
00184 
00185     // ----------------------- Interface --------------------------------------
00186   public:
00187 
00192     static void selfDisplay( std::ostream & out )
00193     {
00194       out << "[SpaceND dim=" << dimension << " size of Integers=" << sizeof( Integer ) << " ]";
00195     }
00196 
00197   private:
00204     SpaceND & operator=( const SpaceND & other );
00205 
00206     // ------------------------- Internals ------------------------------------
00207   private:
00208 
00209   }; // end of class SpaceND
00210 
00211 
00218   template <Dimension dim, typename Integer>
00219   static std::ostream&
00220   operator<<( std::ostream & out, const SpaceND<dim, Integer> & object )
00221   {
00222     object.selfDisplay( out );
00223     return out;
00224   }
00225 
00226 
00227 } // namespace DGtal
00228 
00229 
00230 //                                                                           //
00232 
00233 #endif // !defined SpaceND_h
00234 
00235 #undef SpaceND_RECURSES
00236 #endif // else defined(SpaceND_RECURSES)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines