ifw-slm 0.1.2
 
Loading...
Searching...
No Matches
ifw::slm Namespace Reference

Namespaces

namespace  detail
 

Classes

class  ActionMgr
 
class  ActionsLM
 
class  ActionsLoopClose
 
class  ActionsLoopSuspended
 
class  ActionsRunning
 
class  Application
 
class  BaseLoopActions
 
class  BaseLoopCloseActions
 
class  BaseLoopExecuteActivity
 
class  BaseLoopSuspendedActions
 
class  BlockingActivity
 
class  Config
 
class  CustomLoopAction
 
class  DataContext
 
class  KillableThreadActivity
 
class  LoopCompletionHandler
 Interface for handling loop completion events. More...
 
class  LoopCompletionHandlerImpl
 Concrete implementation of LoopCompletionHandler. More...
 
class  LoopStateData
 
class  MalRequestLoopActivity
 
class  OldbInterface
 
class  SecondaryLoopManagerCmdsImpl
 
class  ServiceResolver
 
class  TestableBaseLoopActions
 
class  TestableBaseLoopCloseActions
 
class  TestableBaseLoopSuspendedActions
 
class  TestableExecuteActivity
 Minimal concrete activity; DoExecute() is never run by these tests. More...
 
class  TestableLoop1Suspended
 
class  TestActionMgr
 
class  TestActionsLM
 
class  TestActionsLoopCloseHelpers
 
class  TestActionsRunning
 Test fixture for ActionsRunning. More...
 
class  TestActivity
 
class  TestBaseLoopActions
 
class  TestBaseLoopCloseActions
 
class  TestBaseLoopSuspendedActions
 
class  TestKillableActivity
 
class  TestLoopCompletionHandler
 Test fixture for LoopCompletionHandler. More...
 
class  TestLoopExecuteActivityParams
 
class  TestLoopStateData
 
class  TestSlConfig
 Test fixture for slConfig. More...
 
class  TestSuspendedActions
 Test fixture for suspended actions. More...
 

Typedefs

using LoopCloseFactory
 
using ActionsLoop1CloseLoop = ActionsLoopClose<1>
 
using ActionsLoop2CloseLoop = ActionsLoopClose<2>
 
using ActionsLoop3CloseLoop = ActionsLoopClose<3>
 
using ActionsLoop4CloseLoop = ActionsLoopClose<4>
 
using ActionsLoop5CloseLoop = ActionsLoopClose<5>
 
using ActionsLoop6CloseLoop = ActionsLoopClose<6>
 
using ActionsLoop7CloseLoop = ActionsLoopClose<7>
 
using ActionsLoop8CloseLoop = ActionsLoopClose<8>
 
using ActionsLoop9CloseLoop = ActionsLoopClose<9>
 
using ActionsLoop1S = ActionsLoopSuspended<1>
 
using ActionsLoop2S = ActionsLoopSuspended<2>
 
using ActionsLoop3S = ActionsLoopSuspended<3>
 
using ActionsLoop4S = ActionsLoopSuspended<4>
 
using ActionsLoop5S = ActionsLoopSuspended<5>
 
using ActionsLoop6S = ActionsLoopSuspended<6>
 
using ActionsLoop7S = ActionsLoopSuspended<7>
 
using ActionsLoop8S = ActionsLoopSuspended<8>
 
using ActionsLoop9S = ActionsLoopSuspended<9>
 

Enumerations

enum  LoopState { SL_OPEN = 1 , SL_CLOSED = 2 , SL_SUSPENDED = 3 }
 
enum  SlIndex {
  SL_1 = 1 , SL_2 , SL_3 , SL_4 ,
  SL_5 , SL_6 , SL_7 , SL_8 ,
  SL_9
}
 

Functions

template<int LOOP_INDEX>
void CreateCloseLoopTimer (boost::asio::io_context &ios, rad::SMAdapter &sm, std::unique_ptr< rad::Timer > &timer, int period_sec)
 
rad::UniqueEvent MakeTriggerEvent (int loop_index)
 
log4cplus::Logger & GetLogger ()
 
std::unique_ptr< LoopCompletionHandlerCreateLoopCompletionHandler (rad::Application &appl)
 Factory function to create LoopCompletionHandler instances.
 
void ResetAllLoopStates (OldbInterface &oldb, const rad::Config &config)
 
std::string GetLoopOldbKey (int loop_index, const std::string &param_name)
 
std::string ResolveEndpoint (const std::string &spec, const ServiceResolver &resolver, const std::string &name_space=ServiceResolver::DefaultNamespace())
 
std::string GetLoopConfigKey (int loop_index, const std::string &param_name)
 
std::string GetLoopOldbKey (const std::string &prefix, int loop_index, const std::string &param_name)
 
int GetNumSecondaryLoops (const rad::Config &config)
 
std::vector< int > GetEnabledLoopIndices (const rad::Config &config)
 
std::string GetLoopParam (const rad::Config &config, int loop_index, const std::string &param_name)
 
bool IsLoopEnabled (const rad::Config &config, int loop_index)
 
void DecomposeStatus (const std::string &sm_status, std::string &state, std::string &substate)
 
std::string ToSupervisorSubstate (const std::string &substate)
 
std::string FormatSupervisorStatus (const std::string &sm_status)
 
bool TryGetLoopVectorParam (const rad::Config &config, int loop_index, const std::string &param_name, std::string &out)
 
template<typename T>
GetLoopParamFromConfig (const rad::Config &config, int loop_index, const std::string &name)
 
template<typename T>
GetLoopParamFromConfig (const rad::Config &config, int loop_index, const std::string &name, const T &default_value)
 As above, returning default_value when the parameter is absent.
 
void LoadLoopParamsIntoConfig (rad::Config &config, const std::string &config_filename="")
 
 TEST_F (TestActionMgr, Ctor)
 
 TEST_F (TestActionMgr, CreateActions)
 
 TEST_F (TestActionMgr, CreateLoopCloseAction_OutOfRange)
 
 TEST_F (TestActionMgr, CreateLoopCloseAction_ValidRange)
 
 TEST_F (TestActionMgr, RegisterLoopCloseActionFactory)
 
 TEST_F (TestActionMgr, RegisterLoopExecuteActivityFactory)
 
 TEST_F (TestActionsLM, ActionGroupsExist)
 
 TEST_F (TestActionsLM, CloseLoopNoEventHandlesGracefully)
 
 TEST_F (TestActionsLM, OpenLoopNoEventHandlesGracefully)
 
 TEST_F (TestActionsLM, ResumeLoopNoEventHandlesGracefully)
 
 TEST_F (TestActionsLM, SuspendLoopNoEventHandlesGracefully)
 
 TEST_F (TestActionsLM, RunSlmNoEventHandlesGracefully)
 
 TEST_F (TestActionsLM, StopSlmNoEventHandlesGracefully)
 
 TEST_F (TestActionsLM, AllLoopCommandsHandleNullContext)
 
 TEST_F (TestActionsLoopCloseHelpers, MakeTriggerEventValidRange)
 
 TEST_F (TestActionsLoopCloseHelpers, MakeTriggerEventInvalidLow)
 
 TEST_F (TestActionsLoopCloseHelpers, MakeTriggerEventInvalidHigh)
 
 TEST_F (TestActionsLoopCloseHelpers, MakeTriggerEventNegative)
 
 TEST_F (TestActionsLoopCloseHelpers, TypeAliasesDistinct)
 
 TEST_F (TestActionsLoopCloseHelpers, CreateWithDefaultConfig)
 
 TEST_F (TestActionsRunning, GroupHasExpectedId)
 The action group reports the expected id.
 
 TEST_F (TestActionsRunning, CompleteIsCallable)
 Complete() (Running onentry hook) runs without throwing.
 
 TEST_F (TestActionsRunning, AbortResetsLoopsWithoutThrowing)
 Abort() (Running onexit hook) resets all enabled loops without throwing, exercising ResetAllLoopStates over the configured loops.
 
 TEST_F (TestBaseLoopActions, InitSetsOpen)
 
 TEST_F (TestBaseLoopActions, ExecuteCallsOnCycleStart)
 
 TEST_F (TestBaseLoopActions, CompleteResetsErrors)
 
 TEST_F (TestBaseLoopActions, AbortSetsError)
 
 TEST_F (TestBaseLoopCloseActions, ExecuteSetsClosedAndStartsCycle)
 
 TEST_F (TestBaseLoopCloseActions, CompleteResetsErrors)
 
 TEST_F (TestBaseLoopCloseActions, AbortDoesNotSetError)
 
 TEST_F (TestBaseLoopCloseActions, CycleErrorBelowThresholdIncrementsButDoesNotTripStop)
 
 TEST_F (TestBaseLoopCloseActions, CycleErrorAtThresholdTripsStopGuard)
 
 TEST_F (TestBaseLoopSuspendedActions, ExecuteSuspendsWithoutError)
 
 TEST_F (TestBaseLoopSuspendedActions, CompleteResetsErrors)
 
 TEST_F (TestBaseLoopSuspendedActions, AbortDoesNotSetError)
 
 TEST_F (TestLoopExecuteActivityParams, ReadsConfiguredVectorStringParams)
 
 TEST_F (TestLoopExecuteActivityParams, UnknownParamFallsBackToDefault)
 
 TEST_F (TestLoopExecuteActivityParams, ReadsPlainScalarLoopKeys)
 
 TEST_F (TestKillableActivity, IsThreadJoinedBeforeStart)
 
 TEST_F (TestKillableActivity, StartAndJoinNormal)
 
 TEST_F (TestKillableActivity, MultipleStartStopCycles)
 
 TEST_F (TestKillableActivity, DetachOnKill)
 
 TEST_F (TestKillableActivity, GetNativeHandleAfterStart)
 
 TEST_F (TestLoopCompletionHandler, CreateHandler)
 Test that CreateLoopCompletionHandler returns a valid handler.
 
 TEST_F (TestLoopCompletionHandler, SignalSuccessValidRange)
 Test that SignalSuccess works for valid loop indices (1-9)
 
 TEST_F (TestLoopCompletionHandler, SignalSuccessOutOfRange)
 Test that SignalSuccess throws for out-of-range indices.
 
 TEST_F (TestLoopCompletionHandler, SignalErrorValidRange)
 Test that SignalError works for valid loop indices (1-9)
 
 TEST_F (TestLoopCompletionHandler, SignalErrorOutOfRange)
 Test that SignalError throws for out-of-range indices.
 
 TEST_F (TestLoopStateData, InitialState)
 
 TEST_F (TestLoopStateData, SetActiveSetsClosed)
 
 TEST_F (TestLoopStateData, SetInactiveSetsOpen)
 
 TEST_F (TestLoopStateData, SetStateSuspended)
 
 TEST_F (TestLoopStateData, SetStateClosed)
 
 TEST_F (TestLoopStateData, CycleUpdateDoesNotAffectErrorCount)
 
 TEST_F (TestLoopStateData, SetFailIncrementsOnTrue)
 
 TEST_F (TestLoopStateData, SetFailResetsOnFalse)
 
 TEST_F (TestLoopStateData, CheckStopWithMaxErrors)
 
 TEST_F (TestLoopStateData, CheckStopWithZeroMaxErrors)
 
 TEST_F (TestLoopStateData, CheckStopWithOneMaxError)
 
 TEST_F (TestLoopStateData, SetValueAndGetValue)
 
 TEST_F (TestLoopStateData, CycleResetClearsErrorCount)
 
 TEST_F (TestLoopStateData, MultipleLoopsIndependentState)
 
 TEST (TestServiceResolver, ResolvesNomadFirstInstance)
 
 TEST (TestServiceResolver, HonoursScheme)
 
 TEST (TestServiceResolver, FallsBackToConsulWhenNomadEmpty)
 
 TEST (TestServiceResolver, ThrowsWhenNeitherResolves)
 
 TEST (TestServiceResolver, ResolveEndpointPassesThroughLiteralUri)
 
 TEST (TestServiceResolver, ResolveEndpointResolvesServiceAndAppendsPath)
 
 TEST (TestServiceResolver, ResolveEndpointServiceWithoutPath)
 
 TEST_F (TestSlConfig, GetNumSecondaryLoops_Default)
 Test that GetNumSecondaryLoops returns 0 for empty config.
 
 TEST_F (TestSlConfig, IsLoopEnabled_Default)
 Test that IsLoopEnabled returns false when loop is not configured.
 
 TEST_F (TestSlConfig, GetEnabledLoopIndices_Default)
 Test that GetEnabledLoopIndices returns empty for empty config.
 
 TEST_F (TestSlConfig, GetLoopParam)
 Test GetLoopParam retrieval with default empty config.
 
 TEST_F (TestSlConfig, GetNumSecondaryLoops_OneEnabled)
 Test with a populated config (1 enabled loop)
 
 TEST_F (TestSlConfig, IsLoopEnabled_Configured)
 Test IsLoopEnabled with a populated config.
 
 TEST_F (TestSlConfig, GetEnabledLoopIndices_WithEnabled)
 Test GetEnabledLoopIndices returns only enabled loops.
 
 TEST_F (TestSlConfig, GetNumSecondaryLoops_TwoEnabled)
 Test GetNumSecondaryLoops with 2 enabled loops.
 
 TEST_F (TestSlConfig, GetLoopParam_Configured)
 Test GetLoopParam with configured parameter.
 
 TEST_F (TestSlConfig, DecomposeStatus_StatesAndSubstates)
 DecomposeStatus maps SM status paths to state/substate, incl. Running.
 
 TEST_F (TestSlConfig, ToSupervisorSubstate_Mapping)
 ToSupervisorSubstate maps Running -> Idle and passes others through.
 
 TEST_F (TestSlConfig, FormatSupervisorStatus_WireFormat)
 FormatSupervisorStatus emits the STD interface "<state>;<substate>".
 
 TEST_F (TestSlConfig, DecomposeStatus_ErrorAndDefaults)
 DecomposeStatus maps an Error path and falls back to Off/Idle.
 
 TEST_F (TestSlConfig, GetEnabledLoopIndices_StopsAtGap)
 GetEnabledLoopIndices stops at the first unconfigured loop.
 
 TEST_F (TestSlConfig, GetLoopParam_VectorStringEntries)
 "params/<name>" lookups resolve to the configured value.
 
 TEST_F (TestSlConfig, TryGetLoopVectorParam_AndTypedConversion)
 TryGetLoopVectorParam reports found/not-found and ignores non-params names; the typed GetLoopParamFromConfig converts the parsed value.
 
 TEST_F (TestSuspendedActions, CreateLoop1SuspendedActions)
 The factory creates a suspended action group for loop 1.
 
 TEST_F (TestSuspendedActions, CreateLoopSuspendedActions_ValidRange)
 The factory creates a suspended action group for every loop (1-9).
 
 TEST_F (TestSuspendedActions, ExecuteMarksSuspendedWithoutError)
 Execute() (entering Suspended) marks the loop SUSPENDED and is not a cycle error.
 
 TEST_F (TestSuspendedActions, AbortDoesNotCountAsError)
 Abort() (Resume/Open) is a clean transition: it must not increment the consecutive-error count.
 
 TEST_F (TestSuspendedActions, CompleteResetsErrors)
 Complete() clears a pending error count.
 

Variables

const std::string CONFIG_DEFAULT_VERSION = std::string(VERSION)
 
const std::string CONFIG_DEFAULT_MODNAME = "slm"
 
const std::string CONFIG_DEFAULT_PROCNAME = "ifw-slm"
 
const std::string CONFIG_DEFAULT_FILENAME = "config/ifw/slm/config.yaml"
 
const std::string CONFIG_DEFAULT_SCXML_FILENAME = "config/ifw/slm/sm.xml"
 
const std::string CONFIG_DEFAULT_SCXML_APPEND = ""
 
const std::string CONFIG_DEFAULT_LOG_LEVEL = "INFO"
 
const std::string CONFIG_DEFAULT_LOG_PROPERTIES = "config/ifw/slm/log.properties"
 
const std::string CONFIG_DEFAULT_REQ_ENDPOINT = "zpb.rr://127.0.0.1:12081/"
 
const std::string CONFIG_DEFAULT_PUB_ENDPOINT = "zpb.ps://127.0.0.1:12082/"
 
const std::string CONFIG_DEFAULT_OLDB_URI_PREFIX = "cii.oldb:/elt/xxx/"
 
constexpr auto KEY_CONFIG_PUB_ENDPOINT = "server/pub_endpoint"
 
const int CONFIG_DEFAULT_LOOP_PERIOD_SEC = 60
 
const int CONFIG_DEFAULT_OLDB_CONN_TIMEOUT = 1
 
const int CONFIG_DEFAULT_OLDB_ASYNC_PERIOD = 1000
 
const bool CONFIG_DEFAULT_TRS_HEALTH_ENABLED = false
 
const std::string LOGGER_NAME = "ifwslm"
 
const std::string KEY_SL_NUM_IN_USE = "config/SL_inUse"
 
const int SL_MAX_NUM = 9
 
const std::string SL_DB_NUM_IN_USE = "config/SL_inUse"
 
const std::string SL_KEY_LOOP_NUM = "sl/loop_num"
 
const std::string SL_KEY_LOOP_PREFIX = "sl/loop/"
 
const std::string SL_KEY_ACTIVE = "active"
 
const std::string SL_KEY_STATE = "state"
 
const std::string SL_KEY_CYCLE_COUNTER = "cycle_counter"
 
const std::string SL_KEY_CYCLE_LAST_SUCCESS = "cycle_last_success"
 
const std::string SL_KEY_CYCLE_LAST = "cycle_last"
 
const std::string SL_KEY_CYCLE_START = "cycle_start"
 
const std::string SL_KEY_CYCLE_FAILURE = "cycle_failure"
 
const std::string SL_KEY_CYCLE_NERRORS = "cycle_nerrors"
 
const std::string SL_KEY_CYCLE_NSUCCESS = "cycle_nsuccess"
 
const std::string SL_KEY_CYCLE_VALUE = "cycle_value"
 
const std::string SL_KEY_CYCLE_LAST_ERROR = "cycle_last_error"
 
const std::string SL_KEY_TIMER_PERIOD_SEC = "timer_period_sec"
 

Typedef Documentation

◆ ActionsLoop1CloseLoop

◆ ActionsLoop1S

◆ ActionsLoop2CloseLoop

◆ ActionsLoop2S

◆ ActionsLoop3CloseLoop

◆ ActionsLoop3S

◆ ActionsLoop4CloseLoop

◆ ActionsLoop4S

◆ ActionsLoop5CloseLoop

◆ ActionsLoop5S

◆ ActionsLoop6CloseLoop

◆ ActionsLoop6S

◆ ActionsLoop7CloseLoop

◆ ActionsLoop7S

◆ ActionsLoop8CloseLoop

◆ ActionsLoop8S

◆ ActionsLoop9CloseLoop

◆ ActionsLoop9S

◆ LoopCloseFactory

Initial value:
BaseLoopCloseActions* (*)(const std::string&, rad::Application&,
rad::ConfigurableActionMgr&, DataContext&,
int, std::shared_ptr<LoopCompletionHandler>)
Definition baseLoopActions.hpp:299
Definition dataContext.hpp:29

Enumeration Type Documentation

◆ LoopState

Loop state enum values (matching legacy AOO)

Enumerator
SL_OPEN 
SL_CLOSED 
SL_SUSPENDED 

◆ SlIndex

Secondary Loop indices (for use in SCXML state names).

Enumerator
SL_1 
SL_2 
SL_3 
SL_4 
SL_5 
SL_6 
SL_7 
SL_8 
SL_9 

Function Documentation

◆ CreateCloseLoopTimer()

template<int LOOP_INDEX>
void ifw::slm::CreateCloseLoopTimer ( boost::asio::io_context & ios,
rad::SMAdapter & sm,
std::unique_ptr< rad::Timer > & timer,
int period_sec )
inline

◆ CreateLoopCompletionHandler()

std::unique_ptr< LoopCompletionHandler > ifw::slm::CreateLoopCompletionHandler ( rad::Application & appl)

Factory function to create LoopCompletionHandler instances.

Parameters
applReference to RAD application
Returns
Unique pointer to LoopCompletionHandler instance

◆ DecomposeStatus()

void ifw::slm::DecomposeStatus ( const std::string & sm_status,
std::string & state,
std::string & substate )

Decompose a hierarchical state-machine status path (e.g. "On::Operational::Running:...") into a summarized ELT state/substate pair.

Parameters
sm_statusFull SM status path as returned by Application::GetStatus().
state[out] Summarized state ("Operational", "NotOperational", "Off").
substate[out] Summarized substate ("Running", "Idle", "Ready", "NotReady", "Error").

◆ FormatSupervisorStatus()

std::string ifw::slm::FormatSupervisorStatus ( const std::string & sm_status)

Build the STD interface status string "<state>;<substate>" that the ELT Supervisor understands, from a raw SM status path.

Parameters
sm_statusFull SM status path as returned by Application::GetStatus().
Returns
e.g. "Operational;Idle", "NotOperational;NotReady".

◆ GetEnabledLoopIndices()

std::vector< int > ifw::slm::GetEnabledLoopIndices ( const rad::Config & config)

Get the list of enabled loop indices from configuration.

Parameters
configReference to the configuration object
Returns
Vector of loop indices (1-based)

◆ GetLogger()

log4cplus::Logger & ifw::slm::GetLogger ( )

◆ GetLoopConfigKey()

std::string ifw::slm::GetLoopConfigKey ( int loop_index,
const std::string & param_name )

Get the full configuration key for a secondary loop parameter.

Parameters
loop_indexLoop index (1-based)
param_nameParameter name (e.g., "event_name", "cmd_name")
Returns
Full configuration key (e.g., "server/sl/loop[0]/event_name")

◆ GetLoopOldbKey() [1/2]

std::string ifw::slm::GetLoopOldbKey ( const std::string & prefix,
int loop_index,
const std::string & param_name )

Get the OLDB key for a secondary loop parameter.

Parameters
loop_indexLoop index (1-based)
param_nameParameter name (e.g., "event_name", "cmd_name")
Returns
Full OLDB key (e.g., "cii.oldb:///elt/ifwslm/sl/loop[1]/event_name")

◆ GetLoopOldbKey() [2/2]

std::string ifw::slm::GetLoopOldbKey ( int loop_index,
const std::string & param_name )

Get the full OLDB key for a secondary loop parameter.

Parameters
loop_indexLoop index (1-based)
param_nameParameter name (e.g., "event_name", "cmd_name")
Returns
Full OLDB key (e.g., "sl/loop/1/event_name")

◆ GetLoopParam()

std::string ifw::slm::GetLoopParam ( const rad::Config & config,
int loop_index,
const std::string & param_name )

Get loop parameter value from configuration.

Parameters
configReference to the configuration object
loop_indexLoop index (1-based)
param_nameParameter name
Returns
Parameter value as string

◆ GetLoopParamFromConfig() [1/2]

template<typename T>
T ifw::slm::GetLoopParamFromConfig ( const rad::Config & config,
int loop_index,
const std::string & name )
inline

Read a per-loop configuration parameter, transparently handling "params/<name>" entries stored in the vector_string params node.

Exceptions
ifname is not a params entry and the key is absent (mirrors rad::Config::GetParam). Use the defaulted overload to avoid throwing.

◆ GetLoopParamFromConfig() [2/2]

template<typename T>
T ifw::slm::GetLoopParamFromConfig ( const rad::Config & config,
int loop_index,
const std::string & name,
const T & default_value )
inline

As above, returning default_value when the parameter is absent.

◆ GetNumSecondaryLoops()

int ifw::slm::GetNumSecondaryLoops ( const rad::Config & config)

Read the number of secondary loops from configuration.

Parameters
configReference to the configuration object
Returns
Number of secondary loops (default 1 if not configured)

◆ IsLoopEnabled()

bool ifw::slm::IsLoopEnabled ( const rad::Config & config,
int loop_index )

Check if a loop is enabled in configuration.

Parameters
configReference to the configuration object
loop_indexLoop index (1-based)
Returns
True if loop is enabled

◆ LoadLoopParamsIntoConfig()

void ifw::slm::LoadLoopParamsIntoConfig ( rad::Config & config,
const std::string & config_filename = "" )

Retained for API/backward compatibility. Per-loop params are now resolved on read by TryGetLoopVectorParam / GetLoopParamFromConfig, so there is no longer any flattening to perform here (and config-ng rejects writing params/<name> into the vector_string node). This is now a no-op.

Parameters
configConfiguration object (unused).
config_filenameUnused.

◆ MakeTriggerEvent()

rad::UniqueEvent ifw::slm::MakeTriggerEvent ( int loop_index)
inline

◆ ResetAllLoopStates()

void ifw::slm::ResetAllLoopStates ( OldbInterface & oldb,
const rad::Config & config )

Reset every enabled loop to the OPEN state and clear its cycle counters in OLDB.

Used when the SLM leaves the Running state (StopSlm / Stop / Disable) so the reported loop state no longer shows stale CLOSED loops.

Parameters
oldbOLDB interface to write through.
configConfiguration used to determine the enabled loops.

◆ ResolveEndpoint()

std::string ifw::slm::ResolveEndpoint ( const std::string & spec,
const ServiceResolver & resolver,
const std::string & name_space = ServiceResolver::DefaultNamespace() )

Resolve a configured endpoint spec into a literal MAL URI.

  • If spec already contains "://" it is a literal URI and returned as-is (backward compatible).
  • Otherwise it is parsed as "service[/path]": service is resolved through resolver and the optional "/path" suffix is appended. e.g. "fcs-req/AppCmds" -> "zpb.rr://10.0.0.5:25376/AppCmds".

◆ TEST() [1/7]

ifw::slm::TEST ( TestServiceResolver ,
FallsBackToConsulWhenNomadEmpty  )

◆ TEST() [2/7]

ifw::slm::TEST ( TestServiceResolver ,
HonoursScheme  )

◆ TEST() [3/7]

ifw::slm::TEST ( TestServiceResolver ,
ResolveEndpointPassesThroughLiteralUri  )

◆ TEST() [4/7]

ifw::slm::TEST ( TestServiceResolver ,
ResolveEndpointResolvesServiceAndAppendsPath  )

◆ TEST() [5/7]

ifw::slm::TEST ( TestServiceResolver ,
ResolveEndpointServiceWithoutPath  )

◆ TEST() [6/7]

ifw::slm::TEST ( TestServiceResolver ,
ResolvesNomadFirstInstance  )

◆ TEST() [7/7]

ifw::slm::TEST ( TestServiceResolver ,
ThrowsWhenNeitherResolves  )

◆ TEST_F() [1/83]

ifw::slm::TEST_F ( TestActionMgr ,
CreateActions  )

◆ TEST_F() [2/83]

ifw::slm::TEST_F ( TestActionMgr ,
CreateLoopCloseAction_OutOfRange  )

◆ TEST_F() [3/83]

ifw::slm::TEST_F ( TestActionMgr ,
CreateLoopCloseAction_ValidRange  )

◆ TEST_F() [4/83]

ifw::slm::TEST_F ( TestActionMgr ,
Ctor  )

◆ TEST_F() [5/83]

ifw::slm::TEST_F ( TestActionMgr ,
RegisterLoopCloseActionFactory  )

◆ TEST_F() [6/83]

ifw::slm::TEST_F ( TestActionMgr ,
RegisterLoopExecuteActivityFactory  )

◆ TEST_F() [7/83]

ifw::slm::TEST_F ( TestActionsLM ,
ActionGroupsExist  )

◆ TEST_F() [8/83]

ifw::slm::TEST_F ( TestActionsLM ,
AllLoopCommandsHandleNullContext  )

◆ TEST_F() [9/83]

ifw::slm::TEST_F ( TestActionsLM ,
CloseLoopNoEventHandlesGracefully  )

◆ TEST_F() [10/83]

ifw::slm::TEST_F ( TestActionsLM ,
OpenLoopNoEventHandlesGracefully  )

◆ TEST_F() [11/83]

ifw::slm::TEST_F ( TestActionsLM ,
ResumeLoopNoEventHandlesGracefully  )

◆ TEST_F() [12/83]

ifw::slm::TEST_F ( TestActionsLM ,
RunSlmNoEventHandlesGracefully  )

◆ TEST_F() [13/83]

ifw::slm::TEST_F ( TestActionsLM ,
StopSlmNoEventHandlesGracefully  )

◆ TEST_F() [14/83]

ifw::slm::TEST_F ( TestActionsLM ,
SuspendLoopNoEventHandlesGracefully  )

◆ TEST_F() [15/83]

ifw::slm::TEST_F ( TestActionsLoopCloseHelpers ,
CreateWithDefaultConfig  )

Test creating ActionsLoopClose in a minimal context. This verifies that construction with default config works and the timer is created without crashing.

◆ TEST_F() [16/83]

ifw::slm::TEST_F ( TestActionsLoopCloseHelpers ,
MakeTriggerEventInvalidHigh  )

◆ TEST_F() [17/83]

ifw::slm::TEST_F ( TestActionsLoopCloseHelpers ,
MakeTriggerEventInvalidLow  )

◆ TEST_F() [18/83]

ifw::slm::TEST_F ( TestActionsLoopCloseHelpers ,
MakeTriggerEventNegative  )

◆ TEST_F() [19/83]

ifw::slm::TEST_F ( TestActionsLoopCloseHelpers ,
MakeTriggerEventValidRange  )

◆ TEST_F() [20/83]

ifw::slm::TEST_F ( TestActionsLoopCloseHelpers ,
TypeAliasesDistinct  )

◆ TEST_F() [21/83]

ifw::slm::TEST_F ( TestActionsRunning ,
AbortResetsLoopsWithoutThrowing  )

Abort() (Running onexit hook) resets all enabled loops without throwing, exercising ResetAllLoopStates over the configured loops.

◆ TEST_F() [22/83]

ifw::slm::TEST_F ( TestActionsRunning ,
CompleteIsCallable  )

Complete() (Running onentry hook) runs without throwing.

◆ TEST_F() [23/83]

ifw::slm::TEST_F ( TestActionsRunning ,
GroupHasExpectedId  )

The action group reports the expected id.

◆ TEST_F() [24/83]

ifw::slm::TEST_F ( TestBaseLoopActions ,
AbortSetsError  )

◆ TEST_F() [25/83]

ifw::slm::TEST_F ( TestBaseLoopActions ,
CompleteResetsErrors  )

◆ TEST_F() [26/83]

ifw::slm::TEST_F ( TestBaseLoopActions ,
ExecuteCallsOnCycleStart  )

◆ TEST_F() [27/83]

ifw::slm::TEST_F ( TestBaseLoopActions ,
InitSetsOpen  )

◆ TEST_F() [28/83]

ifw::slm::TEST_F ( TestBaseLoopCloseActions ,
AbortDoesNotSetError  )

◆ TEST_F() [29/83]

ifw::slm::TEST_F ( TestBaseLoopCloseActions ,
CompleteResetsErrors  )

◆ TEST_F() [30/83]

ifw::slm::TEST_F ( TestBaseLoopCloseActions ,
CycleErrorAtThresholdTripsStopGuard  )

◆ TEST_F() [31/83]

ifw::slm::TEST_F ( TestBaseLoopCloseActions ,
CycleErrorBelowThresholdIncrementsButDoesNotTripStop  )

◆ TEST_F() [32/83]

ifw::slm::TEST_F ( TestBaseLoopCloseActions ,
ExecuteSetsClosedAndStartsCycle  )

◆ TEST_F() [33/83]

ifw::slm::TEST_F ( TestBaseLoopSuspendedActions ,
AbortDoesNotSetError  )

◆ TEST_F() [34/83]

ifw::slm::TEST_F ( TestBaseLoopSuspendedActions ,
CompleteResetsErrors  )

◆ TEST_F() [35/83]

ifw::slm::TEST_F ( TestBaseLoopSuspendedActions ,
ExecuteSuspendsWithoutError  )

◆ TEST_F() [36/83]

ifw::slm::TEST_F ( TestKillableActivity ,
DetachOnKill  )

◆ TEST_F() [37/83]

ifw::slm::TEST_F ( TestKillableActivity ,
GetNativeHandleAfterStart  )

◆ TEST_F() [38/83]

ifw::slm::TEST_F ( TestKillableActivity ,
IsThreadJoinedBeforeStart  )

◆ TEST_F() [39/83]

ifw::slm::TEST_F ( TestKillableActivity ,
MultipleStartStopCycles  )

◆ TEST_F() [40/83]

ifw::slm::TEST_F ( TestKillableActivity ,
StartAndJoinNormal  )

◆ TEST_F() [41/83]

ifw::slm::TEST_F ( TestLoopCompletionHandler ,
CreateHandler  )

Test that CreateLoopCompletionHandler returns a valid handler.

◆ TEST_F() [42/83]

ifw::slm::TEST_F ( TestLoopCompletionHandler ,
SignalErrorOutOfRange  )

Test that SignalError throws for out-of-range indices.

◆ TEST_F() [43/83]

ifw::slm::TEST_F ( TestLoopCompletionHandler ,
SignalErrorValidRange  )

Test that SignalError works for valid loop indices (1-9)

◆ TEST_F() [44/83]

ifw::slm::TEST_F ( TestLoopCompletionHandler ,
SignalSuccessOutOfRange  )

Test that SignalSuccess throws for out-of-range indices.

◆ TEST_F() [45/83]

ifw::slm::TEST_F ( TestLoopCompletionHandler ,
SignalSuccessValidRange  )

Test that SignalSuccess works for valid loop indices (1-9)

◆ TEST_F() [46/83]

ifw::slm::TEST_F ( TestLoopExecuteActivityParams ,
ReadsConfiguredVectorStringParams  )

◆ TEST_F() [47/83]

ifw::slm::TEST_F ( TestLoopExecuteActivityParams ,
ReadsPlainScalarLoopKeys  )

◆ TEST_F() [48/83]

ifw::slm::TEST_F ( TestLoopExecuteActivityParams ,
UnknownParamFallsBackToDefault  )

◆ TEST_F() [49/83]

ifw::slm::TEST_F ( TestLoopStateData ,
CheckStopWithMaxErrors  )

◆ TEST_F() [50/83]

ifw::slm::TEST_F ( TestLoopStateData ,
CheckStopWithOneMaxError  )

◆ TEST_F() [51/83]

ifw::slm::TEST_F ( TestLoopStateData ,
CheckStopWithZeroMaxErrors  )

◆ TEST_F() [52/83]

ifw::slm::TEST_F ( TestLoopStateData ,
CycleResetClearsErrorCount  )

◆ TEST_F() [53/83]

ifw::slm::TEST_F ( TestLoopStateData ,
CycleUpdateDoesNotAffectErrorCount  )

◆ TEST_F() [54/83]

ifw::slm::TEST_F ( TestLoopStateData ,
InitialState  )

◆ TEST_F() [55/83]

ifw::slm::TEST_F ( TestLoopStateData ,
MultipleLoopsIndependentState  )

◆ TEST_F() [56/83]

ifw::slm::TEST_F ( TestLoopStateData ,
SetActiveSetsClosed  )

◆ TEST_F() [57/83]

ifw::slm::TEST_F ( TestLoopStateData ,
SetFailIncrementsOnTrue  )

◆ TEST_F() [58/83]

ifw::slm::TEST_F ( TestLoopStateData ,
SetFailResetsOnFalse  )

◆ TEST_F() [59/83]

ifw::slm::TEST_F ( TestLoopStateData ,
SetInactiveSetsOpen  )

◆ TEST_F() [60/83]

ifw::slm::TEST_F ( TestLoopStateData ,
SetStateClosed  )

◆ TEST_F() [61/83]

ifw::slm::TEST_F ( TestLoopStateData ,
SetStateSuspended  )

◆ TEST_F() [62/83]

ifw::slm::TEST_F ( TestLoopStateData ,
SetValueAndGetValue  )

◆ TEST_F() [63/83]

ifw::slm::TEST_F ( TestSlConfig ,
DecomposeStatus_ErrorAndDefaults  )

DecomposeStatus maps an Error path and falls back to Off/Idle.

Error must win over the Ready/NotReady/Running checks (order matters), and an unrecognized/empty path must yield the default Off/Idle pair.

◆ TEST_F() [64/83]

ifw::slm::TEST_F ( TestSlConfig ,
DecomposeStatus_StatesAndSubstates  )

DecomposeStatus maps SM status paths to state/substate, incl. Running.

◆ TEST_F() [65/83]

ifw::slm::TEST_F ( TestSlConfig ,
FormatSupervisorStatus_WireFormat  )

FormatSupervisorStatus emits the STD interface "<state>;<substate>".

Regression guard: the Supervisor boost::splits both the std/status topic and the GetStatus reply on ';' and looks each half up in its own state/substate bimaps (ifw-sup states.hpp). A different separator collapses the reply into a single unmatched token and the subsystem reports as "Undefined / Undefined". The substate must also be in the Supervisor vocabulary, i.e. "Running" is reported as "Idle" here even though OLDB keeps "Running".

◆ TEST_F() [66/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetEnabledLoopIndices_Default  )

Test that GetEnabledLoopIndices returns empty for empty config.

◆ TEST_F() [67/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetEnabledLoopIndices_StopsAtGap  )

GetEnabledLoopIndices stops at the first unconfigured loop.

The scanner assumes a contiguous loop array: loop 1 is enabled, loop 2 has no enable key, so scanning stops and loop 3 (even if enabled) is not returned.

◆ TEST_F() [68/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetEnabledLoopIndices_WithEnabled  )

Test GetEnabledLoopIndices returns only enabled loops.

◆ TEST_F() [69/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetLoopParam  )

Test GetLoopParam retrieval with default empty config.

◆ TEST_F() [70/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetLoopParam_Configured  )

Test GetLoopParam with configured parameter.

◆ TEST_F() [71/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetLoopParam_VectorStringEntries  )

"params/<name>" lookups resolve to the configured value.

params is a vector_string ("name=value" entries) in the SlmServer typedef. GetLoopParam / TryGetLoopVectorParam resolve a "params/<name>" request by parsing that vector (config-ng cannot store it as a flattened map key), so the configured value is returned rather than a default. A bare entry (no '=') resolves to an empty string.

◆ TEST_F() [72/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetNumSecondaryLoops_Default  )

Test that GetNumSecondaryLoops returns 0 for empty config.

◆ TEST_F() [73/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetNumSecondaryLoops_OneEnabled  )

Test with a populated config (1 enabled loop)

◆ TEST_F() [74/83]

ifw::slm::TEST_F ( TestSlConfig ,
GetNumSecondaryLoops_TwoEnabled  )

Test GetNumSecondaryLoops with 2 enabled loops.

◆ TEST_F() [75/83]

ifw::slm::TEST_F ( TestSlConfig ,
IsLoopEnabled_Configured  )

Test IsLoopEnabled with a populated config.

◆ TEST_F() [76/83]

ifw::slm::TEST_F ( TestSlConfig ,
IsLoopEnabled_Default  )

Test that IsLoopEnabled returns false when loop is not configured.

◆ TEST_F() [77/83]

ifw::slm::TEST_F ( TestSlConfig ,
ToSupervisorSubstate_Mapping  )

ToSupervisorSubstate maps Running -> Idle and passes others through.

◆ TEST_F() [78/83]

ifw::slm::TEST_F ( TestSlConfig ,
TryGetLoopVectorParam_AndTypedConversion  )

TryGetLoopVectorParam reports found/not-found and ignores non-params names; the typed GetLoopParamFromConfig converts the parsed value.

◆ TEST_F() [79/83]

ifw::slm::TEST_F ( TestSuspendedActions ,
AbortDoesNotCountAsError  )

Abort() (Resume/Open) is a clean transition: it must not increment the consecutive-error count.

◆ TEST_F() [80/83]

ifw::slm::TEST_F ( TestSuspendedActions ,
CompleteResetsErrors  )

Complete() clears a pending error count.

◆ TEST_F() [81/83]

ifw::slm::TEST_F ( TestSuspendedActions ,
CreateLoop1SuspendedActions  )

The factory creates a suspended action group for loop 1.

◆ TEST_F() [82/83]

ifw::slm::TEST_F ( TestSuspendedActions ,
CreateLoopSuspendedActions_ValidRange  )

The factory creates a suspended action group for every loop (1-9).

◆ TEST_F() [83/83]

ifw::slm::TEST_F ( TestSuspendedActions ,
ExecuteMarksSuspendedWithoutError  )

Execute() (entering Suspended) marks the loop SUSPENDED and is not a cycle error.

◆ ToSupervisorSubstate()

std::string ifw::slm::ToSupervisorSubstate ( const std::string & substate)

Translate an SLM substate into the vocabulary recognized by the ELT Supervisor (ifw-sup states.hpp). The Supervisor does not know "Running", so it is reported as "Idle" (operational and available) on the std/status topic. Recognized substates are passed through unchanged.

Note: the OLDB sm/status/substate key keeps the original substate (e.g. "Running") so the GUI can gate loop commands on it; the wire formats (the std/status topic and the GetStatus reply) use this mapping.

◆ TryGetLoopVectorParam()

bool ifw::slm::TryGetLoopVectorParam ( const rad::Config & config,
int loop_index,
const std::string & param_name,
std::string & out )

Resolve a "params/<name>" entry by parsing the per-loop params vector_string ("name=value" entries) directly from configuration.

params is declared vector_string in the SlmServer typedef, i.e. a YAML sequence node. config-ng does not allow adding a named (map) child such as params/<name> to a sequence node, so the value must be read back by parsing the vector rather than by a flattened map key.

Parameters
configConfiguration object.
loop_indexLoop index (1-based).
param_nameParameter name; only names starting with "params/" are resolved here (anything else returns false).
out[out] The resolved value (empty for a bare "name" entry).
Returns
true if param_name is a "params/<name>" lookup that was found.

Variable Documentation

◆ CONFIG_DEFAULT_FILENAME

const std::string ifw::slm::CONFIG_DEFAULT_FILENAME = "config/ifw/slm/config.yaml"

◆ CONFIG_DEFAULT_LOG_LEVEL

const std::string ifw::slm::CONFIG_DEFAULT_LOG_LEVEL = "INFO"

◆ CONFIG_DEFAULT_LOG_PROPERTIES

const std::string ifw::slm::CONFIG_DEFAULT_LOG_PROPERTIES = "config/ifw/slm/log.properties"

◆ CONFIG_DEFAULT_LOOP_PERIOD_SEC

const int ifw::slm::CONFIG_DEFAULT_LOOP_PERIOD_SEC = 60

◆ CONFIG_DEFAULT_MODNAME

const std::string ifw::slm::CONFIG_DEFAULT_MODNAME = "slm"

◆ CONFIG_DEFAULT_OLDB_ASYNC_PERIOD

const int ifw::slm::CONFIG_DEFAULT_OLDB_ASYNC_PERIOD = 1000

◆ CONFIG_DEFAULT_OLDB_CONN_TIMEOUT

const int ifw::slm::CONFIG_DEFAULT_OLDB_CONN_TIMEOUT = 1

◆ CONFIG_DEFAULT_OLDB_URI_PREFIX

const std::string ifw::slm::CONFIG_DEFAULT_OLDB_URI_PREFIX = "cii.oldb:/elt/xxx/"

◆ CONFIG_DEFAULT_PROCNAME

const std::string ifw::slm::CONFIG_DEFAULT_PROCNAME = "ifw-slm"

◆ CONFIG_DEFAULT_PUB_ENDPOINT

const std::string ifw::slm::CONFIG_DEFAULT_PUB_ENDPOINT = "zpb.ps://127.0.0.1:12082/"

◆ CONFIG_DEFAULT_REQ_ENDPOINT

const std::string ifw::slm::CONFIG_DEFAULT_REQ_ENDPOINT = "zpb.rr://127.0.0.1:12081/"

◆ CONFIG_DEFAULT_SCXML_APPEND

const std::string ifw::slm::CONFIG_DEFAULT_SCXML_APPEND = ""

◆ CONFIG_DEFAULT_SCXML_FILENAME

const std::string ifw::slm::CONFIG_DEFAULT_SCXML_FILENAME = "config/ifw/slm/sm.xml"

◆ CONFIG_DEFAULT_TRS_HEALTH_ENABLED

const bool ifw::slm::CONFIG_DEFAULT_TRS_HEALTH_ENABLED = false

◆ CONFIG_DEFAULT_VERSION

const std::string ifw::slm::CONFIG_DEFAULT_VERSION = std::string(VERSION)

Default application configuration values.

◆ KEY_CONFIG_PUB_ENDPOINT

auto ifw::slm::KEY_CONFIG_PUB_ENDPOINT = "server/pub_endpoint"
constexpr

◆ KEY_SL_NUM_IN_USE

const std::string ifw::slm::KEY_SL_NUM_IN_USE = "config/SL_inUse"

◆ LOGGER_NAME

const std::string ifw::slm::LOGGER_NAME = "ifwslm"

◆ SL_DB_NUM_IN_USE

const std::string ifw::slm::SL_DB_NUM_IN_USE = "config/SL_inUse"

OLDB attribute name for storing the number of secondary loops in use.

◆ SL_KEY_ACTIVE

const std::string ifw::slm::SL_KEY_ACTIVE = "active"

◆ SL_KEY_CYCLE_COUNTER

const std::string ifw::slm::SL_KEY_CYCLE_COUNTER = "cycle_counter"

◆ SL_KEY_CYCLE_FAILURE

const std::string ifw::slm::SL_KEY_CYCLE_FAILURE = "cycle_failure"

◆ SL_KEY_CYCLE_LAST

const std::string ifw::slm::SL_KEY_CYCLE_LAST = "cycle_last"

◆ SL_KEY_CYCLE_LAST_ERROR

const std::string ifw::slm::SL_KEY_CYCLE_LAST_ERROR = "cycle_last_error"

◆ SL_KEY_CYCLE_LAST_SUCCESS

const std::string ifw::slm::SL_KEY_CYCLE_LAST_SUCCESS = "cycle_last_success"

◆ SL_KEY_CYCLE_NERRORS

const std::string ifw::slm::SL_KEY_CYCLE_NERRORS = "cycle_nerrors"

◆ SL_KEY_CYCLE_NSUCCESS

const std::string ifw::slm::SL_KEY_CYCLE_NSUCCESS = "cycle_nsuccess"

◆ SL_KEY_CYCLE_START

const std::string ifw::slm::SL_KEY_CYCLE_START = "cycle_start"

◆ SL_KEY_CYCLE_VALUE

const std::string ifw::slm::SL_KEY_CYCLE_VALUE = "cycle_value"

◆ SL_KEY_LOOP_NUM

const std::string ifw::slm::SL_KEY_LOOP_NUM = "sl/loop_num"

Per-loop configuration keys (sl is nested under server: in config-ng):

  • server/sl/loop[0]/event_name
  • server/sl/loop[0]/cmd_name
  • server/sl/loop[0]/env_name
  • server/sl/loop[0]/proc_name
  • server/sl/loop[0]/enable
  • server/sl/loop[0]/max_errors
  • server/sl/loop[0]/period_sec
  • server/sl/loop[0]/params/<name>

◆ SL_KEY_LOOP_PREFIX

const std::string ifw::slm::SL_KEY_LOOP_PREFIX = "sl/loop/"

◆ SL_KEY_STATE

const std::string ifw::slm::SL_KEY_STATE = "state"

◆ SL_KEY_TIMER_PERIOD_SEC

const std::string ifw::slm::SL_KEY_TIMER_PERIOD_SEC = "timer_period_sec"

◆ SL_MAX_NUM

const int ifw::slm::SL_MAX_NUM = 9

Maximum number of secondary loops supported. Note: This value should match the enum values in this file.