DGtal  1.5.beta
DGtal::BackInsertionSequenceToStackAdapter< TSequence > Class Template Reference

Aim: This class implements a dynamic adapter to an instance of a model of back insertion sequence in order to get a stack interface. This class is a model of CStack. More...

#include <DGtal/base/BackInsertionSequenceToStackAdapter.h>

Public Types

typedef TSequence Container
 
typedef Container::value_type value_type
 
typedef Container::value_type Value
 
typedef Container::size_type size_type
 
typedef Container::size_type Size
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((boost::BackInsertionSequence< Container >))
 
 BackInsertionSequenceToStackAdapter (Alias< Container > aContainer)
 
Size size () const
 
bool empty () const
 
Valuetop ()
 
const Valuetop () const
 
void push (const Value &aValue)
 
void pop ()
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Private Attributes

ContainermyContainerPtr
 

Detailed Description

template<typename TSequence>
class DGtal::BackInsertionSequenceToStackAdapter< TSequence >

Aim: This class implements a dynamic adapter to an instance of a model of back insertion sequence in order to get a stack interface. This class is a model of CStack.

Template Parameters
TSequencea model of boost::BackInsertionSequence

Definition at line 62 of file BackInsertionSequenceToStackAdapter.h.

Member Typedef Documentation

◆ Container

template<typename TSequence >
typedef TSequence DGtal::BackInsertionSequenceToStackAdapter< TSequence >::Container

Type of the underlying container

Definition at line 71 of file BackInsertionSequenceToStackAdapter.h.

◆ Size

template<typename TSequence >
typedef Container::size_type DGtal::BackInsertionSequenceToStackAdapter< TSequence >::Size

Type used to represent the size of the container

Definition at line 90 of file BackInsertionSequenceToStackAdapter.h.

◆ size_type

template<typename TSequence >
typedef Container::size_type DGtal::BackInsertionSequenceToStackAdapter< TSequence >::size_type

STL-like type used to represent the size of the container

Definition at line 86 of file BackInsertionSequenceToStackAdapter.h.

◆ Value

template<typename TSequence >
typedef Container::value_type DGtal::BackInsertionSequenceToStackAdapter< TSequence >::Value

Type of elements

Definition at line 81 of file BackInsertionSequenceToStackAdapter.h.

◆ value_type

template<typename TSequence >
typedef Container::value_type DGtal::BackInsertionSequenceToStackAdapter< TSequence >::value_type

STL-like type of elements

Definition at line 77 of file BackInsertionSequenceToStackAdapter.h.

Constructor & Destructor Documentation

◆ BackInsertionSequenceToStackAdapter()

template<typename TSequence >
DGtal::BackInsertionSequenceToStackAdapter< TSequence >::BackInsertionSequenceToStackAdapter ( Alias< Container aContainer)

Constructor.

Parameters
aContainera container to adapt

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TSequence >
DGtal::BackInsertionSequenceToStackAdapter< TSequence >::BOOST_CONCEPT_ASSERT ( (boost::BackInsertionSequence< Container >)  )

◆ empty()

template<typename TSequence >
bool DGtal::BackInsertionSequenceToStackAdapter< TSequence >::empty ( ) const

Tests whether the container is empty or not.

Returns
'true' if empty, 'false' otherwise

◆ isValid()

template<typename TSequence >
bool DGtal::BackInsertionSequenceToStackAdapter< TSequence >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ pop()

template<typename TSequence >
void DGtal::BackInsertionSequenceToStackAdapter< TSequence >::pop ( )

Removes the element on top of the stack. This method calls method pop_back of the underlying container.

◆ push()

template<typename TSequence >
void DGtal::BackInsertionSequenceToStackAdapter< TSequence >::push ( const Value aValue)

Inserts an element above the current top element. This method calls method push_back of the underlying container.

Parameters
aValueany value

◆ selfDisplay()

template<typename TSequence >
void DGtal::BackInsertionSequenceToStackAdapter< TSequence >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ size()

template<typename TSequence >
Size DGtal::BackInsertionSequenceToStackAdapter< TSequence >::size ( ) const

Returns the size of the container.

Returns
the size, ie. the number of elements.

◆ top() [1/2]

template<typename TSequence >
Value& DGtal::BackInsertionSequenceToStackAdapter< TSequence >::top ( )

Access to the top element, ie. the element available at the back of the underlying container. This method indeed calls method back of the underlying container.

Returns
reference to the top element of the stack

◆ top() [2/2]

template<typename TSequence >
const Value& DGtal::BackInsertionSequenceToStackAdapter< TSequence >::top ( ) const

Access to the top element, ie. the element available at the back of the underlying container. This method indeed calls method back of the underlying container.

Returns
reference to the top element of the stack

Field Documentation

◆ myContainerPtr

template<typename TSequence >
Container* DGtal::BackInsertionSequenceToStackAdapter< TSequence >::myContainerPtr
private

Pointer to the underlying container

Definition at line 166 of file BackInsertionSequenceToStackAdapter.h.


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