$darkmode
cloe::Controller Class Reference

#include <controller.hpp>

Inheritance diagram for cloe::Controller:
Collaboration diagram for cloe::Controller:

Public Member Functions

virtual bool has_vehicle () const
 
virtual std::shared_ptr< Vehicleget_vehicle () const
 
virtual void set_vehicle (std::shared_ptr< Vehicle > v)
 
- 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 Duration process (const Sync &)=0
 
virtual void pause (const Sync &)
 
virtual void resume (const Sync &)
 
virtual void stop (const Sync &)
 
virtual void reset ()
 
virtual void abort ()
 
 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)
 

Protected Attributes

std::shared_ptr< Vehicleveh_ {nullptr}
 
- Protected Attributes inherited from cloe::Model
bool connected_ {false}
 
bool operational_ {false}
 
- Protected Attributes inherited from cloe::Entity
std::string name_
 
std::string desc_
 

Additional Inherited Members

- Protected Member Functions inherited from cloe::Entity
virtual Logger logger () const
 

Detailed Description

The Controller class serves as an interface which every controller binding should inherit from.

It differs from its base class Model by providing a method to assign a Vehicle to it. Thus, a controller is bound to a single vehicle, which it can use during processing for input and output purposes.

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 Controller interface:

Member Function Documentation

◆ get_vehicle()

virtual std::shared_ptr<Vehicle> cloe::Controller::get_vehicle ( ) const
inlinevirtual

Return a pointer to the vehicle that is assigned to the controller.

  • If nullptr is returned, this indicates that the controller is unpaired and disabled.

◆ has_vehicle()

virtual bool cloe::Controller::has_vehicle ( ) const
inlinevirtual

Return whether the controller has a vehicle assigned to it.

This is a prerequisite for the controller to be able to run.

◆ set_vehicle()

virtual void cloe::Controller::set_vehicle ( std::shared_ptr< Vehicle v)
inlinevirtual

Assign a vehicle to the controller.

  • If v == nullptr, then the controller's process method will not be called.
  • If called multiple times, the last call overrides any previous ones.
  • The controller is not responsible for the deletion of the vehicle.
  • The pointer passed in is valid for the duration of the simulation.

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