$darkmode
cloe::Component Class Referenceabstract

#include <component.hpp>

Inheritance diagram for cloe::Component:
Collaboration diagram for cloe::Component:

Public Member Functions

 Component (const std::string &name, const std::string &description="")
 
 Component (std::string &&name, std::string &&description="")
 
uint64_t id () const
 
template<typename T >
T * as ()
 
virtual fable::Json active_state () const =0
 
Duration process (const Sync &sync) override
 
void reset () override
 
void abort () override
 
- Public Member Functions inherited from cloe::Model
virtual ~Model () noexcept=default
 
virtual Duration resolution () const
 
virtual bool is_connected () const
 
virtual bool is_operational () const
 
virtual void connect ()
 
virtual void disconnect ()
 
virtual void enroll (Registrar &)
 
virtual void start (const Sync &)
 
virtual void pause (const Sync &)
 
virtual void resume (const Sync &)
 
virtual void stop (const Sync &)
 
 Entity (std::string name)
 
 Entity (std::string name, std::string desc)
 
- Public Member Functions inherited from cloe::Entity
 Entity (std::string name)
 
 Entity (std::string name, std::string desc)
 
const std::string & name () const
 
void set_name (std::string name)
 
const std::string & description () const
 
void set_description (std::string desc)
 

Friends

void to_json (fable::Json &j, const Component &c)
 

Additional Inherited Members

- Protected Member Functions inherited from cloe::Entity
virtual Logger logger () const
 
- Protected Attributes inherited from cloe::Model
bool connected_ {false}
 
bool operational_ {false}
 
- Protected Attributes inherited from cloe::Entity
std::string name_
 
std::string desc_
 

Detailed Description

A Component is a sensor or actuator that is part of a vehicle. Components can be used by controllers for reading and writing.

Generally, one does not directly inherit from Component when creating a new component plugin. Instead, an intermediate interface is created, such as EgoSensor, which is then used as the base class. This allows multiple implementations and proxies to augment components transparently. As such, the interface provided by the Component class is quite slim.

Note: If you are creating a Component and it is not a standard CloeComponent, it is recommended to create a static method

static const char* default_name()

that returns a unique identifier (e.g. with namespace and so on).

Inherited Methods

Make sure to implement the following methods from the Model interface:

See the documentation for the Model class for information on when these methods are called in a simulation.

See also
cloe/model.hpp

Special Methods

The following methods are specific to the Component interface:

Member Function Documentation

◆ abort()

void cloe::Component::abort ( )
inlineoverridevirtual

Implement Model::abort by default.

Reimplemented from cloe::Model.

Here is the caller graph for this function:

◆ active_state()

◆ as()

template<typename T >
T* cloe::Component::as ( )
inline

Attempt to cast this component to a sub-type.

  • Throws an exception if the component cannot be cast.

◆ id()

uint64_t cloe::Component::id ( ) const
inline

Return the unique numeric ID of this component.

This numeric ID should be unique across all components in a simulation. There is no guarantee however, that the component will receive the same ID in any future simulation. Numeric IDs start with 1; 0 is not a valid ID.

◆ process()

Duration cloe::Component::process ( const Sync sync)
inlineoverridevirtual

Clear any cache that may be accumulated during a step.

  • Each inheriting class should call the super class.
  • This may be called multiple times.

Implements cloe::Model.

Reimplemented in cloe::Actuator< double >, cloe::Actuator< PedalRequest >, cloe::Actuator< SteeringRequest >, and cloe::Actuator< GearboxRequest >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void cloe::Component::reset ( )
inlineoverridevirtual

Implement Model::reset by default.

Reimplemented from cloe::Model.

Reimplemented in cloe::Actuator< double >, cloe::Actuator< PedalRequest >, cloe::Actuator< SteeringRequest >, and cloe::Actuator< GearboxRequest >.

Here is the caller graph for this function:

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