grid_space.hxx

Go to the documentation of this file.
00001 #pragma once
00002 #ifndef OPENGM_GRID_DISCRETE_SPACE_HXX
00003 #define OPENGM_GRID_DISCRETE_SPACE_HXX
00004 
00006 
00007 #include "opengm/opengm.hxx"
00008 #include "opengm/graphicalmodel/space/space_base.hxx"
00009 
00010 namespace opengm {
00011 
00015 template<class I = std::size_t , class L = std::size_t >
00016 class GridSpace :public SpaceBase<GridSpace<I,L>,I,L>{
00017 public:
00018    typedef I IndexType;
00019    typedef L LabelType;
00020 
00021    GridSpace();
00022    GridSpace(const IndexType,const IndexType, const LabelType);
00023    void assign(const IndexType ,const IndexType, const LabelType);
00024    IndexType numberOfVariables() const;
00025    IndexType dimX() const;
00026    IndexType dimY() const;
00027    LabelType numberOfLabels()const;
00028    LabelType numberOfLabels(const IndexType) const;
00029    LabelType numberOfLabels(const IndexType,const IndexType) const;
00030    bool isSimpleSpace() const;
00031 private:
00032    IndexType dimX_;
00033    IndexType dimY_;
00034    LabelType numberOfStates_;
00035 };
00036 
00037 template<class I, class L>
00038 inline
00039 GridSpace<I, L>::GridSpace()
00040 :  dimX_(),
00041    dimY_(),
00042    numberOfStates_()
00043 {}
00044 
00045 template<class I, class L>
00046 inline
00047 GridSpace<I, L>::GridSpace
00048 (
00049    const typename GridSpace<I, L>::IndexType dimX,
00050    const typename GridSpace<I, L>::IndexType dimY,
00051    const typename GridSpace<I, L>::LabelType numberOfLabels
00052 )
00053 :  dimX_(dimX),
00054    dimY_(dimY),
00055    numberOfStates_(numberOfLabels)
00056 {}
00057 
00058 template<class I, class L>
00059 inline void
00060 GridSpace<I, L>::assign
00061 (
00062    const typename GridSpace<I, L>::IndexType dimX,
00063    const typename GridSpace<I, L>::IndexType dimY,
00064    const typename GridSpace<I, L>::LabelType numberOfLabels
00065 ) {
00066    numberOfStates_ = numberOfLabels;
00067    dimX_ = dimX;
00068    dimY_ = dimY;
00069 }
00070 
00071 template<class I, class L>
00072 inline typename GridSpace<I, L>::IndexType
00073 GridSpace<I, L>::numberOfVariables() const{
00074    return dimX_*dimY_;
00075 }
00076 
00077 template<class I, class L>
00078 inline typename GridSpace<I, L>::IndexType
00079 GridSpace<I, L>::dimX() const{
00080    return dimX_;
00081 }
00082 
00083 template<class I, class L>
00084 inline typename GridSpace<I, L>::IndexType
00085 GridSpace<I, L>::dimY() const{
00086    return dimY_;
00087 }
00088 
00089 template<class I, class L>
00090 inline typename GridSpace<I, L>::LabelType
00091 GridSpace<I, L>::numberOfLabels() const{
00092    return numberOfStates_;
00093 }
00094 
00095 template<class I, class L>
00096 inline typename GridSpace<I, L>::LabelType
00097 GridSpace<I, L>::numberOfLabels
00098 (
00099    const typename GridSpace<I, L>::IndexType dimension
00100 ) const{
00101    return numberOfStates_;
00102 }
00103 
00104 template<class I, class L>
00105 inline bool
00106 GridSpace<I, L>::isSimpleSpace() const{
00107    return true;
00108 }
00109 
00110 } // namespace opengm
00111 
00113 
00114 #endif // #ifndef OPENGM_GRID_DISCRETE_SPACE_HXX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Jun 17 16:31:03 2013 for OpenGM by  doxygen 1.6.3