FUObjectContainer< ObjectClass > Class Template Reference
[Utility Classes.]

A contained object list. More...

#include <FUObject.h>

Inheritance diagram for FUObjectContainer< ObjectClass >:

fm::pvector< ObjectClass > FUObjectOwner List of all members.

Public Types

typedef ObjectClass ** iterator
 Defines the item pointer iterator for the pointer array.
typedef const ObjectClass ** const_iterator
 Defines the constant-version of the item pointer iterator for the pointer array.

Public Member Functions

virtual ~FUObjectContainer ()
 Destructor.
void clear ()
 Clears and releases the object tracked by this object list.
size_t size () const
 Retrieves the number of elements in the container.
bool empty () const
 Retrieves whether there are values in this container.
ObjectClass *& front ()
 Retrieves the first element of the container.
const ObjectClass *& front () const
 See above.
ObjectClass *& back ()
 Retrieves the last element of the container.
const ObjectClass *& back () const
 See above.
ObjectClass * at (size_t index)
 Retrieves an indexed object in the list.
const ObjectClass * at (size_t index) const
 See above.
template<class INTEGER>
ObjectClass * operator[] (INTEGER index)
 See above.
template<class INTEGER>
const ObjectClass * operator[] (INTEGER index) const
 See above.
iterator begin ()
 Retrieves an iterator for the first element in the list.
const_iterator begin () const
 See above.
iterator end ()
 Retrieves an iterator for the element after the last element in the list.
const_iterator end () const
 See above.
iterator find (const ObjectClass *item)
 Retrieves an iterator for a given element in the list.
const_iterator find (const ObjectClass *item) const
 See above.
void push_back (ObjectClass *object)
 Adds an object to the container's containment list.
iterator insert (iterator _iterator, ObjectClass *object)
 Inserts an object in the container's containment list.
void insert (size_t index, ObjectClass *object)
 Inserts an object in the container's containment list.
template<class _It>
void insert (iterator _where, _It _startIterator, _It _endIterator)
 Inserts a list of object in the container's containment list.
void pop_back ()
 Removes the last value of the tracked object list.
void pop_front ()
 Removes the first value of the object container.
iterator erase (iterator _it)
 Removes the value at the given position within the list.
void erase (iterator first, iterator last)
 Removes a range of values from the list.
void erase (size_t first, size_t last)
 Removes a range of values from the list.
bool erase (const ObjectClass *value)
 Removes a value contained within the list, once.
iterator Detach (iterator _it)
 Detaches the value at the given position from the list.
void Detach (iterator first, iterator last)
 Detaches a range of values from the list.
void Detach (size_t first, size_t last)
 Detaches a range of values from the list.
bool Detach (const ObjectClass *value)
 Detaches a given value from the list.
void erase (size_t index)
 Removes an indexed value contained within the list.
void reserve (size_t count)
 Pre-caches the wanted number of pointers.
bool contains (const ObjectClass *value) const
 Retrieves whether this container owns a given object.
 DEPRECATED (3.05A,"FUObject::Release()") bool release(const ObjectClass *value)
 Releases a value contained within a list.
ObjectClass * Add ()
 Adds a new empty object to the container.
template<class A1>
ObjectClass * Add (const A1 &arg1)
 Adds a new object to the container.
template<class A1, class A2>
ObjectClass * Add (const A1 &arg1, const A2 &arg2)
 Adds a new object to the container.
template<class A1, class A2, class A3>
ObjectClass * Add (const A1 &arg1, const A2 &arg2, const A3 &arg3)
 Adds a new object to the container.

Protected Member Functions

virtual void OnOwnedObjectReleased (FUObject *object)
 Removes an object from the container's owned list.

Detailed Description

template<typename ObjectClass = FUObject>
class FUObjectContainer< ObjectClass >

A contained object list.

When this list is released, the contained objects are also released. Each object should have only one owner.


Constructor & Destructor Documentation

template<typename ObjectClass = FUObject>
virtual FUObjectContainer< ObjectClass >::~FUObjectContainer  )  [inline, virtual]
 

Destructor.

Releases all the objects contained within this container.


Member Function Documentation

template<typename ObjectClass = FUObject>
template<class A1, class A2, class A3>
ObjectClass* FUObjectContainer< ObjectClass >::Add const A1 &  arg1,
const A2 &  arg2,
const A3 &  arg3
[inline]
 

Adds a new object to the container.

Parameters:
arg1 A first constructor argument.
arg2 A second constructor argument.
arg3 A third constructor argument.
Returns:
The new object.

template<typename ObjectClass = FUObject>
template<class A1, class A2>
ObjectClass* FUObjectContainer< ObjectClass >::Add const A1 &  arg1,
const A2 &  arg2
[inline]
 

Adds a new object to the container.

Parameters:
arg1 A first constructor argument.
arg2 A second constructor argument.
Returns:
The new object.

template<typename ObjectClass = FUObject>
template<class A1>
ObjectClass* FUObjectContainer< ObjectClass >::Add const A1 &  arg1  )  [inline]
 

Adds a new object to the container.

Parameters:
arg1 An constructor argument.
Returns:
The new object.

template<typename ObjectClass = FUObject>
ObjectClass* FUObjectContainer< ObjectClass >::Add  )  [inline]
 

Adds a new empty object to the container.

Returns:
The new empty object.

template<typename ObjectClass = FUObject>
ObjectClass* FUObjectContainer< ObjectClass >::at size_t  index  )  [inline]
 

Retrieves an indexed object in the list.

Parameters:
index An index.
Returns:
The given object.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
ObjectClass*& FUObjectContainer< ObjectClass >::back  )  [inline]
 

Retrieves the last element of the container.

Returns:
The last element in the container.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
iterator FUObjectContainer< ObjectClass >::begin  )  [inline]
 

Retrieves an iterator for the first element in the list.

Returns:
an iterator for the first element in the list.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
bool FUObjectContainer< ObjectClass >::contains const ObjectClass *  value  )  const [inline]
 

Retrieves whether this container owns a given object.

Parameters:
value An object.
Returns:
Whether the object is owned by this container.

template<typename ObjectClass = FUObject>
FUObjectContainer< ObjectClass >::DEPRECATED 3.  05A,
"FUObject::Release()" 
const [inline]
 

Releases a value contained within a list.

Use this function only if there is no duplicate pointers within the list.

Deprecated:
Use FUObject::Release instead.
Parameters:
value The value, contained within the list, to release.
Returns:
Whether the value was found and released.

template<typename ObjectClass = FUObject>
bool FUObjectContainer< ObjectClass >::Detach const ObjectClass *  value  )  [inline]
 

Detaches a given value from the list.

The object is not released, so after this call: it has no owner and must be released manually.

Parameters:
value The value, contained within the list, to detach from it.
Returns:
Whether the value was found and detached from the list.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::Detach size_t  first,
size_t  last
[inline]
 

Detaches a range of values from the list.

The objects are not released, so after this call: they have no owner and must be released manually.

Parameters:
first The index of the first value to remove.
last The index just passed the last value to remove.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::Detach iterator  first,
iterator  last
[inline]
 

Detaches a range of values from the list.

The objects are not released, so after this call: they have no owner and must be released manually.

Parameters:
first The list position of the first value to remove.
last The list position just passed the last value to remove.

template<typename ObjectClass = FUObject>
iterator FUObjectContainer< ObjectClass >::Detach iterator  _it  )  [inline]
 

Detaches the value at the given position from the list.

The object is not released, so after this call: it has no owner and must be released manually.

Parameters:
_it The list position for the value to remove.

template<typename ObjectClass = FUObject>
bool FUObjectContainer< ObjectClass >::empty  )  const [inline]
 

Retrieves whether there are values in this container.

Returns:
Whether there are values in the container.

Reimplemented from fm::vector< const void *, true >.

template<typename ObjectClass = FUObject>
iterator FUObjectContainer< ObjectClass >::end  )  [inline]
 

Retrieves an iterator for the element after the last element in the list.

Returns:
an iterator for the element after the last element in the list.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::erase size_t  index  )  [inline]
 

Removes an indexed value contained within the list.

Parameters:
index The index of the value to erase.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
bool FUObjectContainer< ObjectClass >::erase const ObjectClass *  value  )  [inline]
 

Removes a value contained within the list, once.

Parameters:
value The value, contained within the list, to erase from it.
Returns:
Whether the value was found and erased from the list.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::erase size_t  first,
size_t  last
[inline]
 

Removes a range of values from the list.

Parameters:
first The index of the first value to remove.
last The index just passed the last value to remove.

Reimplemented from fm::vector< const void *, true >.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::erase iterator  first,
iterator  last
[inline]
 

Removes a range of values from the list.

Parameters:
first The list position of the first value to remove.
last The list position just passed the last value to remove.

template<typename ObjectClass = FUObject>
iterator FUObjectContainer< ObjectClass >::erase iterator  _it  )  [inline]
 

Removes the value at the given position within the list.

Parameters:
_it The list position for the value to remove.

template<typename ObjectClass = FUObject>
iterator FUObjectContainer< ObjectClass >::find const ObjectClass *  item  )  [inline]
 

Retrieves an iterator for a given element in the list.

Parameters:
item An item of the list.
Returns:
An iterator for the given item. If the item is not found in the list, the end() iterator is returned.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
ObjectClass*& FUObjectContainer< ObjectClass >::front  )  [inline]
 

Retrieves the first element of the container.

Returns:
The first element in the container.

Reimplemented from fm::pvector< ObjectClass >.

template<typename ObjectClass = FUObject>
template<class _It>
void FUObjectContainer< ObjectClass >::insert iterator  _where,
_It  _startIterator,
_It  _endIterator
[inline]
 

Inserts a list of object in the container's containment list.

Parameters:
_where The iterator after which to insert the object.
_startIterator The iterator for the first object to insert.
_endIterator The iterator just passed the last object. This object will not be inserted.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::insert size_t  index,
ObjectClass *  object
[inline]
 

Inserts an object in the container's containment list.

Parameters:
index Where to insert the object.
object An object to insert.

template<typename ObjectClass = FUObject>
iterator FUObjectContainer< ObjectClass >::insert iterator  _iterator,
ObjectClass *  object
[inline]
 

Inserts an object in the container's containment list.

Parameters:
_iterator The iterator after which to insert the object.
object An object to insert.
Returns:
The iterator to the inserted object.

template<typename ObjectClass = FUObject>
virtual void FUObjectContainer< ObjectClass >::OnOwnedObjectReleased FUObject object  )  [inline, protected, virtual]
 

Removes an object from the container's owned list.

Parameters:
object A contained object.

Implements FUObjectOwner.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::pop_front  )  [inline]
 

Removes the first value of the object container.

Warning: this function may result in large memory copies, since we use an array to contain objects.

Reimplemented from fm::vector< const void *, true >.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::push_back ObjectClass *  object  )  [inline]
 

Adds an object to the container's containment list.

Parameters:
object An object to contain.

template<typename ObjectClass = FUObject>
void FUObjectContainer< ObjectClass >::reserve size_t  count  )  [inline]
 

Pre-caches the wanted number of pointers.

Use this function to avoid many memory re-allocations.

Parameters:
count The wanted number of pre-cached pointers.

Reimplemented from fm::vector< const void *, true >.

template<typename ObjectClass = FUObject>
size_t FUObjectContainer< ObjectClass >::size  )  const [inline]
 

Retrieves the number of elements in the container.

Returns:
The number of elements in the container.

Reimplemented from fm::vector< const void *, true >.


The documentation for this class was generated from the following file:
Generated on Thu Feb 14 16:58:41 2008 for FCollada by  doxygen 1.4.6-NO