RTC Toolkit  0.1.0-alpha
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rtctk::telSub::BusinessLogic Class Reference

#include <businessLogic.hpp>

Inheritance diagram for rtctk::telSub::BusinessLogic:
rtctk::componentFramework::RunnableStateMachineLogic rtctk::componentFramework::RunnableStateMachineLogicIf

Public Types

using OperationalLogicFactory = std::function< std::unique_ptr< OperationalLogicIf >(OperationalLogicFactoryParams const &)>
 

Public Member Functions

 BusinessLogic (const std::string &name, componentFramework::ServiceContainer &services, OperationalLogicFactory factory)
 
void Starting (componentFramework::StopToken st) override
 Deletes the operational logic if the object exists. More...
 
void Initialising (componentFramework::StopToken st) override
 
void Enabling (componentFramework::StopToken st) override
 
void Disabling (componentFramework::StopToken st) override
 
void GoingRunning (componentFramework::StopToken st) override
 
void GoingIdle (componentFramework::StopToken st) override
 
void Running (componentFramework::StopToken st) override
 
void Updating (componentFramework::StopToken st, componentFramework::Payload args) override
 
bool IsUpdatingAllowed (componentFramework::Payload args) override
 
- Public Member Functions inherited from rtctk::componentFramework::RunnableStateMachineLogic
 RunnableStateMachineLogic (std::string const &name, ServiceContainer &services)
 
virtual ~RunnableStateMachineLogic ()=default
 
void Recovering (StopToken st) override
 
- Public Member Functions inherited from rtctk::componentFramework::RunnableStateMachineLogicIf
virtual ~RunnableStateMachineLogicIf ()=default
 

Protected Member Functions

template<typename T >
void GetParam (const rtctk::componentFramework::DataPointPath &path, T &value)
 
template<typename T >
bool GetOptionalParam (const rtctk::componentFramework::DataPointPath &path, T &value)
 
std::optional< numapp::NumaPolicies > LoadNumaPolicies (const rtctk::componentFramework::DataPointPath &path)
 

Protected Attributes

rtctk::componentFramework::RuntimeRepoApiIfm_rtr
 
OperationalLogicFactory m_operational_logic_factory
 
std::unique_ptr< OperationalLogicIfm_operational_logic
 Operational logic constructed during Initialization with parameters from configuration. More...
 
- Protected Attributes inherited from rtctk::componentFramework::RunnableStateMachineLogic
const std::string & m_name
 
ServiceContainerm_services
 

Detailed Description

Implements the Telemetry Subscriber business logic.

Member Typedef Documentation

◆ OperationalLogicFactory

Constructor & Destructor Documentation

◆ BusinessLogic()

rtctk::telSub::BusinessLogic::BusinessLogic ( const std::string &  name,
componentFramework::ServiceContainer services,
OperationalLogicFactory  factory 
)

Member Function Documentation

◆ Disabling()

void rtctk::telSub::BusinessLogic::Disabling ( componentFramework::StopToken  st)
overridevirtual

Main tasks:

Requires re-initialization to re-enter Operational.

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ Enabling()

void rtctk::telSub::BusinessLogic::Enabling ( componentFramework::StopToken  st)
overridevirtual

Main tasks:

  • Starts subscribing to DDS topics (but discards any received samples) (TBC, might be already done in Initializing to simplify).

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ GetOptionalParam()

template<typename T >
bool rtctk::telSub::BusinessLogic::GetOptionalParam ( const rtctk::componentFramework::DataPointPath path,
T &  value 
)
inlineprotected

Helper method similar to GetParam, except no exceptions are thrown if the path does not exit and the value is not modified.

Returns
true if the datapoint exists and false otherwise.

◆ GetParam()

template<typename T >
void rtctk::telSub::BusinessLogic::GetParam ( const rtctk::componentFramework::DataPointPath path,
T &  value 
)
inlineprotected

Helper method to fetch and log datapoint values loaded from the Runtime Repository.

◆ GoingIdle()

void rtctk::telSub::BusinessLogic::GoingIdle ( componentFramework::StopToken  st)
overridevirtual

Main tasks:

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ GoingRunning()

void rtctk::telSub::BusinessLogic::GoingRunning ( componentFramework::StopToken  st)
overridevirtual

Main tasks:

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ Initialising()

void rtctk::telSub::BusinessLogic::Initialising ( componentFramework::StopToken  st)
overridevirtual

Main tasks:

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ IsUpdatingAllowed()

bool rtctk::telSub::BusinessLogic::IsUpdatingAllowed ( componentFramework::Payload  args)
overridevirtual

Guard IsUpdatingAllowed

Guard method to further constrain whether an Update command is allowed to cause an Updating activity or not. Simply set the return value to configure as needed.

Parameters
argsPayload, to be able to receive information on what to update
Returns
false if update is dissalowed.
true, if update is allowed.

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ LoadNumaPolicies()

std::optional< numapp::NumaPolicies > rtctk::telSub::BusinessLogic::LoadNumaPolicies ( const rtctk::componentFramework::DataPointPath path)
protected

Constructs a NumaPolicies object from the configuration datapoints found under the given datapoint path.

Parameters
pathThe base path under which configuration datapoints for NUMA policies will be searched. The following sub-paths will be searched:
  • cpu_affinity
  • scheduler_policy
  • scheduler_priority
  • memory_policy_mode
  • memory_policy_nodes
Returns
The loaded NUMA policies or std::nullopt if no policies were provided.

Valid values for the scheduler_policy datapoint are:

  • Fifo
  • Rr
  • Other
  • Batch

If either Fifo or Rr are used then the scheduler_priority can be used to set the threads priority. scheduler_priority is ignored for other settings of scheduler_policy.

Valid values for the memory_policy_mode datapoint are:

  • Default
  • Bind
  • Interleave
  • Preferred
Note
Setting only scheduler_priority without scheduler_policy has no effect. scheduler_policy must always be used if scheduler_priority is set in the configuration.
The datapoints for memory_policy_mode and memory_policy_nodes must be provided together.

◆ Running()

void rtctk::telSub::BusinessLogic::Running ( componentFramework::StopToken  st)
overridevirtual

TBC if we have anything to do here.

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ Starting()

void rtctk::telSub::BusinessLogic::Starting ( componentFramework::StopToken  st)
overridevirtual

Deletes the operational logic if the object exists.

When the Reset command is received and the Starting activity is executed, we need to delete the operational logic object that might already exist, because the component has already been initialised. If the component is starting for the first time then there is nothing to do.

Parameters
stThis parameter is ignored.

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

◆ Updating()

void rtctk::telSub::BusinessLogic::Updating ( componentFramework::StopToken  st,
componentFramework::Payload  args 
)
overridevirtual

TBD what, if anything can be updated? I can't think of anything that does not require reinitialization.

Reimplemented from rtctk::componentFramework::RunnableStateMachineLogic.

Member Data Documentation

◆ m_operational_logic

std::unique_ptr<OperationalLogicIf> rtctk::telSub::BusinessLogic::m_operational_logic
protected

Operational logic constructed during Initialization with parameters from configuration.

◆ m_operational_logic_factory

OperationalLogicFactory rtctk::telSub::BusinessLogic::m_operational_logic_factory
protected

◆ m_rtr

rtctk::componentFramework::RuntimeRepoApiIf& rtctk::telSub::BusinessLogic::m_rtr
protected

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