rad 6.2.0
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
rad Namespace Reference

Namespaces

namespace  cii
 
namespace  detail
 
namespace  utest
 

Classes

class  ActionCallback
 
class  ActionGroup
 
class  ActionMgr
 
class  ActionsApp
 
class  ActionsStd
 
class  ActivityUpdateOldb
 
class  AnyEvent
 
class  AppCmdsImpl
 
class  Application
 
class  Config
 
class  ConfigurableActionGroup
 
class  ConfigurableActionMgr
 
class  ConfigurableActivity
 
class  ConfigurablePthreadActivity
 
class  CoroActivity
 
class  DataContext
 
class  DbAdapter
 
class  DbAdapterRedis
 
class  DoubleMap
 
class  ErrorCategory
 
struct  EventInfo
 
class  EventT
 
class  Exception
 Base class for the exceptions thrown by RAD and its users. More...
 
class  ExecutorActivity
 
class  GuardCallback
 
class  Helper
 
struct  IncorrectEventType
 
class  Logger
 
class  LogInitializer
 
class  MsgHandler
 
class  MsgReplier
 
class  MsgRequest
 
class  MsgRequestor
 
struct  MsgRequestor2
 
class  MsgRequestorRaw
 
struct  MsgRequestorRaw2
 
class  OldbAsyncWriter
 
class  OldbInterface
 
class  PthreadActivity
 
class  Signal
 
class  SMAdapter
 
class  SMEvent
 
class  SMRequestor
 
class  SMRequestorRaw
 
class  SMSubscriber
 
class  StdCmdsImpl
 
class  StopSource
 
class  StopToken
 
class  ThreadActivity
 
class  ThreadBaseActivity
 
class  Timer
 
class  TopicHandler
 
class  TopicPub
 
class  TopicSub
 
class  TrsHealth
 Adapter for ptpmond's TRS Health status to the state machine. More...
 
struct  TrsHealthBadEventTrait
 
struct  TrsHealthGoodEventTrait
 
class  Utils
 

Typedefs

using SharedEvent = std::shared_ptr<const AnyEvent>
 
using UniqueEvent = std::unique_ptr<AnyEvent>
 
typedef std::list< scxml4cpp::Action * > ActionList
 
typedef std::list< rad::ActionGroup * > ActionGroupList
 
typedef std::list< scxml4cpp::Activity * > ActivityList
 
using TrsHealthBadEvent = rad::EventT<TrsHealthBadEventTrait>
 
using TrsHealthGoodEvent = rad::EventT<TrsHealthGoodEventTrait>
 

Enumerations

enum class  ErrorCodes { CANCELLED = 0 , REPLY_TIMEOUT , DESERIALIZATION_ERR , UNKNOWN }
 
enum  LogLevel {
  LOG_LEVEL_UNKNOWN = -1 , LOG_LEVEL_ERROR = 0 , LOG_LEVEL_WARNING , LOG_LEVEL_STATE ,
  LOG_LEVEL_EVENT , LOG_LEVEL_GUARD , LOG_LEVEL_ACTION , LOG_LEVEL_INFO ,
  LOG_LEVEL_DEBUG , LOG_LEVEL_DEBUG1 , LOG_LEVEL_DEBUG2 , LOG_LEVEL_DEBUG3 ,
  LOG_LEVEL_DEBUG4 , LOG_LEVEL_TRACE
}
 

Functions

void GetListOfKeysFromConfig (const elt::configng::CiiConfigInstanceNode &node, const std::string &prefix, std::vector< std::string > &keys)
 
std::vector< std::string > GetListOfKeysFromConfig (const elt::configng::CiiConfigDocument &cfg_doc)
 
void Assert (bool condition, const char *filename, const char *functionname, int linenumber)
 
std::ostream & operator<< (std::ostream &os, const rad::Exception &e)
 
const ErrorCategoryGetErrorCategory ()
 
std::error_code make_error_code (rad::ErrorCodes e)
 
std::map< std::string, std::string > GetDefaultLogProperties (const std::string &logsink_filename, const std::string &log_level="ERROR")
 
log4cplus::Logger & GetLogger ()
 
log4cplus::Logger & GetSmLogger ()
 
log4cplus::Logger & GetAppLogger ()
 
log4cplus::Logger & GetRootLogger ()
 
void LogTraceFunction (const LogLevel level, const char *filename, const char *funcname, const int linenum)
 
void LogFunction (const LogLevel level, const char *funcname, const std::string &a)
 
void LogStateFunction (const std::string &a, const std::string &b)
 
void LogEventFunction (const std::string &a)
 
template<typename EVENT >
EVENT::payload_t & GetPayload (AnyEvent &ev)
 
template<typename EVENT >
EVENT::payload_t const & GetPayload (AnyEvent const &ev)
 
template<typename EVENT >
EVENT::payload_t * GetPayloadNothrow (AnyEvent &ev)
 
template<typename EVENT >
EVENT::payload_t const * GetPayloadNothrow (AnyEvent const &ev)
 
template<typename EventType >
EventType ParseRequestAndCreateEvent (const std::string &identity, const std::string &request_name, const void *msg, size_t msg_size)
 
template<typename EventType >
EventType ParseTopicAndCreateEvent (const std::string &topic_name, const void *msg, size_t msg_size)
 
template<class T , class... Args>
std::shared_ptr< T > MakeSharedFromTuple (std::tuple< Args... > &args)
 
template<typename T >
void DefaultRequestRejectHandler (const rad::AnyEvent &event, const std::string &state)
 
template<typename EVENT >
const EVENT & GetLastEvent (scxml4cpp::Context *c)
 
const rad::AnyEventGetLastAnyEvent (scxml4cpp::Context *c)
 
template<typename EVENT >
EVENT::payload_t & GetLastEventPayload (scxml4cpp::Context *c)
 
template<typename EVENT >
EVENT::payload_t const * GetLastEventPayloadNothrow (scxml4cpp::Context *c)
 

Variables

const char CONFIG_KEY_SEPARATOR_OLDB = '/'
 
const std::string KEY_CONFIG = "cfg/"
 
const std::string KEY_CONFIG_VERSION = KEY_CONFIG + "version"
 
const std::string KEY_CONFIG_MODNAME = KEY_CONFIG + "modname"
 
const std::string KEY_CONFIG_PROCNAME = KEY_CONFIG + "procname"
 
const std::string KEY_CONFIG_FILENAME = KEY_CONFIG + "filename"
 
const std::string KEY_CONFIG_LOG_LEVEL = KEY_CONFIG + "log_level"
 
const std::string KEY_CONFIG_LOG_PROPERTIES = KEY_CONFIG + "log_properties"
 
const std::string KEY_CONFIG_SM_SCXML = KEY_CONFIG + "sm_scxml"
 
const std::string KEY_CONFIG_SM_APPEND = KEY_CONFIG + "sm_scxml_append"
 
const std::string KEY_CONFIG_REQ_ENDPOINT = KEY_CONFIG + "req_endpoint"
 
const std::string KEY_CONFIG_OLDB_URI_PREFIX = KEY_CONFIG + "oldb_uri_prefix"
 
const std::string KEY_CONFIG_OLDB_CONN_TIMEOUT = KEY_CONFIG + "oldb_conn_timeout"
 
const std::string KEY_CONFIG_OLDB_ASYNC_PERIOD = KEY_CONFIG + "oldb_async_period"
 
const std::string KEY_CONFIG_TRS_HEALTH_ENABLED = KEY_CONFIG + "trs_health_enabled"
 
const std::string KEY_CONFIG_DDS_QOS_PROFILE = KEY_CONFIG + "dds_qos_profile"
 
const std::string KEY_CONFIG_DDS_QOS_PARTICIPANT = KEY_CONFIG + "dds_qos_participant"
 
const std::vector< std::string > KEYS_CONFIG
 
const std::string KEY_MON_STATE = "mon/state"
 
const std::string KEY_MON_TRS_HEALTH = "mon/trs/health"
 
const std::string KEY_MON_TRS_REASON = "mon/trs/reason"
 
const std::string LOGGER_NAME = "rad"
 
const std::string SM_LOGGER_NAME = "rad.sm"
 
const std::string APP_LOGGER_NAME = "app"
 
const int LOG_MAX_LEVEL = LOG_LEVEL_TRACE
 
const int LOG_MAX_LEN = 2048
 
const int LOG_TIMESTAMP_MAXLEN = 100
 
template<typename EventType >
std::function< void(const std::string &, const std::string &, const void *, size_t) ReqProcessEvent )(SMAdapter &sm)
 
template<typename EventType >
std::function< void(const std::string &, const void *, size_t) TopicProcessEvent )(SMAdapter &sm)
 

Typedef Documentation

◆ ActionGroupList

◆ ActionList

typedef std::list<scxml4cpp::Action*> rad::ActionList

◆ ActivityList

◆ SharedEvent

using rad::SharedEvent = std::shared_ptr<const AnyEvent>

◆ TrsHealthBadEvent

◆ TrsHealthGoodEvent

◆ UniqueEvent

using rad::UniqueEvent = std::unique_ptr<AnyEvent>

Enumeration Type Documentation

◆ ErrorCodes

enum class rad::ErrorCodes
strong
Enumerator
CANCELLED 
REPLY_TIMEOUT 
DESERIALIZATION_ERR 
UNKNOWN 

◆ LogLevel

Enumerator
LOG_LEVEL_UNKNOWN 
LOG_LEVEL_ERROR 
LOG_LEVEL_WARNING 
LOG_LEVEL_STATE 
LOG_LEVEL_EVENT 
LOG_LEVEL_GUARD 
LOG_LEVEL_ACTION 
LOG_LEVEL_INFO 
LOG_LEVEL_DEBUG 
LOG_LEVEL_DEBUG1 
LOG_LEVEL_DEBUG2 
LOG_LEVEL_DEBUG3 
LOG_LEVEL_DEBUG4 
LOG_LEVEL_TRACE 

Function Documentation

◆ Assert()

void rad::Assert ( bool condition,
const char * filename,
const char * functionname,
int linenumber )

This function logs a failed assertion when the condition parameter is false.

Parameters
[in]conditionCondition to verify.
[in]filenameAssertion's filename.
[in]functionnameAssetions's function name.
[in]linenumberAssetions's line.

◆ DefaultRequestRejectHandler()

template<typename T >
void rad::DefaultRequestRejectHandler ( const rad::AnyEvent & event,
const std::string & state )

This function can be used to send a "reject" reply to the originator of a request that cannot be handled in the current state.

Parameters
eventEvent related to the incoming request.
stateCurrent state retrieved from the SM engine.

◆ GetAppLogger()

log4cplus::Logger & rad::GetAppLogger ( )
Returns
a generic APP logger ("app").

◆ GetDefaultLogProperties()

std::map< std::string, std::string > rad::GetDefaultLogProperties ( const std::string & logsink_filename,
const std::string & log_level = "ERROR" )

This function returns a properties map that can be used to configure log4cplus/CII Log. The map configures the root logger to the given log level and two appenders: console and syslog. In addition, by passing the logsink_filename, it is possible to configure a third appender (logsink) to save the logs to the given file. Note that the logsink file will not be processed by CII Log service.

Parameters
logsink_filenameFilename for the logsink appender. The filename can include the path. Non existing directories in the path are created by log4cplus before checking the path with std::filesystem::path().
log_levelLog level for the root logger, default is "ERROR" (possible values are "TRACE", "DEBUG", "INFO", "WARN", "ERROR").
Returns
The default log properties to be used by the application at start-up for configuration.

◆ GetErrorCategory()

const ErrorCategory & rad::GetErrorCategory ( )
externinline

◆ GetLastAnyEvent()

const rad::AnyEvent & rad::GetLastAnyEvent ( scxml4cpp::Context * c)

◆ GetLastEvent()

template<typename EVENT >
const EVENT & rad::GetLastEvent ( scxml4cpp::Context * c)

◆ GetLastEventPayload()

template<typename EVENT >
EVENT::payload_t & rad::GetLastEventPayload ( scxml4cpp::Context * c)

◆ GetLastEventPayloadNothrow()

template<typename EVENT >
EVENT::payload_t const * rad::GetLastEventPayloadNothrow ( scxml4cpp::Context * c)

◆ GetListOfKeysFromConfig() [1/2]

std::vector< std::string > rad::GetListOfKeysFromConfig ( const elt::configng::CiiConfigDocument & cfg_doc)

Helper functions that retrieves the list of keys in a configuration document.

Parameters
cfg_docConfiguration doc.
Returns
List of keys in the given configuration document.

◆ GetListOfKeysFromConfig() [2/2]

void rad::GetListOfKeysFromConfig ( const elt::configng::CiiConfigInstanceNode & node,
const std::string & prefix,
std::vector< std::string > & keys )

Helper functions that retrieves the list of keys in a configuration document.

Parameters
nodeConfiguration instance node.
prefixEmpty string or prefix to be added to the node name.
keysReturned list of keys in the given configuration document.

◆ GetLogger()

log4cplus::Logger & rad::GetLogger ( )
Returns
the main RAD library logger ("rad").

◆ GetPayload() [1/2]

template<typename EVENT >
EVENT::payload_t & rad::GetPayload ( AnyEvent & ev)

Access the payload in a type-safe manner.

Returns
A reference to the payload if the EVENT matches the contained event.
Exceptions
IncorrectEventTypeif EVENT does not match the contained event.

Example:

auto ev = make_event<MyEvent>(new std::string("hello world"));
auto& payload = ev.getPayload<MyEvent>();

◆ GetPayload() [2/2]

template<typename EVENT >
EVENT::payload_t const & rad::GetPayload ( AnyEvent const & ev)

Const version of getPayload();

◆ GetPayloadNothrow() [1/2]

template<typename EVENT >
EVENT::payload_t * rad::GetPayloadNothrow ( AnyEvent & ev)

Access the payload in a type-safe manner.

Returns
A pointer to the payload if the EVENT matches the contained event and nullptr otherwise.

Example:

auto ev = make_event<MyEvent>(new std::string("hello world"));
auto payload = ev.GetPayload<MyEvent>();

◆ GetPayloadNothrow() [2/2]

template<typename EVENT >
EVENT::payload_t const * rad::GetPayloadNothrow ( AnyEvent const & ev)

Const version of GetPayloadNothrow()

◆ GetRootLogger()

log4cplus::Logger & rad::GetRootLogger ( )
Returns
the log4cplus root logger.

◆ GetSmLogger()

log4cplus::Logger & rad::GetSmLogger ( )
Returns
the RAD library logger specialized for the State Machine adapter ("rad.sm").

◆ LogEventFunction()

void rad::LogEventFunction ( const std::string & a)
inline

◆ LogFunction()

void rad::LogFunction ( const LogLevel level,
const char * funcname,
const std::string & a )
inline

◆ LogStateFunction()

void rad::LogStateFunction ( const std::string & a,
const std::string & b )
inline

◆ LogTraceFunction()

void rad::LogTraceFunction ( const LogLevel level,
const char * filename,
const char * funcname,
const int linenum )
inline

◆ make_error_code()

std::error_code rad::make_error_code ( rad::ErrorCodes e)
inline

Overload the global make_error_code() free function with our custom enum.

◆ MakeSharedFromTuple()

template<class T , class... Args>
std::shared_ptr< T > rad::MakeSharedFromTuple ( std::tuple< Args... > & args)

◆ operator<<()

std::ostream & rad::operator<< ( std::ostream & os,
const rad::Exception & e )

◆ ParseRequestAndCreateEvent()

template<typename EventType >
EventType rad::ParseRequestAndCreateEvent ( const std::string & identity,
const std::string & request_name,
const void * msg,
size_t msg_size )

Parses a request and create the corresponding event.

Parameters
[in]identityRequest identity.
[in]request_nameRequest name.
[in]msgPointer to the payload.
[in]msg_sizeSize of the payload.

◆ ParseTopicAndCreateEvent()

template<typename EventType >
EventType rad::ParseTopicAndCreateEvent ( const std::string & topic_name,
const void * msg,
size_t msg_size )

Parses a topic and create the corresponding event.

Parameters
[in]topic_nameTopic name.
[in]msgPointer to the payload.
[in]msg_sizeSize of the payload.

Variable Documentation

◆ APP_LOGGER_NAME

const std::string rad::APP_LOGGER_NAME = "app"

◆ CONFIG_KEY_SEPARATOR_OLDB

const char rad::CONFIG_KEY_SEPARATOR_OLDB = '/'

◆ KEY_CONFIG

const std::string rad::KEY_CONFIG = "cfg/"

Common application configuration parameters.

◆ KEY_CONFIG_DDS_QOS_PARTICIPANT

const std::string rad::KEY_CONFIG_DDS_QOS_PARTICIPANT = KEY_CONFIG + "dds_qos_participant"

◆ KEY_CONFIG_DDS_QOS_PROFILE

const std::string rad::KEY_CONFIG_DDS_QOS_PROFILE = KEY_CONFIG + "dds_qos_profile"

◆ KEY_CONFIG_FILENAME

const std::string rad::KEY_CONFIG_FILENAME = KEY_CONFIG + "filename"

◆ KEY_CONFIG_LOG_LEVEL

const std::string rad::KEY_CONFIG_LOG_LEVEL = KEY_CONFIG + "log_level"

◆ KEY_CONFIG_LOG_PROPERTIES

const std::string rad::KEY_CONFIG_LOG_PROPERTIES = KEY_CONFIG + "log_properties"

◆ KEY_CONFIG_MODNAME

const std::string rad::KEY_CONFIG_MODNAME = KEY_CONFIG + "modname"

◆ KEY_CONFIG_OLDB_ASYNC_PERIOD

const std::string rad::KEY_CONFIG_OLDB_ASYNC_PERIOD = KEY_CONFIG + "oldb_async_period"

◆ KEY_CONFIG_OLDB_CONN_TIMEOUT

const std::string rad::KEY_CONFIG_OLDB_CONN_TIMEOUT = KEY_CONFIG + "oldb_conn_timeout"

◆ KEY_CONFIG_OLDB_URI_PREFIX

const std::string rad::KEY_CONFIG_OLDB_URI_PREFIX = KEY_CONFIG + "oldb_uri_prefix"

◆ KEY_CONFIG_PROCNAME

const std::string rad::KEY_CONFIG_PROCNAME = KEY_CONFIG + "procname"

◆ KEY_CONFIG_REQ_ENDPOINT

const std::string rad::KEY_CONFIG_REQ_ENDPOINT = KEY_CONFIG + "req_endpoint"

◆ KEY_CONFIG_SM_APPEND

const std::string rad::KEY_CONFIG_SM_APPEND = KEY_CONFIG + "sm_scxml_append"

◆ KEY_CONFIG_SM_SCXML

const std::string rad::KEY_CONFIG_SM_SCXML = KEY_CONFIG + "sm_scxml"

◆ KEY_CONFIG_TRS_HEALTH_ENABLED

const std::string rad::KEY_CONFIG_TRS_HEALTH_ENABLED = KEY_CONFIG + "trs_health_enabled"

◆ KEY_CONFIG_VERSION

const std::string rad::KEY_CONFIG_VERSION = KEY_CONFIG + "version"

◆ KEY_MON_STATE

const std::string rad::KEY_MON_STATE = "mon/state"

◆ KEY_MON_TRS_HEALTH

const std::string rad::KEY_MON_TRS_HEALTH = "mon/trs/health"

◆ KEY_MON_TRS_REASON

const std::string rad::KEY_MON_TRS_REASON = "mon/trs/reason"

◆ KEYS_CONFIG

const std::vector<std::string> rad::KEYS_CONFIG
Initial value:
= {
KEY_CONFIG_FILENAME,
KEY_CONFIG_LOG_LEVEL,
KEY_CONFIG_LOG_PROPERTIES,
KEY_CONFIG_SM_SCXML,
KEY_CONFIG_REQ_ENDPOINT,
KEY_CONFIG_DDS_QOS_PROFILE,
}
const std::string KEY_CONFIG_PROCNAME
Definition config.hpp:40
const std::string KEY_CONFIG_VERSION
Definition config.hpp:38
const std::string KEY_CONFIG_SM_APPEND
Definition config.hpp:45
const std::string KEY_CONFIG_DDS_QOS_PARTICIPANT
Definition config.hpp:52
const std::string KEY_CONFIG_OLDB_ASYNC_PERIOD
Definition config.hpp:49
const std::string KEY_CONFIG_TRS_HEALTH_ENABLED
Definition config.hpp:50
const std::string KEY_CONFIG_OLDB_CONN_TIMEOUT
Definition config.hpp:48
const std::string KEY_CONFIG_MODNAME
Definition config.hpp:39
const std::string KEY_CONFIG_OLDB_URI_PREFIX
Definition config.hpp:47

◆ LOG_MAX_LEN

const int rad::LOG_MAX_LEN = 2048

◆ LOG_MAX_LEVEL

const int rad::LOG_MAX_LEVEL = LOG_LEVEL_TRACE

◆ LOG_TIMESTAMP_MAXLEN

const int rad::LOG_TIMESTAMP_MAXLEN = 100

◆ LOGGER_NAME

const std::string rad::LOGGER_NAME = "rad"

◆ ReqProcessEvent

template<typename EventType >
std::function< void(const std::string &, const std::string &, const void *, size_t) rad::ReqProcessEvent) (SMAdapter &sm) ( SMAdapter & sm)

Function that creates a request handler to forward events to the SM

◆ SM_LOGGER_NAME

const std::string rad::SM_LOGGER_NAME = "rad.sm"

◆ TopicProcessEvent

template<typename EventType >
std::function< void(const std::string &, const void *, size_t) rad::TopicProcessEvent) (SMAdapter &sm) ( SMAdapter & sm)

Function that creates a topic handler to forward events to the SM