ifw-sup  3.0.0-pre3
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sup::syssup::common::Generic Class Reference

#include <generic.hpp>

Inheritance diagram for sup::syssup::common::Generic:

Public Member Functions

 Generic (const std::string name, Config &config, DataContext &data_ctx)
 Subsys abstract class constructor. More...
 
virtual ~Generic ()
 Default destructor. More...
 
virtual bool IsNotReady () const override
 Check if subsys is Standby/NotReady. More...
 
virtual bool IsReady () const override
 Check if subsys is Standby/Ready. More...
 
virtual bool IsOperational () const override
 Check if subsys is Operational. More...
 
virtual void CheckSubsysFailure () const override
 Check if subsys is in failure state. More...
 
virtual bool IsDisabling () const override
 Check if subsys is disablig. More...
 
virtual std::optional< elt::mal::future< void > > Connect () override
 
virtual elt::mal::future< std::string > Init () override
 Executes a Init command. More...
 
virtual elt::mal::future< std::string > Enable () override
 Executes a Enable command. More...
 
virtual elt::mal::future< std::string > Disable () override
 Executes a Disable command. More...
 
virtual elt::mal::future< std::string > Stop () override
 Executes a Stop command. More...
 
virtual elt::mal::future< std::string > GetState () override
 
virtual elt::mal::future< std::string > GetStatus () override
 
virtual elt::mal::future< std::string > GetVersion () override
 
virtual elt::mal::future< std::string > Reset () override
 Executes a Reset command. More...
 
virtual void Ignore (rad::AnyEvent const &last_event) override
 Executes a Ignore. More...
 
virtual void StopIgn (rad::AnyEvent const &last_event) override
 Executes a StopIgn. More...
 
virtual void SubsysReset (rad::AnyEvent const &last_event) override
 Executes a hardware reset command. More...
 
virtual void SubsysInit (rad::AnyEvent const &last_event) override
 Executes a hardware init command. More...
 
virtual void SubsysEnable (rad::AnyEvent const &last_event) override
 Executes a hardware enable command. More...
 
virtual void SubsysDisable (rad::AnyEvent const &last_event) override
 Executes a hardware disable command. More...
 
virtual void Setup (const std::any &payload) override
 Executes a run time configuration. More...
 
virtual void Status (const std::string &payload, std::string &buffer) override
 Get subsystem status. More...
 
virtual std::string GetName () const override
 Get subsystem name. More...
 
std::string GetPrefixName () const
 Get subsystem name for logging purposes. More...
 
std::string GetScopeStr () const
 Get subsystem scope as string. More...
 
bool GetAccess () const
 Get subsystem access flag. More...
 
void SetAccess (const bool &access)
 

Protected Member Functions

bool IsMsgForMe (const std::string &id) const
 Check if received message id is addressed to me. More...
 
void UpdateDb (std::vector< std::string > attr_vector)
 Update subsys database. More...
 
void UpdateConfig () override
 Update subsystem configuration. More...
 
void SetIgnore (bool flag)
 SetIgnore. More...
 
void GetPrefix (const std::vector< std::string > prefix_list, std::string &prefix)
 Get prefix for writing attributes to the DB. More...
 
bool CheckNameParam (const std::any &payload)
 Determine whether paramater is included (subsys name). More...
 
void StartSubscription () override
 Start subscription of subsystem status. More...
 
void StopSubscription ()
 Start subscription of subsystem status. More...
 

Protected Attributes

std::string m_name
 name of the subsystem More...
 
Configm_config
 reference to the config object. More...
 
DataContextm_data_ctx
 reference to the data context object. More...
 
Dispatcher< stdif::StdCmdsAsync > m_dispatcher
 
elt::mal::rr::ListenerRegistration m_connection_listener
 
std::unique_ptr< rad::cii::Subscriber< stdif::Status > > m_subscriber
 

Detailed Description

Subsys abstract class. This class represents the basic implementation of a subsys class. Most of the subsys share common properties and behavioural aspects. This class is implementing the common behaviour and defining the basic properties of all subsys classes.

Constructor & Destructor Documentation

◆ Generic()

sup::syssup::common::Generic::Generic ( const std::string  name,
Config config,
DataContext data_ctx 
)

Subsys abstract class constructor.

Parameters
[in]nameSubsystem name.
[in]configReference to server configuration.
[in,out]data_ctxReference to the data context object.

◆ ~Generic()

sup::syssup::common::Generic::~Generic ( )
virtual

Default destructor.

Member Function Documentation

◆ CheckNameParam()

bool sup::syssup::common::Generic::CheckNameParam ( const std::any &  payload)
protected

Determine whether paramater is included (subsys name).

Parameters
payloadPayload of the command, a vector of strings.

If the vector is empty, it will return true. If the vector contains the the id of the subsys it will also return true otherwise it will return false.

◆ CheckSubsysFailure()

void sup::syssup::common::Generic::CheckSubsysFailure ( ) const
overridevirtual

Check if subsys is in failure state.

Exceptions
anexception if an error ocurrs.

◆ Connect()

std::optional< elt::mal::future< void > > sup::syssup::common::Generic::Connect ( )
overridevirtual

◆ Disable()

elt::mal::future< std::string > sup::syssup::common::Generic::Disable ( )
overridevirtual

Executes a Disable command.

Exceptions
anexception if an error ocurrs.

◆ Enable()

elt::mal::future< std::string > sup::syssup::common::Generic::Enable ( )
overridevirtual

Executes a Enable command.

Exceptions
anexception if an error ocurrs.

◆ GetAccess()

bool sup::syssup::common::Generic::GetAccess ( ) const

Get subsystem access flag.

Returns

◆ GetName()

std::string sup::syssup::common::Generic::GetName ( ) const
overridevirtual

Get subsystem name.

◆ GetPrefix()

void sup::syssup::common::Generic::GetPrefix ( const std::vector< std::string >  prefix_list,
std::string &  prefix 
)
protected

Get prefix for writing attributes to the DB.

Parameters
prefix_listList of intermediate prefix values.
prefixString containing the formatted prefix.

◆ GetPrefixName()

std::string sup::syssup::common::Generic::GetPrefixName ( ) const

Get subsystem name for logging purposes.

Returns

◆ GetScopeStr()

std::string sup::syssup::common::Generic::GetScopeStr ( ) const

Get subsystem scope as string.

Returns

◆ GetState()

elt::mal::future< std::string > sup::syssup::common::Generic::GetState ( )
overridevirtual

◆ GetStatus()

elt::mal::future< std::string > sup::syssup::common::Generic::GetStatus ( )
overridevirtual

◆ GetVersion()

elt::mal::future< std::string > sup::syssup::common::Generic::GetVersion ( )
overridevirtual

◆ Ignore()

void sup::syssup::common::Generic::Ignore ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a Ignore.

Parameters
[in]last_eventcontains the payload of the Ignore message.
Exceptions
anexception if an error ocurrs.

◆ Init()

elt::mal::future< std::string > sup::syssup::common::Generic::Init ( )
overridevirtual

Executes a Init command.

Returns
true if command is successfully executed, false otherwise.
Exceptions
anexception if an error ocurrs.

◆ IsDisabling()

bool sup::syssup::common::Generic::IsDisabling ( ) const
overridevirtual

Check if subsys is disablig.

Returns
true if subsys is disabling, false otherwise

◆ IsMsgForMe()

bool sup::syssup::common::Generic::IsMsgForMe ( const std::string &  id) const
protected

Check if received message id is addressed to me.

Parameters
[in]idmessage id
Returns
true is message id matches own subsys id, false otherwise.

◆ IsNotReady()

bool sup::syssup::common::Generic::IsNotReady ( ) const
overridevirtual

Check if subsys is Standby/NotReady.

Returns
true is subsys is Standby/NotReady, false otherwise

◆ IsOperational()

bool sup::syssup::common::Generic::IsOperational ( ) const
overridevirtual

Check if subsys is Operational.

Returns
true is subsys is Operational, false otherwise

◆ IsReady()

bool sup::syssup::common::Generic::IsReady ( ) const
overridevirtual

Check if subsys is Standby/Ready.

Returns
true is subsys is Standby/Ready, false otherwise

◆ Reset()

elt::mal::future< std::string > sup::syssup::common::Generic::Reset ( )
overridevirtual

Executes a Reset command.

Exceptions
anexception if an error ocurrs.

◆ SetAccess()

void sup::syssup::common::Generic::SetAccess ( const bool &  access)

◆ SetIgnore()

void sup::syssup::common::Generic::SetIgnore ( bool  flag)
protected

SetIgnore.

Parameters
flag

◆ Setup()

void sup::syssup::common::Generic::Setup ( const std::any &  payload)
overridevirtual

Executes a run time configuration.

Parameters
[in]payloadcontains the payload of the setup message.
Exceptions
anexception if an error ocurrs.

◆ StartSubscription()

void sup::syssup::common::Generic::StartSubscription ( )
overrideprotected

Start subscription of subsystem status.

◆ Status()

void sup::syssup::common::Generic::Status ( const std::string &  payload,
std::string &  buffer 
)
overridevirtual

Get subsystem status.

Parameters
[in,out]bufferReference to the buffer object.

◆ Stop()

elt::mal::future< std::string > sup::syssup::common::Generic::Stop ( )
overridevirtual

Executes a Stop command.

Exceptions
anexception if an error ocurrs.

◆ StopIgn()

void sup::syssup::common::Generic::StopIgn ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a StopIgn.

Parameters
[in]last_eventcontains the payload of the StopIgn message.
Exceptions
anexception if an error ocurrs.

◆ StopSubscription()

void sup::syssup::common::Generic::StopSubscription ( )
protected

Start subscription of subsystem status.

◆ SubsysDisable()

void sup::syssup::common::Generic::SubsysDisable ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware disable command.

Parameters
[in]last_eventpayload of the hw disable message
Exceptions
anexception if an error ocurrs.

◆ SubsysEnable()

void sup::syssup::common::Generic::SubsysEnable ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware enable command.

Parameters
[in]last_eventpayload of the hw enable message
Exceptions
anexception if an error ocurrs.

◆ SubsysInit()

void sup::syssup::common::Generic::SubsysInit ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware init command.

Parameters
[in]last_eventpayload of the hw init message
Exceptions
anexception if an error ocurrs.

◆ SubsysReset()

void sup::syssup::common::Generic::SubsysReset ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware reset command.

Parameters
[in]last_eventpayload of the hw reset message
Exceptions
anexception if an error ocurrs.

◆ UpdateConfig()

void sup::syssup::common::Generic::UpdateConfig ( )
overrideprotected

Update subsystem configuration.

◆ UpdateDb()

void sup::syssup::common::Generic::UpdateDb ( std::vector< std::string >  attr_vector)
protected

Update subsys database.

Parameters
attr_vectorList of attributes with their values.

Member Data Documentation

◆ m_config

Config& sup::syssup::common::Generic::m_config
protected

reference to the config object.

◆ m_connection_listener

elt::mal::rr::ListenerRegistration sup::syssup::common::Generic::m_connection_listener
protected

◆ m_data_ctx

DataContext& sup::syssup::common::Generic::m_data_ctx
protected

reference to the data context object.

◆ m_dispatcher

Dispatcher<stdif::StdCmdsAsync> sup::syssup::common::Generic::m_dispatcher
protected

◆ m_name

std::string sup::syssup::common::Generic::m_name
protected

name of the subsystem

◆ m_subscriber

std::unique_ptr<rad::cii::Subscriber<stdif::Status> > sup::syssup::common::Generic::m_subscriber
protected

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