DetectorGraph  2.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
DetectorGraph::TopicState Struct Reference

Base struct for topic data types. More...

Collaboration diagram for DetectorGraph::TopicState:

Public Types

enum  { kAnonymousTopicState = -1 }
 Default GetId() return value. More...
 

Public Member Functions

 TopicState ()
 
virtual ~TopicState ()
 
const char * GetName () const
 Get type name of itself. More...
 
virtual TopicStateIdType GetId () const
 Returns the TopicStateId for this TopicState - to be implemented. More...
 

Static Public Member Functions

template<class TTopic >
static TopicStateIdType GetId ()
 Convenience templated static method to retrieve the ID for a Type when an instance is not available. More...
 

Detailed Description

Base struct for topic data types.

This should be seen like a POD data container. A simple example could be:

struct AccelerometerData : public TopicState {
int32_t x;
int32_t y;
int32_t z;
};

Ideally all TopicStates are self-explanatory and self-contained; a subscriber shouldn't need anything else to act on it. The rationale for calling it 'struct' instead of 'class':

Definition at line 52 of file topicstate.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Default GetId() return value.

Enumerator
kAnonymousTopicState 

Definition at line 76 of file topicstate.hpp.

Constructor & Destructor Documentation

◆ TopicState()

DetectorGraph::TopicState::TopicState ( )
inline

Definition at line 54 of file topicstate.hpp.

◆ ~TopicState()

virtual DetectorGraph::TopicState::~TopicState ( )
inlinevirtual

Definition at line 55 of file topicstate.hpp.

Member Function Documentation

◆ GetId() [1/2]

virtual TopicStateIdType DetectorGraph::TopicState::GetId ( ) const
inlinevirtual

Returns the TopicStateId for this TopicState - to be implemented.

If not implemented on a derived class it returns -1 (not implemented) meaning this TopicState is an anonymous TopicState (only used within the graph). This refers to a public number-space defined by the application for types that are intended to be provided to (or from) the outside (of the graph).

For a full discussion/example of how to use Named TopicStates see Trivial Vending Machine Example

Definition at line 90 of file topicstate.hpp.

◆ GetId() [2/2]

template<class TTopic >
static TopicStateIdType DetectorGraph::TopicState::GetId ( )
inlinestatic

Convenience templated static method to retrieve the ID for a Type when an instance is not available.

Definition at line 100 of file topicstate.hpp.

◆ GetName()

const char* DetectorGraph::TopicState::GetName ( ) const
inline

Get type name of itself.

This method is a convenience method that can be used for graph debugging. It uses RTTI to generate a descriptive string that identifies the child of TopicState. This strings are compiler-specific but mostly based on the actual name of struct that inherits from TopicState.

Definition at line 68 of file topicstate.hpp.


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