DetectorGraph  2.0
Classes | Public Member Functions | List of all members
DetectorGraph::TopicRegistry Class Reference

Internal - A limited-size Container for Topic<T>s More...

Collaboration diagram for DetectorGraph::TopicRegistry:

Public Member Functions

 TopicRegistry ()
 
template<class TTopicState >
Topic< TTopicState > * Resolve ()
 
template<class TTopicState >
void Register (Topic< TTopicState > *obj)
 
 TopicRegistry ()
 
 ~TopicRegistry ()
 
template<class TTopicState >
Topic< TTopicState > * Resolve ()
 Internal - Retrieves a Topic pointer for a given TopicState. More...
 
template<class TTopicState >
void Register (Topic< TTopicState > *topicPtr)
 Internal - Registers a Topic pointer for a given TopicState. More...
 
template<class TTopicState >
Topic< TTopicState > * Resolve ()
 Internal - Retrieves a Topic pointer for a given TopicState. More...
 
template<class TTopicState >
void Register (Topic< TTopicState > *obj)
 Internal - Registers a Topic pointer for a given TopicState. More...
 

Detailed Description

Internal - A limited-size Container for Topic<T>s

Internal - A Registry of available Topics

Internal - A statically and automatically sized registry for Topics

Graph owns this to manage all the registered topics This Container uses a single pointer array to store BaseTopic* indexed by the topic's public ID.

This TopicRegistry needs no explicit sizing, does not depend on RTTI nor STL and puts no requirements on TopicStates. It's downside is that its storage is static and thus behaves like a singleton - this means only one instance of TopicRegistry can be alive at any time.

This implementation stores BaseTopic* on TTopicState-templated methods. The pointer can be set by calling ResolveOrRegister with a non-NULL argument and retrieved by calling the same method with a NULL argument.

The type stored in the templated methods - RegistryNode - is a single node for a linked-list stack. Each node holds a BaseTopic* and a pointer to another RegistryNode. This allows TopicRegistry to perform cleanup of the static/singleton nodes per topic at the destructor.

Graphs use a TopicRegistry to register and resolve (i.e. retrieve) Topics using a Type-aware API. This uses RTTI to retrieve an 'index' for each class.

Right now using 'name' because it's convenient for debugging.. But could use other stuff too.

Definition at line 33 of file topicregistry-lite.hpp.

Constructor & Destructor Documentation

◆ TopicRegistry() [1/2]

DetectorGraph::TopicRegistry::TopicRegistry ( )
inline

Definition at line 37 of file topicregistry-lite.hpp.

◆ TopicRegistry() [2/2]

DetectorGraph::TopicRegistry::TopicRegistry ( )
inline

Definition at line 57 of file topicregistry-lite2.hpp.

◆ ~TopicRegistry()

DetectorGraph::TopicRegistry::~TopicRegistry ( )
inline

Definition at line 61 of file topicregistry-lite2.hpp.

Member Function Documentation

◆ Register() [1/3]

template<class TTopicState >
void DetectorGraph::TopicRegistry::Register ( Topic< TTopicState > *  obj)
inline

Definition at line 56 of file topicregistry-lite.hpp.

◆ Register() [2/3]

template<class TTopicState >
void DetectorGraph::TopicRegistry::Register ( Topic< TTopicState > *  obj)
inline

Internal - Registers a Topic pointer for a given TopicState.

Definition at line 65 of file topicregistry-stl.hpp.

◆ Register() [3/3]

template<class TTopicState >
void DetectorGraph::TopicRegistry::Register ( Topic< TTopicState > *  topicPtr)
inline

Internal - Registers a Topic pointer for a given TopicState.

Definition at line 90 of file topicregistry-lite2.hpp.

◆ Resolve() [1/3]

template<class TTopicState >
Topic<TTopicState>* DetectorGraph::TopicRegistry::Resolve ( )
inline

Definition at line 38 of file topicregistry-lite.hpp.

◆ Resolve() [2/3]

template<class TTopicState >
Topic<TTopicState>* DetectorGraph::TopicRegistry::Resolve ( )
inline

Internal - Retrieves a Topic pointer for a given TopicState.

Definition at line 47 of file topicregistry-stl.hpp.

◆ Resolve() [3/3]

template<class TTopicState >
Topic<TTopicState>* DetectorGraph::TopicRegistry::Resolve ( )
inline

Internal - Retrieves a Topic pointer for a given TopicState.

Definition at line 70 of file topicregistry-lite2.hpp.


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