Class SBCContainerList#
template <class ValueType, class LinkType>
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 listLinkType
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.
function SBCContainerList [2/3]#
Copy constructor.
function SBCContainerList [3/3]#
Move constructor.
function begin [1/2]#
Returns an iterator that points to the beginning of the list.
function begin [2/2]#
Returns an iterator that points to the beginning of the list.
function clear#
Clears the list.
function deleteLinkFromList#
Deletes the link link
from the list.
function empty#
Returns true if and only if the list is empty.
function end [1/2]#
Returns an iterator that points to the end of the list.
function end [2/2]#
Returns an iterator that points to the end of the list.
function getBeginLink [1/2]#
Returns a pointer to the first link in the list.
function getBeginLink [2/2]#
Returns a pointer to the first link in the list.
function getEndLink [1/2]#
Returns a pointer to the last link in the list.
function getEndLink [2/2]#
Returns a pointer to the last link in the list.
function getMemoryFootprint#
Returns the memory footprint of the list.
function hasLink#
Returns true if and only if the list contains the link link
.
function operator=#
Copy assignment.
function operator=#
Move assignment.
function pop_back#
Removes the last element of the list.
function pop_front#
Removes the first element of the list.
function push_back#
Adds t
at the end of the list.
function push_front#
Adds t
at the beginning of the list.
function rbegin [1/2]#
Returns a reverse iterator that points to the beginning of the reverse list.
function rbegin [2/2]#
Returns a reverse iterator that points to the beginning of the reverse list.
function rend [1/2]#
Returns a reverse iterator that points to the beginning of the reverse list.
function rend [2/2]#
Returns a reverse iterator that points to the beginning of the reverse list.
function size#
Returns the size of the list.
This operation is linear in the number of elements in the list
function ~SBCContainerList#
Destructs the list.