torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve > Class Template Reference

An array of objects. More...

#include <Vector.hpp>

Inheritance diagram for torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >:

Inheritance graph
[legend]
Collaboration diagram for torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef Composite< _Type > BaseType
typedef BaseType::Type Type
typedef BaseType::List List
typedef BaseType::Pointer Pointer
typedef BaseType::SizeType SizeType
typedef _ChildType ChildType
typedef boost::shared_ptr
< ChildType > 
ChildPointer
typedef _ChildFactoryType ChildFactory
typedef boost::shared_ptr
< _ChildFactoryType > 
ChildFactorySharedPtr

Public Member Functions

virtual CompositionType getCompositionType () const throw ()
virtual SizeType getSize () const throw ()
virtual const Pointer get (const std::vector< SizeType > &inIndices) const throw (Error)
virtual void getChildren (List &outChildren) const throw (Error)
virtual void getCreatedChildren (List &outChildren) const throw (Error)
void constructChildren (const boost::shared_ptr< ChildFactory > &inFactory, const std::vector< SizeType > &inLimits) throw (Error)
void getLimits (std::vector< SizeType > &outLimits) const throw ()
bool getIsPreserved () const throw ()

Protected Member Functions

void setChildren (const List &inSource) throw (Error)
virtual void onAutoBlast () const throw (Error)
virtual void onChildCreate (const boost::shared_ptr< ChildType > &inCreatedChild) const throw (Error)
void setLimits (const std::vector< SizeType > &inSource) throw ()
const boost::shared_ptr
< ChildFactory > 
getFactory () const throw ()
void setFactory (const boost::shared_ptr< ChildFactory > &inSource) throw ()

Private Types

typedef SymTab< SizeType, PointerSparseElements

Private Member Functions

void autoBlast () const throw (Error)
void incrementIndices (std::vector< SizeType > &indices, const std::vector< SizeType > &limits) const throw ()
SizeType indicesToAbsoluteIndex (const std::vector< SizeType > &inIndices) const throw ()
SizeType storageSize () const
 Vector (const Vector< _Type, _ChildType, _ChildFactoryType, cPreserve > &source) throw ()
Vector< _Type, _ChildType,
_ChildFactoryType, cPreserve > & 
operator= (const Vector< _Type, _ChildType, _ChildFactoryType, cPreserve > &source) throw ()

Private Attributes

std::vector< SizeType > mLimits
List mChildren
SparseElements mSparseElements
boost::shared_ptr< ChildFactory > mFactory
bool mIsPreserved
SizeType mPreservationThreshold


Detailed Description

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve = false>
class torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >

An array of objects.

This provides methods for accessing and adding elements to the array. It also implements the VectorPreservation algorithm if cPreserve is set to true. The vector class creates elements derived from VectorBit class by using the provided factory.

Definition at line 57 of file Vector.hpp.


Member Typedef Documentation

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve = false>
typedef BaseType::List torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::List

List of Shared Pointers to objects of type Type

Reimplemented from torc::generic::Composite< _Type >.

Definition at line 66 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve = false>
typedef BaseType::Pointer torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::Pointer

Shared Pointer to object of type Type

Reimplemented from torc::generic::Composite< _Type >.

Definition at line 67 of file Vector.hpp.


Member Function Documentation

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
CompositionType torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::getCompositionType (  )  const throw () [inline, virtual]

Get composition type for this object

Returns:
The CompositionType inSource eCompositionTypeVector is returned

Implements torc::generic::Composite< _Type >.

Definition at line 349 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::SizeType torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::getSize ( void   )  const throw () [inline, virtual]

Get the total number of bits of the composition

Returns:
Number of bits

Implements torc::generic::Composite< _Type >.

Definition at line 363 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
const Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::Pointer torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::get ( const std::vector< SizeType > &  inIndices  )  const throw (Error) [inline, virtual]

Get a specific member of this composition.

Note:
This is relevant for Vector composition only. Other compositions return a NULL pointer
Parameters:
[in] inIndices A list of indices to be accessed. The number of indices must be equal to the number of dimensions.
Returns:
A pointer to the child situated at the specified indices. For non-relevant types a NULL pointer is returned
Exceptions:
Error Index dimensions mismatch
  • Id : eMessageIdErrorArrayIndexSizeMismatch
  • Context Data
    • Array Index Size - size_t
    • Array Dimension Size - size_t
Error Array index out of bounds
  • Id : eMessageIdErrorArrayIndexOutOfBounds
  • Context Data
    • Array Index - size_t
    • Array Dimension - size_t
Error Empty Array
  • Id : eMessageIdErrorEmptyArray
  • Context Data
    • Array Dimension - size_t
Get a specific member of this composition.

Note:
This is relevant for Vector composition only. Other compositions return a NULL pointer
Parameters:
[in] inIndices A list of indices to be accessed. The number of indices must be equal to the number of dimensions.
Returns:
A pointer to the child situated at the specified indices. For non-relevant types a NULL pointer is returned
Exceptions:
Error Index dimensions mismatch

Definition at line 427 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve = false>
virtual void torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::getChildren ( List outChildren  )  const throw (Error) [virtual]

Get children of this composition.

Parameters:
[out] outChildren A list of all children for this composition
Exceptions:
Error If factory is not set and preserve is true and the vector has not been blasted, an exception is generated.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
void torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::setChildren ( const List inSource  )  throw (Error) [inline, protected]

Set list of children for unpreserved vector.

Parameters:
[in] inSource List of children

Definition at line 549 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
void torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::constructChildren ( const boost::shared_ptr< ChildFactory > &  inFactory,
const std::vector< SizeType > &  inLimits 
) throw (Error) [inline]

Create list of children using the provided factory and limits

Parameters:
[in] inFactory ChildFactory to use for construcing children
[in] inLimits Array dimensions
Exceptions:
Error Children could not be created
Note:
setName() must have already been called before calling this method. For preserved arrays this does not actually do anything other than storing the factory and limits inside itself for later use.
Create list of children using the provided factory and limits

Parameters:
[in] inFactory ChildFactory to use for construcing children
[in] inLimits Array dimensions
Exceptions:
Error Children could not be created
Note:
For preserved arrays this does not actually do anything other than storing the factory and limits inside itself for later use.

Definition at line 582 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
void torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::getLimits ( std::vector< SizeType > &  outLimits  )  const throw () [inline]

Get dimensions of the array.

Parameters:
[in] outLimits Dimensions of the vector
Get dimensions of the array.

Returns:
Dimensions of the vector

Definition at line 814 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
void torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::setLimits ( const std::vector< SizeType > &  inSource  )  throw () [inline, protected]

Set dimensions of the array.

Parameters:
[in] inSource Dimensions of the vector

Definition at line 842 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve>
const boost::shared_ptr< _ChildFactoryType > torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::getFactory (  )  const throw () [inline, protected]

Get current factory

Returns:
Return ChildFactory object
Exceptions:
Error Null Child Factory
  • Id : eMessageIdErrorNullChildfactory
  • Context Data
    • Child factory - ChildFactory

    Get current factory

Returns:
Return ChildFactory object

Definition at line 858 of file Vector.hpp.

template<typename _Type, typename _ChildType, typename _ChildFactoryType, bool cPreserve = false>
void torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >::setFactory ( const boost::shared_ptr< ChildFactory > &  inSource  )  throw () [protected]

Set current factory

Parameters:
[in] inSource ChildFactory object


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

Generated on Thu Oct 13 16:50:30 2011 for TORC by  doxygen 1.5.6