rad  5.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
rad Namespace Reference

Namespaces

 cii
 
 core
 
 detail
 
 itest
 
 services
 
 utest
 
 utils
 

Classes

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

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 GetListOfKeysFromConfig (const elt::configng::CiiConfigInstanceNode &node, std::vector< std::string > &keys)
 
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 LogInitialize ()
 
void LogConfigure (const std::string &filename="")
 
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 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)
 
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_TRS_HEALTH_ENABLED = KEY_CONFIG + "trs_health_enabled"
 
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
 

Typedef Documentation

◆ ActionGroupList

◆ ActionList

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

◆ ActivityList

◆ SharedEvent

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

◆ TrsHealthBadEvent

◆ TrsHealthGoodEvent

◆ UniqueEvent

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

Enumeration Type Documentation

◆ ErrorCodes

enum 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" 
)
Parameters
logsink_filenameFilename for the logsink appender.
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 ( )
inline

◆ 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/3]

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/3]

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

◆ GetListOfKeysFromConfig() [3/3]

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

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

Parameters
nodeConfiguration instance node.
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").

◆ LogConfigure()

void rad::LogConfigure ( const std::string &  filename = "")

◆ LogEventFunction()

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

◆ LogFunction()

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

◆ LogInitialize()

void rad::LogInitialize ( )

◆ 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.

◆ ReqProcessEvent()

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

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

◆ TopicProcessEvent()

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

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

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_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_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:
= {
}
const std::string KEY_CONFIG_PROCNAME
Definition: config.hpp:38
const std::string KEY_CONFIG_VERSION
Definition: config.hpp:36
const std::string KEY_CONFIG_SM_APPEND
Definition: config.hpp:43
const std::string KEY_CONFIG_FILENAME
Definition: config.hpp:39
const std::string KEY_CONFIG_SM_SCXML
Definition: config.hpp:42
const std::string KEY_CONFIG_LOG_LEVEL
Definition: config.hpp:40
const std::string KEY_CONFIG_MODNAME
Definition: config.hpp:37
const std::string KEY_CONFIG_LOG_PROPERTIES
Definition: config.hpp:41
const std::string KEY_CONFIG_OLDB_URI_PREFIX
Definition: config.hpp:45
const std::string KEY_CONFIG_REQ_ENDPOINT
Definition: config.hpp:44

◆ 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"

◆ SM_LOGGER_NAME

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