Workspace 6.21.5
Public Types | Public Member Functions | List of all members
Attached< T > Class Template Reference

Defines a class for handling attached objects (nodes, elements, etc.).

#include <Mesh/DataStructures/attached.h>

Inheritance diagram for Attached< T >:
[legend]

Public Types

using const_iterator = typename container_type::const_iterator
 
using const_reference = typename container_type::const_reference
 
using const_reverse_iterator = typename container_type::const_reverse_iterator
 
typedef std::vector< T * > container_type
 
using iterator = typename container_type::iterator
 
using reference = typename container_type::reference
 
using reverse_iterator = typename container_type::reverse_iterator
 
using size_type = typename container_type::size_type
 
using value_type = typename container_type::value_type
 

Public Member Functions

void addAttached (T &obj)
 
reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
reference front ()
 
const_reference front () const
 
iterator insert (iterator iter, T *t)
 
bool isAttachedTo (T &obj) const
 
size_type max_size () const
 
T * operator[] (int i)
 
const T * operator[] (int i) const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
void removeAttached (const T &obj)
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
void replaceAttached (T &oldObj, T &newObj)
 
size_type size () const
 
void swap (Attached< T > &a)
 
void swap (container_type &a)
 

Member Typedef Documentation

◆ 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

typedef std::vector<T*> container_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

Member Function Documentation

◆ addAttached()

void addAttached ( T &  obj)
inline
Parameters
objThe object to be added to the attached objects list.

If obj is already in the list, the function returns without error. If insufficient memory is currently available in the attached objects list, a new bigger list will be allocated, the old list copied into it and obj added. Hence, this function may invalidate any existing iterators on the attached object list.

This function also prevents anything attaching to itself, if that is possible for the object types involved.

◆ 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

◆ clear()

void clear ( )
inline

◆ empty()

bool empty ( ) const
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

◆ insert()

iterator insert ( iterator  iter,
T *  t 
)
inline

◆ isAttachedTo()

bool isAttachedTo ( T &  obj) const
inline

◆ max_size()

size_type max_size ( ) const
inline

◆ operator[]() [1/2]

T * operator[] ( int  i)
inline

◆ operator[]() [2/2]

const T * operator[] ( int  i) const
inline

◆ rbegin() [1/2]

reverse_iterator rbegin ( )
inline

◆ rbegin() [2/2]

const_reverse_iterator rbegin ( ) const
inline

◆ removeAttached()

void removeAttached ( const T &  obj)
inline
Parameters
objThe object to be removed from the attached objects list.

If obj is not in the attached object list, the function will return without error. If it is in the list, it will be removed. No memory will be deallocated. This is because other objects may later be added to this attachment list, and memory has already been allocated. Therefore, there is little point in reallocating a smaller list, copying the list across and then deleting the old list. This just wastes compute time. Note, however, that because objects can be moved around in the list, all iterators into the attachment list should be considered to have been invalidated by this call.

◆ rend() [1/2]

reverse_iterator rend ( )
inline

◆ rend() [2/2]

const_reverse_iterator rend ( ) const
inline

◆ replaceAttached()

void replaceAttached ( T &  oldObj,
T &  newObj 
)
inline
Parameters
oldObjThe object to be replaced in the attached objects list.
newObjThe object to substitute for oldObj in the attached objects list.

If oldObj is not in the attached object list, the function will return without error and newObj will not be included in the attached object list. If oldObj is in the list, it is replaced by newObj.

◆ size()

size_type size ( ) const
inline

◆ swap() [1/2]

void swap ( Attached< T > &  a)
inline

◆ swap() [2/2]

void swap ( container_type a)
inline