torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::Composite< _Type > Class Template Referenceabstract

Interface for objects that can be composed within each other. More...

#include <Composite.hpp>

+ Inheritance diagram for torc::generic::Composite< _Type >:
+ Collaboration diagram for torc::generic::Composite< _Type >:

Public Types

typedef _Type Type
 
typedef boost::shared_ptr< TypePointer
 
typedef boost::weak_ptr< TypeWeakPointer
 
typedef std::vector< PointerList
 
typedef size_t SizeType
 

Public Member Functions

 Composite ()
 
virtual CompositionType getCompositionType () const =0
 
virtual size_t getSize () const =0
 
virtual void getChildren (List &outChildren) const =0 throw (Error)
 
virtual const Pointer get (const std::vector< SizeType > &inIndices) const =0 throw (Error)
 
virtual void setParentCollection (const Pointer &inParentCollection)
 
virtual Pointer getParentCollection () const
 
void setWeakThis (const WeakPointer &inWeakThis)
 
Pointer getSharedThis () const
 

Protected Member Functions

virtual ~Composite () throw ()
 

Private Member Functions

 Composite (const Composite< _Type > &rhs)
 
Composite< _Type > & operator= (const Composite< _Type > &rhs)
 

Private Attributes

WeakPointer mParentCollection
 

Detailed Description

template<typename _Type>
class torc::generic::Composite< _Type >

Interface for objects that can be composed within each other.

The Composite class defines an interface for objects that can occur singly (Scalar), as Arrays (Vector) or bundles (Bundle). This class defines polymorphic methods that will be overridden by subsequent implementations.

Definition at line 45 of file Composite.hpp.

Member Typedef Documentation

template<typename _Type>
typedef std::vector<Pointer> torc::generic::Composite< _Type >::List

List of Shared Pointers to objects of type Type

Definition at line 61 of file Composite.hpp.

template<typename _Type>
typedef boost::shared_ptr<Type> torc::generic::Composite< _Type >::Pointer

Shared Pointer to object of type Type

Definition at line 55 of file Composite.hpp.

template<typename _Type>
typedef size_t torc::generic::Composite< _Type >::SizeType

Definition at line 62 of file Composite.hpp.

template<typename _Type>
typedef _Type torc::generic::Composite< _Type >::Type

Definition at line 50 of file Composite.hpp.

template<typename _Type>
typedef boost::weak_ptr<Type> torc::generic::Composite< _Type >::WeakPointer

Definition at line 56 of file Composite.hpp.

Constructor & Destructor Documentation

template<typename _Type>
virtual torc::generic::Composite< _Type >::~Composite ( )
throw (
)
inlineprotectedvirtual

Definition at line 65 of file Composite.hpp.

65  {
66  }
template<typename _Type >
torc::generic::Composite< _Type >::Composite ( )

Definition at line 137 of file Composite.hpp.

137  : SelfReferencing<_Type>(),
138  mParentCollection() {}
WeakPointer mParentCollection
Definition: Composite.hpp:133
template<typename _Type>
torc::generic::Composite< _Type >::Composite ( const Composite< _Type > &  rhs)
private

Member Function Documentation

template<typename _Type>
virtual const Pointer torc::generic::Composite< _Type >::get ( const std::vector< SizeType > &  inIndices) const
throw (Error
)
pure virtual

Get a specific member of this composition.

Note
This is relevant for Vector composition only. Other compositions return a NULL pointer
Parameters
[in]inIndicesA 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
ErrorIndex dimensions mismatch

Implemented in torc::generic::Vector< _Type, _ChildType, _ChildFactoryType, cPreserve >, torc::generic::Vector< Instance, InstanceArrayMember, InstanceArrayMember::Factory, false >, torc::generic::Vector< Port, VectorPortBit, VectorPortBit::Factory, true >, torc::generic::Vector< Net, VectorNetBit, VectorNetBit::Factory, true >, torc::generic::Vector< Parameter, ParameterArrayElement, ParameterArrayElement::Factory, false >, torc::generic::Vector< PortReference, VectorPortBitReference, VectorPortBitReference::Factory, true >, torc::generic::Bundle< _Type >, torc::generic::Bundle< Port >, torc::generic::Bundle< Net >, torc::generic::Bundle< PortReference >, torc::generic::Bundle< _BaseType >, torc::generic::VectorBit< _Type >, torc::generic::VectorBit< Port >, torc::generic::VectorBit< Net >, torc::generic::VectorBit< PortReference >, torc::generic::VectorBit< Instance >, torc::generic::VectorBit< Parameter >, torc::generic::Scalar< _Type >, torc::generic::Scalar< Port >, torc::generic::Scalar< Net >, torc::generic::Scalar< PortReference >, torc::generic::Scalar< Parameter >, and torc::generic::Scalar< Instance >.

+ Here is the caller graph for this function:

template<typename _Type >
Composite< _Type >::Pointer torc::generic::Composite< _Type >::getParentCollection ( ) const
inlinevirtual

Get a pointer to the parent collection

Returns
A pointer to the parent collection if present, empty pointer otherwise

Definition at line 156 of file Composite.hpp.

156  {
157  return mParentCollection.lock();
158 }
WeakPointer mParentCollection
Definition: Composite.hpp:133
Pointer torc::generic::SelfReferencing< _Type >::getSharedThis ( ) const
inlineinherited

Get a shared pointer to this object. A valid pointer is returned if weakThis was set. Otherwise this returns a NULL pointer. For Vector types, the second scenario is an exception condition and should be treated as such.

Returns
A shared pointer to this object

Get a shared pointer to this object. A valid pointer is returned if weakThis was set. Otherwise this returns a NULL pointer. For Vector types, the second scenario is an exception condition and should be treated as such.

Parameters
[out]ptrSet to a shared pointer to this object
template<typename _Type>
Composite<_Type>& torc::generic::Composite< _Type >::operator= ( const Composite< _Type > &  rhs)
private
template<typename _Type>
void torc::generic::Composite< _Type >::setParentCollection ( const Pointer inParentCollection)
inlinevirtual

Set a pointer to a parnt composition.

Parameters
[in]inParentCollectionpointer to the parent collection (Vector/Bundle)

Set a pointer to a parnt composition.

Parameters
[in]parentCollectionpointer to the parent collection (Vector/Bundle)

Definition at line 145 of file Composite.hpp.

146  {
147  mParentCollection = inParentCollection;
148 }
WeakPointer mParentCollection
Definition: Composite.hpp:133
void torc::generic::SelfReferencing< _Type >::setWeakThis ( const WeakPointer inWeakThis)
inlineinherited

Set a weak pointer to this object. This will be used later to get a shared pointer to this object from within other member methods if required. This should be called by the Factory creating the object.

Parameters
[in]weakThisA weak pointer to this object

Field Documentation

template<typename _Type>
WeakPointer torc::generic::Composite< _Type >::mParentCollection
private

Definition at line 133 of file Composite.hpp.


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