DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes
DGtal::FrontInsertionSequenceToStackAdapter< TSequence > Class Template Reference

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

#include <DGtal/base/FrontInsertionSequenceToStackAdapter.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::FrontInsertionSequence< Container >))
 
 FrontInsertionSequenceToStackAdapter (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::FrontInsertionSequenceToStackAdapter< TSequence >

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

Template Parameters
TSequencea model of boost::FrontInsertionSequence

Definition at line 62 of file FrontInsertionSequenceToStackAdapter.h.

Member Typedef Documentation

◆ Container

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

Type of the underlying container

Definition at line 71 of file FrontInsertionSequenceToStackAdapter.h.

◆ Size

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

Type used to represent the size of the container

Definition at line 91 of file FrontInsertionSequenceToStackAdapter.h.

◆ size_type

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

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

Definition at line 87 of file FrontInsertionSequenceToStackAdapter.h.

◆ Value

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

Type of elements

Definition at line 82 of file FrontInsertionSequenceToStackAdapter.h.

◆ value_type

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

STL-like type of elements

Definition at line 78 of file FrontInsertionSequenceToStackAdapter.h.

Constructor & Destructor Documentation

◆ FrontInsertionSequenceToStackAdapter()

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

Constructor.

Parameters
aContainera container to adapt

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TSequence >
DGtal::FrontInsertionSequenceToStackAdapter< TSequence >::BOOST_CONCEPT_ASSERT ( (boost::FrontInsertionSequence< Container >)  )

◆ empty()

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

Tests whether the container is empty or not.

Returns
'true' if empty, 'false' otherwise

◆ isValid()

template<typename TSequence >
bool DGtal::FrontInsertionSequenceToStackAdapter< 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::FrontInsertionSequenceToStackAdapter< TSequence >::pop ( )

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

◆ push()

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

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

Parameters
aValueany value

◆ selfDisplay()

template<typename TSequence >
void DGtal::FrontInsertionSequenceToStackAdapter< 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::FrontInsertionSequenceToStackAdapter< 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::FrontInsertionSequenceToStackAdapter< TSequence >::top ( )

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

Returns
reference to the top element of the stack

◆ top() [2/2]

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

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

Returns
reference to the top element of the stack

Field Documentation

◆ myContainerPtr

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

Pointer to the underlying container

Definition at line 167 of file FrontInsertionSequenceToStackAdapter.h.


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