oos::object_vector_base< S, T, CT > Class Template Referenceabstract

Base class for all object vector classes. More...

#include <object_vector.hpp>

Inherits object_container.

Public Types

typedef T value_holder
 
typedef S parent_type
 
typedef CT item_holder
 
typedef CT::object_type item_type
 
typedef std::vector< item_holdervector_type
 
typedef vector_type::iterator iterator
 
typedef vector_type::const_iterator const_iterator
 
typedef object_container::size_type size_type
 

Public Member Functions

 object_vector_base (parent_type *parent)
 Creates a new object_vector. More...
 
virtual const char * classname () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
virtual bool empty () const
 
virtual void clear ()
 
virtual size_type size () const
 
virtual iterator insert (iterator pos, const value_holder &x)=0
 Inserts a new element. More...
 
void push_back (const value_holder &x)
 
value_holder operator[] (size_type pos)
 
const value_holder operator[] (size_type pos) const
 
value_holder at (size_type pos)
 
const value_holder at (size_type pos) const
 
virtual iterator erase (iterator i)=0
 Interface to erase an element. More...
 
virtual iterator erase (iterator first, iterator last)=0
 Erases a range defines by iterators. More...
 

Protected Member Functions

virtual void for_each (const node_func &nf) const
 Executes the given function object for all elements. More...
 
virtual void uninstall ()
 
virtual void parent (object *p)
 
parent_typeparent ()
 
vector_typevector ()
 
virtual void adjust_index (iterator i)=0
 
void insert_proxy (int index, object_proxy *proxy)
 

Detailed Description

template<class S, class T, class CT = T>
class oos::object_vector_base< S, T, CT >

Base class for all object vector classes.

Template Parameters
SThe type of the parent object.
TThe value of the vector.
CTThe container item type.

The object_vector class implements a vector which can hold any type of object from builtin types as int, float to object_ptr or object_ref elements. The class provides STL like behaviour and the order of the elements is reliable.

Member Typedef Documentation

template<class S, class T, class CT = T>
typedef vector_type::const_iterator oos::object_vector_base< S, T, CT >::const_iterator

Shortcut for the vector const iterator.

template<class S, class T, class CT = T>
typedef CT oos::object_vector_base< S, T, CT >::item_holder

Shortcut for the value holder type.

template<class S, class T, class CT = T>
typedef CT::object_type oos::object_vector_base< S, T, CT >::item_type

Shortcut for the item type.

template<class S, class T, class CT = T>
typedef vector_type::iterator oos::object_vector_base< S, T, CT >::iterator

Shortcut for the vector iterator.

template<class S, class T, class CT = T>
typedef S oos::object_vector_base< S, T, CT >::parent_type

Shortcut for the container type.

template<class S, class T, class CT = T>
typedef object_container::size_type oos::object_vector_base< S, T, CT >::size_type

Shortcut for the size type.

template<class S, class T, class CT = T>
typedef T oos::object_vector_base< S, T, CT >::value_holder

Shortcut for the value type.

template<class S, class T, class CT = T>
typedef std::vector<item_holder> oos::object_vector_base< S, T, CT >::vector_type

Shortcut for the vector class member.

Constructor & Destructor Documentation

template<class S, class T, class CT = T>
oos::object_vector_base< S, T, CT >::object_vector_base ( parent_type parent)
inline

Creates a new object_vector.

A new object_vector is created. The vector is part of the given parent object and therefor a reference to the parent object must be found inside the value type object with the given vector_name. Also the index of the element is stored within the element. Therefor the name of the index parameter must be given.

Template Parameters
TParent object type.
Parameters
parentThe containing vector object.

Member Function Documentation

template<class S, class T, class CT = T>
virtual void oos::object_vector_base< S, T, CT >::adjust_index ( iterator  i)
protectedpure virtual

Adjust indeces of all elements after the given iterator.

Parameters
iThe start iterator for the index adjustment.
template<class S, class T, class CT = T>
value_holder oos::object_vector_base< S, T, CT >::at ( size_type  pos)
inline

Access the element at given position.

Parameters
posThe index of the requested element.
Returns
The requested element.
template<class S, class T, class CT = T>
const value_holder oos::object_vector_base< S, T, CT >::at ( size_type  pos) const
inline

Access the element at given position.

Parameters
posThe index of the requested element.
Returns
The requested element.
template<class S, class T, class CT = T>
iterator oos::object_vector_base< S, T, CT >::begin ( )
inline

Return the begin iterator of the vector.

Returns
The begin iterator.
template<class S, class T, class CT = T>
const_iterator oos::object_vector_base< S, T, CT >::begin ( ) const
inline

Return the begin iterator of the vector.

Returns
The begin iterator.
template<class S, class T, class CT = T>
virtual const char* oos::object_vector_base< S, T, CT >::classname ( ) const
inlinevirtual

Return the typename of the item type class

Returns
The item type name.
template<class S, class T, class CT = T>
virtual void oos::object_vector_base< S, T, CT >::clear ( )
inlinevirtual

Clears the vector

template<class S, class T, class CT = T>
virtual bool oos::object_vector_base< S, T, CT >::empty ( ) const
inlinevirtual

Returns true if the vector is empty.

Returns
True if the vector is empty.
template<class S, class T, class CT = T>
iterator oos::object_vector_base< S, T, CT >::end ( )
inline

Return the end iterator of the vector.

Returns
The end iterator.
template<class S, class T, class CT = T>
const_iterator oos::object_vector_base< S, T, CT >::end ( ) const
inline

Return the end iterator of the vector.

Returns
The end iterator.
template<class S, class T, class CT = T>
virtual iterator oos::object_vector_base< S, T, CT >::erase ( iterator  i)
pure virtual

Interface to erase an element.

This is the interface for derived object_list classes to implement their erase element method. Erases a single element from the list.

Parameters
iThe iterator to erase.
Returns
Returns the next iterator.
template<class S, class T, class CT = T>
virtual iterator oos::object_vector_base< S, T, CT >::erase ( iterator  first,
iterator  last 
)
pure virtual

Erases a range defines by iterators.

Erase a range of elements from the list. The range is defined by a first and a last iterator.

Parameters
firstThe first iterator of the range to erase.
lastThe last iterator of the range to erase.
Returns
Returns the next iterator.
template<class S, class T, class CT = T>
virtual void oos::object_vector_base< S, T, CT >::for_each ( const node_func &  nf) const
inlineprotectedvirtual

Executes the given function object for all elements.

Executes the given function object for all elements.

Parameters
nfFunction object used to be executed on each element.
template<class S, class T, class CT = T>
virtual iterator oos::object_vector_base< S, T, CT >::insert ( iterator  pos,
const value_holder x 
)
pure virtual

Inserts a new element.

Insert a new element at a given iterator position.

Parameters
posThe position where to insert.
xThe element to insert.
Returns
The new position iterator.
template<class S, class T, class CT = T>
void oos::object_vector_base< S, T, CT >::insert_proxy ( int  index,
object_proxy *  proxy 
)
inlineprotected

Insert a proxy object at a given position.

Parameters
indexThe index to insert at.
proxyThe object_proxy to insert.
template<class S, class T, class CT = T>
value_holder oos::object_vector_base< S, T, CT >::operator[] ( size_type  pos)
inline

Access the element at given position.

Parameters
posThe index of the requested element.
Returns
The requested element.
template<class S, class T, class CT = T>
const value_holder oos::object_vector_base< S, T, CT >::operator[] ( size_type  pos) const
inline

Access the element at given position.

Parameters
posThe index of the requested element.
Returns
The requested element.
template<class S, class T, class CT = T>
virtual void oos::object_vector_base< S, T, CT >::parent ( object p)
inlineprotectedvirtual

Sets the parent for the vector

Parameters
pThe parent object of the vector.
template<class S, class T, class CT = T>
parent_type* oos::object_vector_base< S, T, CT >::parent ( )
inlineprotected

Return the parent of the vector.

Returns
The parent.
template<class S, class T, class CT = T>
void oos::object_vector_base< S, T, CT >::push_back ( const value_holder x)
inline

Adds an element to the end of the list.

Parameters
xThe element to be pushed back.
template<class S, class T, class CT = T>
virtual size_type oos::object_vector_base< S, T, CT >::size ( ) const
inlinevirtual

Returns the size of the vector.

Returns
The size of the vector.
template<class S, class T, class CT = T>
virtual void oos::object_vector_base< S, T, CT >::uninstall ( )
inlineprotectedvirtual

Resets the object_store and clears the vector.

template<class S, class T, class CT = T>
vector_type& oos::object_vector_base< S, T, CT >::vector ( )
inlineprotected

Return a reference to the underlying vector class object.

Returns
The vector object.

The documentation for this class was generated from the following file:
  • object/object_vector.hpp