libbio
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
bio::physical::TypedPerspective< DIMENSION > Class Template Reference

#include <TypedPerspective.h>

Inheritance diagram for bio::physical::TypedPerspective< DIMENSION >:
Inheritance graph
[legend]
Collaboration diagram for bio::physical::TypedPerspective< DIMENSION >:
Collaboration graph
[legend]

Public Member Functions

 TypedPerspective ()
 
virtual ~TypedPerspective ()
 
virtual bool AssociateType (const DIMENSION &id, Pointer< physical::Wave > type)
 
virtual bool DisassociateType (const DIMENSION &id)
 
virtual bool IsTypeAssociated (const DIMENSION &id) const
 
virtual Pointer< const WaveGetTypeFromId (const DIMENSION &id) const
 
virtual Pointer< const WaveGetTypeFromName (const Name &name) const
 
template<typename T >
const T GetTypeFromIdAs (const DIMENSION &id) const
 
template<typename T >
const T GetTypeFromNameAs (const Name &name) const
 
virtual Pointer< WaveGetNewObjectFromId (const DIMENSION &id) const
 
virtual Pointer< WaveGetNewObjectFromName (const Name &name)
 
template<typename T >
T GetNewObjectFromIdAs (const DIMENSION &id)
 
template<typename T >
T GetNewObjectFromNameAs (const Name &name)
 
- Public Member Functions inherited from bio::physical::Perspective< DIMENSION >
 Perspective ()
 
virtual ~Perspective ()
 
SmartIterator Find (const DIMENSION &id)
 
SmartIterator Find (const DIMENSION &id) const
 
virtual DIMENSION GetIdFromName (const Name &name)
 
virtual Name GetNameFromId (const DIMENSION &id) const
 
virtual DIMENSION GetUniqueIdFor (const Name &name)
 
virtual DIMENSION GetIdWithoutCreation (const Name &name) const
 
virtual DIMENSION GetNumUsedIds () const
 
- Public Member Functions inherited from bio::ThreadSafe
 ThreadSafe ()
 
 ThreadSafe (const ThreadSafe &toCopy)
 
ThreadSafeoperator= (const ThreadSafe &toCopy)
 
 ~ThreadSafe ()
 
void LockThread () const
 
void UnlockThread () const
 
void LockMutexShared () const
 
void UnlockMutexShared () const
 

Protected Member Functions

virtual Pointer< Brane< DIMENSION > > CreateBrane (DIMENSION id, const Name &name)
 
- Protected Member Functions inherited from bio::physical::Perspective< DIMENSION >
void RegisterBrane (Pointer< Brane< DIMENSION > > brane)
 
template<class T >
T GetBraneAs (DIMENSION id)
 
template<class T >
const T GetBraneAs (DIMENSION id) const
 

Additional Inherited Members

- Static Public Member Functions inherited from bio::physical::Perspective< DIMENSION >
static DIMENSION InvalidId ()
 
static Name InvalidName ()
 
- Static Protected Member Functions inherited from bio::physical::Perspective< DIMENSION >
::std::string IndexKeyFor (const Name &name)
 
- Protected Attributes inherited from bio::physical::Perspective< DIMENSION >
Pointer< ContainermBranes
 
DIMENSION mNextId
 
mutable ::std::map< DIMENSION, IndexmByIdIndex
 

Detailed Description

template<typename DIMENSION>
class bio::physical::TypedPerspective< DIMENSION >

A TypedPerspective extends Perspective by adding Waves to its Branes.
This allows you to (Dis)AssociateType(...) and GetNewObject...(...) from Names and Ids.

Template Parameters
DIMENSIONan unsigned integer (e.g. uint8_t).

Constructor & Destructor Documentation

◆ TypedPerspective()

template<typename DIMENSION >
bio::physical::TypedPerspective< DIMENSION >::TypedPerspective ( )
inline

◆ ~TypedPerspective()

Member Function Documentation

◆ AssociateType()

template<typename DIMENSION >
virtual bool bio::physical::TypedPerspective< DIMENSION >::AssociateType ( const DIMENSION id,
Pointer< physical::Wave type 
)
inlinevirtual

Associates the given Wave type with the given id.
Nop if a type is already Associated. In that case, you must Disassociate the type before calling this method.

NOTE: THE ASSOCIATED TYPE WILL BE DELETED BY *this AND SHOULD LAST THE LIFETIME OF THE PROGRAM!
In other words, don't delete whatever you provide here.

This is only necessary if you want to use GetTypeFromId later on.
Associating a type with an id has no effect on the Recorded Properties.
You should only use this with classes that derive from physical::Class<>, as this is the only accepted means of retrieving the type later (see GetInstance, below).

Parameters
id
type
Returns
true if the association completed successfully else false

◆ CreateBrane()

template<typename DIMENSION >
virtual Pointer< Brane< DIMENSION > > bio::physical::TypedPerspective< DIMENSION >::CreateBrane ( DIMENSION  id,
const Name name 
)
inlineprotectedvirtual

Create a TypedBrane instead of a standard Brane.

Parameters
id
name
Returns
a TypedBrane.

Reimplemented from bio::physical::Perspective< DIMENSION >.

◆ DisassociateType()

template<typename DIMENSION >
virtual bool bio::physical::TypedPerspective< DIMENSION >::DisassociateType ( const DIMENSION id)
inlinevirtual

Removes the type association created by AssociateType() and deletes the Associated Wave.
Disassociating a type has no effect on the Recorded Properties.

Parameters
id
Returns
true if the association was removed else false.

◆ GetNewObjectFromId()

template<typename DIMENSION >
virtual Pointer< Wave > bio::physical::TypedPerspective< DIMENSION >::GetNewObjectFromId ( const DIMENSION id) const
inlinevirtual

Creates a new object by Clone()ing the associated type.

Parameters
id
Returns
a Clone() of the Wave* associated with the given id else NULL.

◆ GetNewObjectFromIdAs()

template<typename DIMENSION >
template<typename T >
T bio::physical::TypedPerspective< DIMENSION >::GetNewObjectFromIdAs ( const DIMENSION id)
inline

Ease of use method for casting the result of GetNewObjectFromId()

Template Parameters
T
Parameters
id
Returns
a new T* from Clone()ing the type associated with the given id else NULL.

◆ GetNewObjectFromName()

template<typename DIMENSION >
virtual Pointer< Wave > bio::physical::TypedPerspective< DIMENSION >::GetNewObjectFromName ( const Name name)
inlinevirtual

Creates a new object by Clone()ing the associated type.

Parameters
name
Returns
a Clone() of the Wave* associated with the given name else NULL.

◆ GetNewObjectFromNameAs()

template<typename DIMENSION >
template<typename T >
T bio::physical::TypedPerspective< DIMENSION >::GetNewObjectFromNameAs ( const Name name)
inline

Ease of access method for casting the result of GetNewObjectFromName()

Template Parameters
T
Parameters
name
Returns
a new T* from Clone()ing the type associated with the given name else NULL.

◆ GetTypeFromId()

template<typename DIMENSION >
virtual Pointer< const Wave > bio::physical::TypedPerspective< DIMENSION >::GetTypeFromId ( const DIMENSION id) const
inlinevirtual

Only works if AssociateType has been called with the given id.

Parameters
id
Returns
the pointer to the Wave type associated with the given id else NULL.

◆ GetTypeFromIdAs()

template<typename DIMENSION >
template<typename T >
const T bio::physical::TypedPerspective< DIMENSION >::GetTypeFromIdAs ( const DIMENSION id) const
inline

Ease of access method for casting the result of GetTypeFromId().

Template Parameters
T
Parameters
id
Returns
a T* associated with the given name id NULL.

◆ GetTypeFromName()

template<typename DIMENSION >
virtual Pointer< const Wave > bio::physical::TypedPerspective< DIMENSION >::GetTypeFromName ( const Name name) const
inlinevirtual

Only works if AssociateType has been called with the given id.

Parameters
name
Returns
the pointer to the Wave type associated with the given id else NULL.

◆ GetTypeFromNameAs()

template<typename DIMENSION >
template<typename T >
const T bio::physical::TypedPerspective< DIMENSION >::GetTypeFromNameAs ( const Name name) const
inline

Ease of access method for casting the result of GetTypeFromId().

Template Parameters
T
Parameters
name
Returns
a T* associated with the given name id NULL.

◆ IsTypeAssociated()

template<typename DIMENSION >
virtual bool bio::physical::TypedPerspective< DIMENSION >::IsTypeAssociated ( const DIMENSION id) const
inlinevirtual

Check if AssociateType() has been called for a particular id.

Parameters
id
Returns
true if the type has previously been Associated, otherwise false.

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