ug4
ug::AttachedElementList< TAttachmentPipe > Class Template Reference

A linked list of elements living in an attachment. More...

#include <attached_list.h>

Classes

struct  Entry
 

Public Types

typedef AttachmentAccessor< element, AEntry, ElemHandlerAAEntry
 
typedef Attachment< EntryAEntry
 
typedef ConstAttachedElementListIterator< AAEntryconst_iterator
 
typedef TAttachmentPipe::element element
 
typedef TAttachmentPipe::ElementHandler ElemHandler
 
typedef AttachedElementListIterator< AAEntryiterator
 

Public Member Functions

 AttachedElementList (AEntry aEntry)
 Note that auto-copy on aEntry has to be disabled. More...
 
 AttachedElementList (const AttachedElementList &ael)
 
 AttachedElementList (TAttachmentPipe *pipe, AEntry aEntry)
 Note that auto-copy on aEntry has to be disabled. More...
 
 AttachedElementList (TAttachmentPipe *pipe=NULL)
 
element back ()
 returns the last element in the list More...
 
const element back () const
 returns the last element in the list (const) More...
 
iterator begin ()
 returns an iterator to the beginning of the sequence. More...
 
const_iterator begin () const
 returns an iterator to the beginning of the sequence. More...
 
void clear ()
 clears the list. begin() == end() afterwards. More...
 
bool empty () const
 retunrs true if the list is empty More...
 
iterator end ()
 returns an iterator to the end of the sequence. More...
 
const_iterator end () const
 returns an iterator to the end of the sequence. More...
 
iterator erase (iterator begin, iterator end)
 erases a sequence of entries More...
 
iterator erase (iterator position)
 erases the element at the given position More...
 
element front ()
 returns the first element in the list More...
 
const element front () const
 returns the first element in the list (const) More...
 
iterator get_iterator (const element &elem)
 returns the iterator to the given element More...
 
element const * get_pointer_to_element (const element &elem)
 returns a const pointer to an element. More...
 
iterator insert (iterator position, const element &elem)
 inserts an element right before the specified position. More...
 
bool is_in_list (const element &elem)
 returns true if the element is in the list More...
 
const AttachedElementListoperator= (const AttachedElementList &ael)
 
void push_back (const element &elem)
 pushes an element to the end of the list More...
 
void set_pipe (TAttachmentPipe *pipe)
 set the attachment pipe on which the list shall operate More...
 
void set_pipe (TAttachmentPipe *pipe, AEntry aEntry)
 Sets the pipe and a shared entry-attachment on which the list will operate. More...
 
 ~AttachedElementList ()
 

Private Attributes

AAEntry m_aaEntry
 
AEntry m_aEntry
 
element m_back
 
bool m_bSharedAttachment
 
element m_front
 
TAttachmentPipe * m_pipe
 

Detailed Description

template<class TAttachmentPipe>
class ug::AttachedElementList< TAttachmentPipe >

A linked list of elements living in an attachment.

This is a highly specialized linked list mainly (only!) used in the Grid, SubsetHandler, Selector, ... classes to maintain a list of GridObjects.

Only elements registered at the underlying attachment pipe may be added to the list. Note that each element may only be added once.

Make sure that the attachment pipe on which the list operates exists at least as long as the list itself, or call set_pipe(NULL), if the pipe is erased before.

This list assumes that TAttachmentPipe::element is a pointer type.

Note that instances of this class are never lightweight, since memory for a potentially full list is allocated in the attachment pipe.

If the list operates on a shared attachment, the one who created the attachment is responsible for releasing it.

Warning
Special care has to be taken with this type of list. It is e.g. not possible to insert the same element multiple times into the list. Instead upon new insertion, the old entry will be erased.

Member Typedef Documentation

◆ AAEntry

template<class TAttachmentPipe >
typedef AttachmentAccessor<element, AEntry, ElemHandler> ug::AttachedElementList< TAttachmentPipe >::AAEntry

◆ AEntry

template<class TAttachmentPipe >
typedef Attachment<Entry> ug::AttachedElementList< TAttachmentPipe >::AEntry

◆ const_iterator

template<class TAttachmentPipe >
typedef ConstAttachedElementListIterator<AAEntry> ug::AttachedElementList< TAttachmentPipe >::const_iterator

◆ element

template<class TAttachmentPipe >
typedef TAttachmentPipe::element ug::AttachedElementList< TAttachmentPipe >::element

◆ ElemHandler

template<class TAttachmentPipe >
typedef TAttachmentPipe::ElementHandler ug::AttachedElementList< TAttachmentPipe >::ElemHandler

◆ iterator

template<class TAttachmentPipe >
typedef AttachedElementListIterator<AAEntry> ug::AttachedElementList< TAttachmentPipe >::iterator

Constructor & Destructor Documentation

◆ AttachedElementList() [1/4]

template<class TAttachmentPipe >
ug::AttachedElementList< TAttachmentPipe >::AttachedElementList ( TAttachmentPipe *  pipe = NULL)
inline

◆ AttachedElementList() [2/4]

template<class TAttachmentPipe >
ug::AttachedElementList< TAttachmentPipe >::AttachedElementList ( AEntry  aEntry)
inline

Note that auto-copy on aEntry has to be disabled.

◆ AttachedElementList() [3/4]

template<class TAttachmentPipe >
ug::AttachedElementList< TAttachmentPipe >::AttachedElementList ( TAttachmentPipe *  pipe,
AEntry  aEntry 
)
inline

Note that auto-copy on aEntry has to be disabled.

References ug::AttachedElementList< TAttachmentPipe >::set_pipe().

◆ AttachedElementList() [4/4]

◆ ~AttachedElementList()

template<class TAttachmentPipe >
ug::AttachedElementList< TAttachmentPipe >::~AttachedElementList ( )
inline

Member Function Documentation

◆ back() [1/2]

template<class TAttachmentPipe >
element ug::AttachedElementList< TAttachmentPipe >::back ( )
inline

returns the last element in the list

References ug::AttachedElementList< TAttachmentPipe >::m_back.

◆ back() [2/2]

template<class TAttachmentPipe >
const element ug::AttachedElementList< TAttachmentPipe >::back ( ) const
inline

returns the last element in the list (const)

References ug::AttachedElementList< TAttachmentPipe >::m_back.

◆ begin() [1/2]

template<class TAttachmentPipe >
iterator ug::AttachedElementList< TAttachmentPipe >::begin ( )
inline

◆ begin() [2/2]

template<class TAttachmentPipe >
const_iterator ug::AttachedElementList< TAttachmentPipe >::begin ( ) const
inline

returns an iterator to the beginning of the sequence.

References ug::AttachedElementList< TAttachmentPipe >::m_aaEntry, and ug::AttachedElementList< TAttachmentPipe >::m_front.

◆ clear()

◆ empty()

template<class TAttachmentPipe >
bool ug::AttachedElementList< TAttachmentPipe >::empty ( ) const
inline

◆ end() [1/2]

template<class TAttachmentPipe >
iterator ug::AttachedElementList< TAttachmentPipe >::end ( )
inline

returns an iterator to the end of the sequence.

Note that this is the iterator to the element behind the last one.

References ug::AttachedElementList< TAttachmentPipe >::m_aaEntry.

Referenced by ug::AttachedElementList< TAttachmentPipe >::clear(), and ug::AttachedElementList< TAttachmentPipe >::erase().

◆ end() [2/2]

template<class TAttachmentPipe >
const_iterator ug::AttachedElementList< TAttachmentPipe >::end ( ) const
inline

returns an iterator to the end of the sequence.

Note that this is the iterator to the element behind the last one.

References ug::AttachedElementList< TAttachmentPipe >::m_aaEntry.

◆ erase() [1/2]

template<class TAttachmentPipe >
iterator ug::AttachedElementList< TAttachmentPipe >::erase ( iterator  begin,
iterator  end 
)
inline

◆ erase() [2/2]

◆ front() [1/2]

template<class TAttachmentPipe >
element ug::AttachedElementList< TAttachmentPipe >::front ( )
inline

returns the first element in the list

References ug::AttachedElementList< TAttachmentPipe >::m_front.

◆ front() [2/2]

template<class TAttachmentPipe >
const element ug::AttachedElementList< TAttachmentPipe >::front ( ) const
inline

returns the first element in the list (const)

References ug::AttachedElementList< TAttachmentPipe >::m_front.

◆ get_iterator()

template<class TAttachmentPipe >
iterator ug::AttachedElementList< TAttachmentPipe >::get_iterator ( const element elem)
inline

returns the iterator to the given element

Note that the return value is undefined if element is not a member of the list!

References ug::AttachedElementList< TAttachmentPipe >::m_aaEntry.

Referenced by ug::AttachedElementList< TAttachmentPipe >::insert().

◆ get_pointer_to_element()

template<class TAttachmentPipe >
element const* ug::AttachedElementList< TAttachmentPipe >::get_pointer_to_element ( const element elem)
inline

returns a const pointer to an element.

This pointer is valid until the content of the list is changed.

References ug::AttachedElementList< TAttachmentPipe >::m_aaEntry, and ug::AttachedElementList< TAttachmentPipe >::m_front.

◆ insert()

◆ is_in_list()

template<class TAttachmentPipe >
bool ug::AttachedElementList< TAttachmentPipe >::is_in_list ( const element elem)
inline

◆ operator=()

◆ push_back()

◆ set_pipe() [1/2]

◆ set_pipe() [2/2]

Member Data Documentation

◆ m_aaEntry

◆ m_aEntry

◆ m_back

◆ m_bSharedAttachment

◆ m_front

◆ m_pipe


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