DGtal  1.2.0
Public Types | Public Member Functions | Static Public Attributes | Private Attributes
DGtal::ImageContainerBySTLMap< TDomain, TValue > Class Template Reference

#include <DGtal/images/ImageContainerBySTLMap.h>

Inheritance diagram for DGtal::ImageContainerBySTLMap< TDomain, TValue >:
[legend]

Public Types

typedef ImageContainerBySTLMap< TDomain, TValue > Self
 
typedef std::map< typename TDomain::Point, TValue > Parent
 
typedef Parent Container
 
typedef TDomain Domain
 
typedef Domain::Point Point
 
typedef Domain::Vector Vector
 
typedef Domain::Integer Integer
 
typedef Domain::Size Size
 
typedef Domain::Dimension Dimension
 
typedef Point Vertex
 
typedef CowPtr< const DomainDomainPtr
 
typedef TValue Value
 
typedef DefaultConstImageRange< SelfConstRange
 
typedef DefaultImageRange< SelfRange
 
typedef SetValueIterator< SelfOutputIterator
 output iterator More...
 
typedef std::map< Point, Value >::iterator Iterator
 built-in iterators More...
 
typedef std::map< Point, Value >::const_iterator ConstIterator
 
typedef std::map< Point, Value >::reverse_iterator ReverseIterator
 
typedef std::map< Point, Value >::const_reverse_iterator ConstReverseIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CDomain< TDomain >))
 domain More...
 
 BOOST_CONCEPT_ASSERT ((concepts::CLabel< TValue >))
 range of values More...
 
 ImageContainerBySTLMap (Clone< const Domain > aDomain, const Value &aValue=0)
 
 ImageContainerBySTLMap (const ImageContainerBySTLMap &other)
 
ImageContainerBySTLMapoperator= (const ImageContainerBySTLMap &other)
 
 ~ImageContainerBySTLMap ()
 
Value operator() (const Point &aPoint) const
 
void setValue (const Point &aPoint, const Value &aValue)
 
const Domaindomain () const
 
ConstRange constRange () const
 
Range range ()
 
const Containercontainer () const
 
Containercontainer ()
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 
OutputIterator outputIterator ()
 

Static Public Attributes

static const Domain::Dimension dimension
 static constants More...
 

Private Attributes

DomainPtr myDomainPtr
 
Value myDefaultValue
 Default value. More...
 

Detailed Description

template<typename TDomain, typename TValue>
class DGtal::ImageContainerBySTLMap< TDomain, TValue >

Description of class 'ImageContainerBySTLMap'

Aim: Model of CImage implementing the association Point<->Value using an STL map.

Once constructed, the image is valid, i.e. every point of the image domain has a value, which can be read and overwritten. Note that the default value (returned for points that are not stored in the underlying STL map) can be chosen by the user.

As a model of concepts::CImage, this class provides two ways of accessing values:

This class also provides a setValue() method and an output iterator, which is returned by the outputIterator() method for writting purposes.

See also
testImage.cpp

Definition at line 96 of file ImageContainerBySTLMap.h.

Member Typedef Documentation

◆ ConstIterator

template<typename TDomain , typename TValue >
typedef std::map<Point,Value>::const_iterator DGtal::ImageContainerBySTLMap< TDomain, TValue >::ConstIterator

Definition at line 251 of file ImageContainerBySTLMap.h.

◆ ConstRange

template<typename TDomain , typename TValue >
typedef DefaultConstImageRange<Self> DGtal::ImageContainerBySTLMap< TDomain, TValue >::ConstRange

Definition at line 125 of file ImageContainerBySTLMap.h.

◆ ConstReverseIterator

template<typename TDomain , typename TValue >
typedef std::map<Point,Value>::const_reverse_iterator DGtal::ImageContainerBySTLMap< TDomain, TValue >::ConstReverseIterator

Definition at line 253 of file ImageContainerBySTLMap.h.

◆ Container

template<typename TDomain , typename TValue >
typedef Parent DGtal::ImageContainerBySTLMap< TDomain, TValue >::Container

Definition at line 104 of file ImageContainerBySTLMap.h.

◆ Dimension

template<typename TDomain , typename TValue >
typedef Domain::Dimension DGtal::ImageContainerBySTLMap< TDomain, TValue >::Dimension

Definition at line 113 of file ImageContainerBySTLMap.h.

◆ Domain

template<typename TDomain , typename TValue >
typedef TDomain DGtal::ImageContainerBySTLMap< TDomain, TValue >::Domain

Definition at line 108 of file ImageContainerBySTLMap.h.

◆ DomainPtr

template<typename TDomain , typename TValue >
typedef CowPtr< const Domain > DGtal::ImageContainerBySTLMap< TDomain, TValue >::DomainPtr

Definition at line 117 of file ImageContainerBySTLMap.h.

◆ Integer

template<typename TDomain , typename TValue >
typedef Domain::Integer DGtal::ImageContainerBySTLMap< TDomain, TValue >::Integer

Definition at line 111 of file ImageContainerBySTLMap.h.

◆ Iterator

template<typename TDomain , typename TValue >
typedef std::map<Point,Value>::iterator DGtal::ImageContainerBySTLMap< TDomain, TValue >::Iterator

built-in iterators

Definition at line 250 of file ImageContainerBySTLMap.h.

◆ OutputIterator

template<typename TDomain , typename TValue >
typedef SetValueIterator<Self> DGtal::ImageContainerBySTLMap< TDomain, TValue >::OutputIterator

output iterator

Definition at line 129 of file ImageContainerBySTLMap.h.

◆ Parent

template<typename TDomain , typename TValue >
typedef std::map<typename TDomain::Point, TValue > DGtal::ImageContainerBySTLMap< TDomain, TValue >::Parent

Definition at line 103 of file ImageContainerBySTLMap.h.

◆ Point

template<typename TDomain , typename TValue >
typedef Domain::Point DGtal::ImageContainerBySTLMap< TDomain, TValue >::Point

Definition at line 109 of file ImageContainerBySTLMap.h.

◆ Range

template<typename TDomain , typename TValue >
typedef DefaultImageRange<Self> DGtal::ImageContainerBySTLMap< TDomain, TValue >::Range

Definition at line 126 of file ImageContainerBySTLMap.h.

◆ ReverseIterator

template<typename TDomain , typename TValue >
typedef std::map<Point,Value>::reverse_iterator DGtal::ImageContainerBySTLMap< TDomain, TValue >::ReverseIterator

Definition at line 252 of file ImageContainerBySTLMap.h.

◆ Self

template<typename TDomain , typename TValue >
typedef ImageContainerBySTLMap<TDomain,TValue> DGtal::ImageContainerBySTLMap< TDomain, TValue >::Self

Definition at line 102 of file ImageContainerBySTLMap.h.

◆ Size

template<typename TDomain , typename TValue >
typedef Domain::Size DGtal::ImageContainerBySTLMap< TDomain, TValue >::Size

Definition at line 112 of file ImageContainerBySTLMap.h.

◆ Value

template<typename TDomain , typename TValue >
typedef TValue DGtal::ImageContainerBySTLMap< TDomain, TValue >::Value

Definition at line 124 of file ImageContainerBySTLMap.h.

◆ Vector

template<typename TDomain , typename TValue >
typedef Domain::Vector DGtal::ImageContainerBySTLMap< TDomain, TValue >::Vector

Definition at line 110 of file ImageContainerBySTLMap.h.

◆ Vertex

template<typename TDomain , typename TValue >
typedef Point DGtal::ImageContainerBySTLMap< TDomain, TValue >::Vertex

Definition at line 114 of file ImageContainerBySTLMap.h.

Constructor & Destructor Documentation

◆ ImageContainerBySTLMap() [1/2]

template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::ImageContainerBySTLMap ( Clone< const Domain aDomain,
const Value aValue = 0 
)

Constructor from a pointer to a domain.

If Domain is a heavy type, consider giving instead a smart pointer on the domain (like CountedPtr).

Parameters
aDomainthe image domain.
aValuea default value associated to the domain points that are not contained in the underlying map.

◆ ImageContainerBySTLMap() [2/2]

template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::ImageContainerBySTLMap ( const ImageContainerBySTLMap< TDomain, TValue > &  other)

Copy operator

Parameters
otherthe object to copy.

◆ ~ImageContainerBySTLMap()

template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::~ImageContainerBySTLMap ( )

Destructor.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT() [1/2]

template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< TDomain >)  )

domain

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CLabel< TValue >)  )

range of values

◆ className()

template<typename TDomain , typename TValue >
std::string DGtal::ImageContainerBySTLMap< TDomain, TValue >::className ( ) const
Returns
the style name used for drawing this object.

◆ constRange()

template<typename TDomain , typename TValue >
ConstRange DGtal::ImageContainerBySTLMap< TDomain, TValue >::constRange ( ) const
Returns
the const range providing constant iterators to iterate over the values of the image.

◆ container() [1/2]

template<typename TDomain , typename TValue >
Container& DGtal::ImageContainerBySTLMap< TDomain, TValue >::container ( )
inline

Give access to the underlying container.

Returns
a (might be const) reference to the container.

Definition at line 229 of file ImageContainerBySTLMap.h.

229 { return static_cast<Parent>(*this); };
std::map< typename TDomain::Point, TValue > Parent

◆ container() [2/2]

template<typename TDomain , typename TValue >
const Container& DGtal::ImageContainerBySTLMap< TDomain, TValue >::container ( ) const
inline

Give access to the underlying container.

Returns
a (might be const) reference to the container.

Definition at line 224 of file ImageContainerBySTLMap.h.

224 { return static_cast<Parent>(*this); };

◆ domain()

template<typename TDomain , typename TValue >
const Domain& DGtal::ImageContainerBySTLMap< TDomain, TValue >::domain ( ) const
Returns
the domain associated to the image.

◆ isValid()

template<typename TDomain , typename TValue >
bool DGtal::ImageContainerBySTLMap< TDomain, TValue >::isValid ( ) const
Returns
the validity of the Image

◆ operator()()

template<typename TDomain , typename TValue >
Value DGtal::ImageContainerBySTLMap< TDomain, TValue >::operator() ( const Point aPoint) const

Get the value of an image at a given position given by a Point.

Precondition
the point must be in the domain
Parameters
aPointthe point.
Returns
the value at aPoint.

◆ operator=()

template<typename TDomain , typename TValue >
ImageContainerBySTLMap& DGtal::ImageContainerBySTLMap< TDomain, TValue >::operator= ( const ImageContainerBySTLMap< TDomain, TValue > &  other)

Assignement operator

Parameters
otherthe object to copy.
Returns
this

◆ outputIterator()

template<typename TDomain , typename TValue >
OutputIterator DGtal::ImageContainerBySTLMap< TDomain, TValue >::outputIterator ( )

Construct a Iterator on the image

Returns
a Iterator

◆ range()

template<typename TDomain , typename TValue >
Range DGtal::ImageContainerBySTLMap< TDomain, TValue >::range ( )
Returns
the range providing constant iterators and output iterators on the values of the image.

◆ selfDisplay()

template<typename TDomain , typename TValue >
void DGtal::ImageContainerBySTLMap< TDomain, TValue >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ setValue()

template<typename TDomain , typename TValue >
void DGtal::ImageContainerBySTLMap< TDomain, TValue >::setValue ( const Point aPoint,
const Value aValue 
)

Set a value on an Image at a position specified by a Point.

Precondition
it must be a point in the image domain.
Parameters
aPointthe point.
aValuethe value.

Field Documentation

◆ dimension

template<typename TDomain , typename TValue >
const Domain::Dimension DGtal::ImageContainerBySTLMap< TDomain, TValue >::dimension
static

static constants

Definition at line 120 of file ImageContainerBySTLMap.h.

◆ myDefaultValue

template<typename TDomain , typename TValue >
Value DGtal::ImageContainerBySTLMap< TDomain, TValue >::myDefaultValue
private

Default value.

Definition at line 140 of file ImageContainerBySTLMap.h.

◆ myDomainPtr

template<typename TDomain , typename TValue >
DomainPtr DGtal::ImageContainerBySTLMap< TDomain, TValue >::myDomainPtr
private

Shared pointer on the image domain, Since the domain is not mutable, not assignable, it is shared by all the copies of *this

Definition at line 137 of file ImageContainerBySTLMap.h.


The documentation for this class was generated from the following file: