DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Private Attributes
DGtal::ImageContainerBySTLMap< TDomain, TValue > Class Template Reference

#include <ImageContainerBySTLMap.h>

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

Public Types

typedef ImageContainerBySTLMap
< TDomain, TValue > 
Self
typedef std::map< typename
TDomain::Point, TValue > 
Parent
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 CountedPtr< const DomainDomainPtr
typedef TValue Value
typedef DefaultConstImageRange
< Self
ConstRange
typedef DefaultImageRange< SelfRange
typedef SetValueIterator< SelfOutputIterator
typedef map< Point, Value >
::iterator 
Iterator
typedef map< Point, Value >
::const_iterator 
ConstIterator
typedef map< Point, Value >
::reverse_iterator 
ReverseIterator
typedef map< Point, Value >
::const_reverse_iterator 
ConstReverseIterator

Public Member Functions

 BOOST_CONCEPT_ASSERT ((CDomain< TDomain >))
 BOOST_CONCEPT_ASSERT ((CLabel< TValue >))
 ImageContainerBySTLMap (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 ()
void selfDisplay (std::ostream &out) const
bool isValid () const
std::string className () const
OutputIterator outputIterator ()

Static Public Attributes

static const Domain::Dimension dimension = Domain::dimension

Private Attributes

DomainPtr myDomainPtr
Value myDefaultValue

Additional Inherited Members

- Data Fields inherited from std::map< K, T >
keys
elements

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 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 95 of file ImageContainerBySTLMap.h.


Member Typedef Documentation

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

Definition at line 237 of file ImageContainerBySTLMap.h.

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

Definition at line 124 of file ImageContainerBySTLMap.h.

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

Definition at line 239 of file ImageContainerBySTLMap.h.

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

Definition at line 111 of file ImageContainerBySTLMap.h.

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

Definition at line 106 of file ImageContainerBySTLMap.h.

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

Definition at line 114 of file ImageContainerBySTLMap.h.

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

Definition at line 109 of file ImageContainerBySTLMap.h.

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

built-in iterators

Definition at line 236 of file ImageContainerBySTLMap.h.

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

output iterator

Definition at line 128 of file ImageContainerBySTLMap.h.

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

Definition at line 102 of file ImageContainerBySTLMap.h.

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

Definition at line 107 of file ImageContainerBySTLMap.h.

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

Definition at line 125 of file ImageContainerBySTLMap.h.

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

Definition at line 238 of file ImageContainerBySTLMap.h.

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

Definition at line 101 of file ImageContainerBySTLMap.h.

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

Definition at line 110 of file ImageContainerBySTLMap.h.

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

Definition at line 121 of file ImageContainerBySTLMap.h.

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

Definition at line 108 of file ImageContainerBySTLMap.h.

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

Definition at line 112 of file ImageContainerBySTLMap.h.


Constructor & Destructor Documentation

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

Constructor from a Domain

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

Definition at line 45 of file ImageContainerBySTLMap.ih.

: myDomainPtr( new Domain(aDomain) ), myDefaultValue( aValue )
{
}
template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::ImageContainerBySTLMap ( const ImageContainerBySTLMap< TDomain, TValue > &  other)
inline

Copy operator

Parameters:
otherthe object to copy.

Definition at line 54 of file ImageContainerBySTLMap.ih.

: Parent(other),
myDomainPtr(other.myDomainPtr), myDefaultValue(other.myDefaultValue)
{
}
template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::~ImageContainerBySTLMap ( )
inline

Destructor.

Definition at line 77 of file ImageContainerBySTLMap.ih.

{
}

Member Function Documentation

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

domain

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

range of values

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

Definition at line 167 of file ImageContainerBySTLMap.ih.

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

Definition at line 121 of file ImageContainerBySTLMap.ih.

{
return ConstRange( *this );
}
template<typename TDomain , typename TValue >
const DGtal::ImageContainerBySTLMap< TDomain, TValue >::Domain & DGtal::ImageContainerBySTLMap< TDomain, TValue >::domain ( ) const
inline
Returns:
the domain associated to the image.

Definition at line 112 of file ImageContainerBySTLMap.ih.

{
return *myDomainPtr;
}
template<typename TDomain , typename TValue >
bool DGtal::ImageContainerBySTLMap< TDomain, TValue >::isValid ( ) const
inline
Returns:
the validity of the Image

Definition at line 148 of file ImageContainerBySTLMap.ih.

{
return (this != NULL);
}
template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::Value DGtal::ImageContainerBySTLMap< TDomain, TValue >::operator() ( const Point aPoint) const
inline

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.

Definition at line 85 of file ImageContainerBySTLMap.ih.

{
ASSERT( this->domain().isInside( aPoint ) );
ConstIterator it = this->find( aPoint );
if ( it == this->end() )
else
return it->second;
}
template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue > & DGtal::ImageContainerBySTLMap< TDomain, TValue >::operator= ( const ImageContainerBySTLMap< TDomain, TValue > &  other)
inline

Assignement operator

Parameters:
otherthe object to copy.
Returns:
this

Definition at line 64 of file ImageContainerBySTLMap.ih.

References DGtal::ImageContainerBySTLMap< TDomain, TValue >::myDefaultValue, and DGtal::ImageContainerBySTLMap< TDomain, TValue >::myDomainPtr.

{
if (this != &other)
{
myDomainPtr = other.myDomainPtr;
myDefaultValue = other.myDefaultValue;
}
return *this;
}
template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::OutputIterator DGtal::ImageContainerBySTLMap< TDomain, TValue >::outputIterator ( )
inline

Construct a Iterator on the image at a position specified by aPoint

Parameters:
aPointa point to construct a Iterator on.
Returns:
a Iterator on aPoint

Definition at line 138 of file ImageContainerBySTLMap.ih.

{
return OutputIterator( *this );
}
template<typename TDomain , typename TValue >
DGtal::ImageContainerBySTLMap< TDomain, TValue >::Range DGtal::ImageContainerBySTLMap< TDomain, TValue >::range ( )
inline
Returns:
the range providing constant iterators and output iterators on the values of the image.

Definition at line 130 of file ImageContainerBySTLMap.ih.

{
return Range( *this );
}
template<typename TDomain , typename TValue >
void DGtal::ImageContainerBySTLMap< TDomain, TValue >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 157 of file ImageContainerBySTLMap.ih.

{
out << "[Image - STLMap] size=" << this->size() << " valuetype="
<< sizeof(TValue) << "bytes Domain=" << *myDomainPtr;
}
template<typename TDomain , typename TValue >
void DGtal::ImageContainerBySTLMap< TDomain, TValue >::setValue ( const Point aPoint,
const Value aValue 
)
inline

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.

Definition at line 99 of file ImageContainerBySTLMap.ih.

{
ASSERT( this->domain().isInside( aPoint ) );
std::pair<typename std::map<Point,Value>::iterator, bool>
res = this->insert( std::pair<Point,Value>(aPoint, aValue) );
if (res.second == false)
res.first->second = aValue;
}

Field Documentation

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

static constants

Definition at line 117 of file ImageContainerBySTLMap.h.

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

Default value.

Definition at line 139 of file ImageContainerBySTLMap.h.

Referenced by DGtal::ImageContainerBySTLMap< TDomain, TValue >::operator=().

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

Counted 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 136 of file ImageContainerBySTLMap.h.

Referenced by DGtal::ImageContainerBySTLMap< TDomain, TValue >::operator=().


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