Workspace 6.21.5
Classes | Public Types | Public Member Functions | List of all members
NumberedObjectList< T > Class Template Referenceabstract

Defines a list of numbered objects and is generally used as a base class. More...

#include <Mesh/DataStructures/numberedobjectlist.h>

Inheritance diagram for NumberedObjectList< T >:
[legend]

Classes

class  IndexChangeRecipient
 

Public Types

typedef T BaseItemType
 Allow the object type to be queried by other templates.
 

Public Member Functions

 NumberedObjectList ()
 Create an empty list with the largest ID set to zero.
 
virtual ~NumberedObjectList ()=0
 
T & add (T &obj)
 
void addIndexChangeRecipient (IndexChangeRecipient &observer)
 
void clearList ()
 
size_type computeValidObjectsCount () const
 
void emptyTrash ()
 
void emptyTrash (iterator startFrom)
 
long getLargestID () const
 
void killBack ()
 
void killList ()
 
void reindex (iterator beginIter, iterator endIter, long start=0)
 
void reindex (long start=0)
 
void remove (T &obj)
 This only marks obj for removal. It is not actually removed until EmptyTrash is called.
 
void removeFromList (iterator objIter)
 
void removeIndexChangeRecipient (IndexChangeRecipient &observer)
 
void renumber (long start=1, long incr=1)
 
void setLargestIDToAtLeast (long ID)
 
void updateLargestID ()
 
Deprecated functions

These functions have been renamed to conform to the coding standard. The only change is that their new names have the first letter changed to lowercase.

T & Add (T &obj)
 
void Remove (T &obj)
 
void RemoveFromList (iterator objIter)
 
void ClearList ()
 
void KillBack ()
 
void EmptyTrash ()
 
void EmptyTrash (iterator startFrom)
 
void KillList ()
 
long GetLargestID () const
 
void UpdateLargestID ()
 
void SetLargestIDToAtLeast (long ID)
 
void Renumber (long start=1, long incr=1)
 
void Reindex (long start=0)
 
void Reindex (iterator beginIter, iterator endIter, long start=0)
 

Standard STL container functionality

using container_type = std::list< T * >
 STL container typedef.
 
using value_type = typename container_type::value_type
 STL container typedef.
 
using size_type = typename container_type::size_type
 STL container typedef.
 
using difference_type = typename container_type::difference_type
 STL container typedef.
 
using reference = typename container_type::reference
 STL container typedef.
 
using const_reference = typename container_type::const_reference
 STL container typedef.
 
using iterator = typename container_type::iterator
 STL container typedef.
 
using const_iterator = typename container_type::const_iterator
 STL container typedef.
 
using reverse_iterator = typename container_type::reverse_iterator
 STL container typedef.
 
using const_reverse_iterator = typename container_type::const_reverse_iterator
 STL container typedef.
 
iterator begin ()
 STL container function.
 
const_iterator begin () const
 STL container function.
 
iterator end ()
 STL container function.
 
const_iterator end () const
 STL container function.
 
reverse_iterator rbegin ()
 STL container function.
 
const_reverse_iterator rbegin () const
 STL container function.
 
reverse_iterator rend ()
 STL container function.
 
const_reverse_iterator rend () const
 STL container function.
 
reference front ()
 STL container function.
 
const_reference front () const
 STL container function.
 
reference back ()
 STL container function.
 
const_reference back () const
 STL container function.
 
bool empty () const
 STL container function.
 
size_type size () const
 STL container function.
 
size_type max_size () const
 STL container function.
 

Detailed Description

template<typename T>
class CSIRO::Mesh::NumberedObjectList< T >

The template parameter T must be derived from NumberedObject. The list will store pointers to objects of type T, not the objects themselves. Their lifetime is managed by this class, so clients should never need to delete the objects directly.

Member Typedef Documentation

◆ BaseItemType

typedef T BaseItemType

◆ const_iterator

using const_iterator = typename container_type::const_iterator

◆ const_reference

using const_reference = typename container_type::const_reference

◆ const_reverse_iterator

using const_reverse_iterator = typename container_type::const_reverse_iterator

◆ container_type

using container_type = std::list<T*>

◆ difference_type

using difference_type = typename container_type::difference_type

◆ iterator

using iterator = typename container_type::iterator

◆ reference

using reference = typename container_type::reference

◆ reverse_iterator

using reverse_iterator = typename container_type::reverse_iterator

◆ size_type

using size_type = typename container_type::size_type

◆ value_type

using value_type = typename container_type::value_type

Constructor & Destructor Documentation

◆ NumberedObjectList()

NumberedObjectList ( )
inline

◆ ~NumberedObjectList()

~NumberedObjectList
inlinepure virtual

Derived classes must supply a destructor which calls killList().

Member Function Documentation

◆ add()

T & add ( T &  obj)
inline
Parameters
objAn existing object to add to the list directly

This function is meant for adding an existing object to the end of the object list. All other Add... style of functions in derived classes must eventually call this one.

◆ Add()

T & Add ( T &  obj)
inline

◆ addIndexChangeRecipient()

void addIndexChangeRecipient ( IndexChangeRecipient observer)

◆ back() [1/2]

reference back ( )
inline

◆ back() [2/2]

const_reference back ( ) const
inline

◆ begin() [1/2]

iterator begin ( )
inline

◆ begin() [2/2]

const_iterator begin ( ) const
inline

◆ clearList()

void clearList ( )
inline
Note
This doesn't delete objects!

◆ ClearList()

void ClearList ( )
inline

◆ computeValidObjectsCount()

NumberedObjectList< T >::size_type computeValidObjectsCount
Returns
The number of objects in the list that are valid (i.e. not marked invalid)

◆ empty()

bool empty ( ) const
inline

◆ emptyTrash() [1/2]

void emptyTrash
inline

Delete all objects in the list that are marked ready for deletion. All objects will be reindexed as part of this operation.

◆ EmptyTrash() [1/2]

void EmptyTrash ( )
inline

◆ emptyTrash() [2/2]

void emptyTrash ( iterator  startFrom)
inline

◆ EmptyTrash() [2/2]

void EmptyTrash ( iterator  startFrom)
inline

◆ end() [1/2]

iterator end ( )
inline

◆ end() [2/2]

const_iterator end ( ) const
inline

◆ front() [1/2]

reference front ( )
inline

◆ front() [2/2]

const_reference front ( ) const
inline

◆ getLargestID()

long getLargestID ( ) const
inline
Returns
The largest ID of any node added to the list. It does not catch situations where the ID of an object is changed after the object is added.

◆ GetLargestID()

long GetLargestID ( ) const
inline

◆ killBack()

void killBack
inline

Delete the very last object in the list of objects, or do nothing if the list is empty. This function is useful for undoing the last addition to the list.

◆ KillBack()

void KillBack ( )
inline

◆ killList()

void killList
inline

Delete every object in the list of objects.

◆ KillList()

void KillList ( )
inline

◆ max_size()

size_type max_size ( ) const
inline

◆ rbegin() [1/2]

reverse_iterator rbegin ( )
inline

◆ rbegin() [2/2]

const_reverse_iterator rbegin ( ) const
inline

◆ reindex() [1/2]

void reindex ( iterator  beginIter,
iterator  endIter,
long  start = 0 
)
inline

Re-index the objects in the range beginIter to endIter, with index numbers starting at start.

◆ Reindex() [1/2]

void Reindex ( iterator  beginIter,
iterator  endIter,
long  start = 0 
)
inline

◆ reindex() [2/2]

void reindex ( long  start = 0)
inline

Re-index all the objects. The first object should have an index of start and subsequent objects have incremented indexes from there.

◆ Reindex() [2/2]

void Reindex ( long  start = 0)
inline

◆ remove()

void remove ( T &  obj)
inline

◆ Remove()

void Remove ( T &  obj)
inline

◆ removeFromList()

void removeFromList ( iterator  objIter)
inline

Calling this function corrupts the object indexes. You are allowed to do this, but you then take on responsibility for ensuring nothing that relies on the object indexes is called thereafter. You can reset the indexes to the correct values by calling reindex(), after which the assumed index ordering is restored.

◆ RemoveFromList()

void RemoveFromList ( iterator  objIter)
inline

◆ removeIndexChangeRecipient()

void removeIndexChangeRecipient ( IndexChangeRecipient observer)

◆ rend() [1/2]

reverse_iterator rend ( )
inline

◆ rend() [2/2]

const_reverse_iterator rend ( ) const
inline

◆ renumber()

void renumber ( long  start = 1,
long  incr = 1 
)
inline

Renumber the objects, starting the new numbers at start and incrementing by incr.

◆ Renumber()

void Renumber ( long  start = 1,
long  incr = 1 
)
inline

◆ setLargestIDToAtLeast()

void setLargestIDToAtLeast ( long  ID)
inline

◆ SetLargestIDToAtLeast()

void SetLargestIDToAtLeast ( long  ID)
inline

◆ size()

size_type size ( ) const
inline

◆ updateLargestID()

void updateLargestID
inline

Go through the entire list of objects and find the largest ID. This ID is saved and can be retrieved by calling getLargestID().

◆ UpdateLargestID()

void UpdateLargestID ( )
inline