Web Analytics Made Easy - Statcounter
Skip to content

Class SBCContainerList#

template <class ValueType, class LinkType>

ClassList > SBCContainerList

This template class describes an encapsulated doubly-linked list. More...

  • #include <SBCContainerList.hpp>

Classes#

Type Name
class const_iterator
class const_reverse_iterator
class iterator
class reverse_iterator

Public Functions#

Type Name
SBCContainerList ()
Constructs an empty list.
SBCContainerList (const SBCContainerList & list)
Copy constructor.
SBCContainerList (SBCContainerList && list)
Move constructor.
iterator begin ()
Returns an iterator that points to the beginning of the list.
const_iterator begin () const
Returns an iterator that points to the beginning of the list.
void clear ()
Clears the list.
void deleteLinkFromList (LinkType * link)
Deletes the link link from the list.
bool empty () const
Returns true if and only if the list is empty.
iterator end ()
Returns an iterator that points to the end of the list.
const_iterator end () const
Returns an iterator that points to the end of the list.
LinkType * getBeginLink ()
Returns a pointer to the first link in the list.
LinkType const * getBeginLink () const
Returns a pointer to the first link in the list.
LinkType * getEndLink ()
Returns a pointer to the last link in the list.
LinkType const * getEndLink () const
Returns a pointer to the last link in the list.
unsigned int getMemoryFootprint () const
Returns the memory footprint of the list.
bool hasLink (LinkType * link) const
Returns true if and only if the list contains the link link .
SBCContainerList & operator= (const SBCContainerList & list)
Copy assignment.
SBCContainerList & operator= (SBCContainerList && list)
Move assignment.
void pop_back ()
Removes the last element of the list.
void pop_front ()
Removes the first element of the list.
void push_back (const ValueType & t)
Adds t at the end of the list.
void push_front (const ValueType & t)
Adds t at the beginning of the list.
reverse_iterator rbegin ()
Returns a reverse iterator that points to the beginning of the reverse list.
const_reverse_iterator rbegin () const
Returns a reverse iterator that points to the beginning of the reverse list.
reverse_iterator rend ()
Returns a reverse iterator that points to the beginning of the reverse list.
const_reverse_iterator rend () const
Returns a reverse iterator that points to the beginning of the reverse list.
unsigned int size () const
Returns the size of the list.
virtual ~SBCContainerList ()
Destructs the list.

Protected Attributes#

Type Name
LinkType * beginLink
LinkType * endLink

Detailed Description#

Template parameters:

  • ValueType The type of values contained in the list
  • LinkType The type of links contained in the list

This template class describes an encapsulated doubly-linked list:

SBList<SBAtom*> l;

// add atoms to the front of the list

for (unsigned int i = 0; i<10; i++)
    l.push_front(new SBAtom(SBElement::Carbon));

// print atoms positions (version 1)

for (SBList<SBAtom*>::iterator i = l.begin(); i != l.end(); i++)
    (*i)->getPosition().print();

// print atoms positions (version 2)

SB_FOR(SBAtom* atom, l)
    atom->getPosition().print();

Short name: SBList

See also: SBCContainerListLink, SB_FOR

Public Functions Documentation#

function SBCContainerList [1/3]#

Constructs an empty list.

inline SBCContainerList::SBCContainerList () 


function SBCContainerList [2/3]#

Copy constructor.

inline SBCContainerList::SBCContainerList (
    const SBCContainerList & list
) 


function SBCContainerList [3/3]#

Move constructor.

inline SBCContainerList::SBCContainerList (
    SBCContainerList && list
) 


function begin [1/2]#

Returns an iterator that points to the beginning of the list.

inline iterator SBCContainerList::begin () 


function begin [2/2]#

Returns an iterator that points to the beginning of the list.

inline const_iterator SBCContainerList::begin () const


function clear#

Clears the list.

inline void SBCContainerList::clear () 


function deleteLinkFromList#

Deletes the link link from the list.

inline void SBCContainerList::deleteLinkFromList (
    LinkType * link
) 


function empty#

Returns true if and only if the list is empty.

inline bool SBCContainerList::empty () const


function end [1/2]#

Returns an iterator that points to the end of the list.

inline iterator SBCContainerList::end () 


function end [2/2]#

Returns an iterator that points to the end of the list.

inline const_iterator SBCContainerList::end () const


Returns a pointer to the first link in the list.

inline LinkType * SBCContainerList::getBeginLink () 


Returns a pointer to the first link in the list.

inline LinkType const * SBCContainerList::getBeginLink () const


Returns a pointer to the last link in the list.

inline LinkType * SBCContainerList::getEndLink () 


Returns a pointer to the last link in the list.

inline LinkType const * SBCContainerList::getEndLink () const


function getMemoryFootprint#

Returns the memory footprint of the list.

inline unsigned int SBCContainerList::getMemoryFootprint () const


Returns true if and only if the list contains the link link .

inline bool SBCContainerList::hasLink (
    LinkType * link
) const


function operator=#

Copy assignment.

inline SBCContainerList & SBCContainerList::operator= (
    const SBCContainerList & list
) 


function operator=#

Move assignment.

inline SBCContainerList & SBCContainerList::operator= (
    SBCContainerList && list
) 


function pop_back#

Removes the last element of the list.

inline void SBCContainerList::pop_back () 


function pop_front#

Removes the first element of the list.

inline void SBCContainerList::pop_front () 


function push_back#

Adds t at the end of the list.

inline void SBCContainerList::push_back (
    const ValueType & t
) 


function push_front#

Adds t at the beginning of the list.

inline void SBCContainerList::push_front (
    const ValueType & t
) 


function rbegin [1/2]#

Returns a reverse iterator that points to the beginning of the reverse list.

inline reverse_iterator SBCContainerList::rbegin () 


function rbegin [2/2]#

Returns a reverse iterator that points to the beginning of the reverse list.

inline const_reverse_iterator SBCContainerList::rbegin () const


function rend [1/2]#

Returns a reverse iterator that points to the beginning of the reverse list.

inline reverse_iterator SBCContainerList::rend () 


function rend [2/2]#

Returns a reverse iterator that points to the beginning of the reverse list.

inline const_reverse_iterator SBCContainerList::rend () const


function size#

Returns the size of the list.

inline unsigned int SBCContainerList::size () const

This operation is linear in the number of elements in the list


function ~SBCContainerList#

Destructs the list.

inline virtual SBCContainerList::~SBCContainerList () 


Protected Attributes Documentation#

LinkType* beginLink;

LinkType* endLink;