OSB_LIB::AssociateList Class Reference

Collaboration diagram for OSB_LIB::AssociateList:

Collaboration graph
[legend]
List of all members.

Detailed Description

Manager of Associates.

Definition at line 68 of file anclist.h.

Public Types

STL container type definitions

Public Member Functions

Pure wrappers to the STL container
Remarks:
Do not add an STL operation to this group if the function does more than just wrapping!
All functions return the STL operation on list_.

Private Attributes


Member Typedef Documentation

typedef std::auto_ptr<Associate> OSB_LIB::AssociateList::AssociateAutoPtr

Auto pointer of Associate.

Remarks:
Derived classes should redefine AutoPtr as an auto_ptr of their own type. For more detail see Customer of clone().

Definition at line 77 of file anclist.h.

typedef List::const_iterator OSB_LIB::AssociateList::ConstIterator

STL const_iterator.

Definition at line 90 of file anclist.h.

typedef List::iterator OSB_LIB::AssociateList::Iterator

STL iterator.

Definition at line 88 of file anclist.h.

typedef List::key_type OSB_LIB::AssociateList::KeyType

STL container key_type.

Definition at line 94 of file anclist.h.

typedef std::map<Id<Associate>, Associate*> OSB_LIB::AssociateList::List

STL container for associates.

Note:
Because of the polymophism we have to use pointers.

Definition at line 86 of file anclist.h.

typedef List::size_type OSB_LIB::AssociateList::SizeType

STL container size_type.

Definition at line 92 of file anclist.h.


Constructor & Destructor Documentation

OSB_LIB::AssociateList::AssociateList (  )  [inline]

Empty constructor.

Definition at line 98 of file anclist.h.

OSB_LIB::AssociateList::AssociateList ( const AssociateList rhs  ) 

Copy constructor.

Creates (allocates) a copy for each associate in the STL container.

OSB_LIB::AssociateList::~AssociateList (  ) 

Delete all stored objects.


Member Function Documentation

ConstIterator OSB_LIB::AssociateList::begin (  )  const [inline]

Const iterator to the beginning of the list.

Definition at line 129 of file anclist.h.

References list_.

Iterator OSB_LIB::AssociateList::begin (  )  [inline]

Iterator to the beginning of the list.

Definition at line 123 of file anclist.h.

References list_.

void OSB_LIB::AssociateList::clear (  ) 

Clear the list.

Destructs each item in the list and afterwards calls clear() of the STL container.

ConstIterator OSB_LIB::AssociateList::end (  )  const [inline]

Const iterator to the end of the list.

Definition at line 131 of file anclist.h.

References list_.

Iterator OSB_LIB::AssociateList::end (  )  [inline]

Iterator to the end of the list.

Definition at line 125 of file anclist.h.

References list_.

void OSB_LIB::AssociateList::erase ( const KeyType k  ) 

Erase an associate whose key is k.

Delete an associate from the list and calls its destructor.

Parameters:
k Key to erase: the id of the associate.

void OSB_LIB::AssociateList::erase ( Iterator  pos  ) 

Erase an associate pointed to by pos.

Delete an associate from the list and calls its destructor.

Parameters:
pos iterator to the associate to delete.

ConstIterator OSB_LIB::AssociateList::find ( const KeyType k  )  const [inline]

Finds an element whose key is k.

Definition at line 133 of file anclist.h.

References list_.

Iterator OSB_LIB::AssociateList::find ( const KeyType k  )  [inline]

Finds an element whose key is k.

Definition at line 127 of file anclist.h.

References list_.

const Associate* OSB_LIB::AssociateList::findAssociate ( const Id< Associate > &  asId  )  const

Find an associate by its object id.

Parameters:
asId Oid of the associate.
Returns:
Pointer to the found associate,
0 if associate can not be found.

Associate* OSB_LIB::AssociateList::findAssociate ( const Id< Associate > &  asId  ) 

Find an associate by its object id.

Parameters:
asId Oid of the associate.
Returns:
Pointer to the found associate,
0 if associate can not be found.

Associate& OSB_LIB::AssociateList::getAssociate ( const Id< Associate > &  asId  ) 

Get an associate by its object id.

Parameters:
asId Oid of the associate.
Returns:
Reference to the found associate.
Exceptions:
OsbException 
  • if associate is not found.

const Associate& OSB_LIB::AssociateList::getAssociate ( const Id< Associate > &  asId  )  const

Get an associate by its object id.

Parameters:
asId Oid of the associate.
Returns:
Reference to the found associate.
Exceptions:
OsbException if the associate is not found.

Associate* OSB_LIB::AssociateList::insert ( AssociateAutoPtr  ap  ) 

Add a new associate or replace an existing one.

Parameters:
ap Auto pointer with the associate to add.
Returns:
Pointer to the inserted associate.
Adds an associate to the list, an existing entry is overwritten.

The function takes the ownership of the argument pointer, it is typically called like this:

          AssociateList list;
          Associate::AutoPtr a = createAssociate(...);
          // work with a
          list.insert(a);

Associate* OSB_LIB::AssociateList::insert ( const Associate assoc  ) 

Add a new associate or replace an existing one.

Parameters:
assoc Associate to add.
Returns:
Pointer to the inserted associate.
Adds an associate to the list, an existing entry is overwritten.

The function uses ass.clone() to create a copy of the associate.

Remarks:
Overload this function as needed. If a pointer is passed as function argument make it VERY CLEAR whether or not the function takes ownership of the pointer.

const List& OSB_LIB::AssociateList::list (  )  const [inline]

Access to the list of associates.

Definition at line 205 of file anclist.h.

References list_.

AssociateList& OSB_LIB::AssociateList::operator= ( const AssociateList rhs  ) 

Exception save assignment operator.

SizeType OSB_LIB::AssociateList::size (  )  const [inline]

The size of the list.

Definition at line 136 of file anclist.h.

References list_.

void OSB_LIB::AssociateList::swap ( AssociateList rhs  ) 

Swap the content of two lists.


Member Data Documentation

List OSB_LIB::AssociateList::list_ [private]

The STL container with the associates.

Definition at line 246 of file anclist.h.

Referenced by begin(), end(), find(), list(), and size().


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:10:38 2006 for OSB Library by  doxygen 1.4.7