Public Member Functions | Protected Attributes | Private Attributes
beliefstate::Beliefstate Class Reference

#include <Beliefstate.h>

Inheritance diagram for beliefstate::Beliefstate:
Inheritance graph
[legend]

List of all members.

Public Member Functions

std::string baseDataDirectory ()
 Beliefstate (int argc, char **argv)
 Constructor of the main belief state system class.
bool cycle ()
 Main cycle method, maintaining core functionality for the system.
Result deinit ()
 Deinitialization method for the belief state system.
std::string findPrefixPath (std::string strPathList, std::string strMatchingSuffix, std::string strDelimiter=":")
virtual std::string findTokenReplacement (std::string strToken)
bool handleUnhandledEvent (Event evEvent)
std::string homeDirectory ()
 Returns the current user's home directory.
Result init (std::string strConfigFile="")
 Main initialization method for the belief state system.
bool loadConfigFile (std::string strConfigFile)
 Loads the specified configuration file.
bool loadIndividualPluginConfigurationBranch (libconfig::Setting &sBranch, CKeyValuePair *ckvpInto, std::string strConfigPath="", bool bIgnorePluginField=false)
 Loads the plugin-specific configuration portion of the configuration file.
std::string resolveDirectoryTokens (std::string strPath)
void setBaseDataDirectory (std::string strBaseDataDirectory)
bool spreadEvent (Event evEvent)
 Spreads incoming system events to all subscribing plugins.
void spreadServiceEvent (ServiceEvent seServiceEvent)
 Spread incoming system service events to all subscribing plugins.
void triggerShutdown ()
 Triggers the belief state system shutdown.
void triggerTerminalResize ()
 Triggers the processing of a terminal resize event.
std::string version ()
 Returns the current version of the belief state system software.
virtual std::string workspaceDirectory ()
 Returns the current set workspace directory.
 ~Beliefstate ()
 Destructor of the main belief state system class.

Protected Attributes

std::list< std::string > m_lstConfigFileLocations

Private Attributes

int m_argc
 Internal copy of the global argc parameter holding the number of command line parameters supplied when starting the system. This parameter, together with m_argv, is handed to all plugins during initialization.
char ** m_argv
 Internal copy of the global argv parameter holding the command line parameter values supplied when starting the system. This parameter, together with m_argc, is handed to all plugins during initialization.
bool m_bCommandLineOutput
 Flag that signals whether command line output should be printed or not.
bool m_bOnlyDisplayImportant
 Flag that signals whether all, or only important messages should be printed to the console.
bool m_bRun
 Flag representing the current run state of the main loop cycle. If true, the main loop will continue to run; if false, will stop execution of the main loop and quit.
bool m_bTerminalWindowResize
 Flag that signals whether the terminal window is currently being resized.
std::list< Eventm_lstGlobalEvents
 List of currently available global events to process. The entries in this list only last one cycle of the main loop. They are dropped afterwards, but are handed to all plugins that subscribed to the respective event type beforehand. This is the main communication mechanism between the belief state system and loaded plugins.
std::list< std::string > m_lstPluginsToLoad
 List of plugins to load. This list is populated by the plugins/load configuration section in the configuration file.
std::mutex m_mtxTerminalResize
 Mutex that controls whether terminal window resizes are currently being processed.
PluginSystemm_psPlugins
 Internal pointer to the PluginSystem class instance used for loading and managing plugin instances.
std::string m_strVersion
 Variable holding the current version of the belief state system core software.
std::string m_strWorkspaceDirectory
 In case a static workspace directory was specified in the configuration file, its value is stored here. This value, if not empty, takes precedence over the dynamically resolved return value of workspaceDirectory().

Detailed Description

Definition at line 64 of file Beliefstate.h.


Constructor & Destructor Documentation

beliefstate::Beliefstate::Beliefstate ( int  argc,
char **  argv 
)

Constructor of the main belief state system class.

Parameters:
argcThe main argc variable supplied to main(), holding the number of available command line parameters issues when running the system.
argvThe main argv variable supplied to main(), holding the actual available command line parameters issues when running the system.

Definition at line 44 of file Beliefstate.cpp.

Destructor of the main belief state system class.

Deletes all instances of internal objects.

Definition at line 62 of file Beliefstate.cpp.


Member Function Documentation

Definition at line 706 of file Beliefstate.cpp.

Main cycle method, maintaining core functionality for the system.

The main cycle function triggers processing of event pipelines, and forwards messages between plugins, utilizing functions present in the beliefstate class. This function is being called from outside the function in a loop.

Returns:
Boolean signallig whether the current cycle completed successfully, or if there was a problem that needs further inspection.

Definition at line 531 of file Beliefstate.cpp.

Deinitialization method for the belief state system.

Dummy deinitialization method, does not deinitialize any components. Implemented for the sake of completeness and to make subclassing easier in which actual deinitialization mechanisms might occur.

Returns:
Result construct, describing the outcome of the operation

Definition at line 143 of file Beliefstate.cpp.

std::string beliefstate::Beliefstate::findPrefixPath ( std::string  strPathList,
std::string  strMatchingSuffix,
std::string  strDelimiter = ":" 
)

Definition at line 814 of file Beliefstate.cpp.

std::string beliefstate::Beliefstate::findTokenReplacement ( std::string  strToken) [virtual]

Reimplemented in beliefstate::BeliefstateROS.

Definition at line 788 of file Beliefstate.cpp.

Definition at line 798 of file Beliefstate.cpp.

Returns the current user's home directory.

Returns whatever is stored in the environmental variable '${HOME}'.

Definition at line 715 of file Beliefstate.cpp.

Result beliefstate::Beliefstate::init ( std::string  strConfigFile = "")

Main initialization method for the belief state system.

Initializes the default search paths for configuration files, creates instances for the PluginSystem and triggers the loading of configuration files and plugins (as configured).

Parameters:
strConfigFileOverrides the default plugin search mechanism and uses the file specified in this parameter. If this fails, the function falls back to the default mechanism.
Returns:
Result construct, describing the outcome of the operation

Definition at line 69 of file Beliefstate.cpp.

bool beliefstate::Beliefstate::loadConfigFile ( std::string  strConfigFile)

Loads the specified configuration file.

Loads the libconfig-styled configuration file specified in the parameter. Will update all components in the main belief state system instance that are affected by the configured options.

Parameters:
strConfigFileConfiguration file path to open for loading configuration
Returns:
Boolean that signals whether loading of the specified configuration file succeeded or failed.

Definition at line 153 of file Beliefstate.cpp.

bool beliefstate::Beliefstate::loadIndividualPluginConfigurationBranch ( libconfig::Setting &  sBranch,
CKeyValuePair ckvpInto,
std::string  strConfigPath = "",
bool  bIgnorePluginField = false 
)

Loads the plugin-specific configuration portion of the configuration file.

Every named plugin can be configured individually from the main configuration file. This function (recursively) evaluates the specified options to allow for arbitrary tree-like configuration of every plugin.

Parameters:
sBranchThe libconfig Setting which denotes the current configuration group for the current plugin.
ckvpIntoThe CKeyValuePair instance into which the loaded configuration branch should be parsed.
strConfigPathThe current path in the nested configuration groups. This is for displaying nice output only.
bIgnorePluginFieldIgnore the 'plugin' field in the current branch. This is only used on the first level, as that level holds the plugin name of the plugin to configure.
Returns:
Boolean that signals whether loading of the individjal plugin configuration branch succeeded or failed.

Definition at line 391 of file Beliefstate.cpp.

std::string beliefstate::Beliefstate::resolveDirectoryTokens ( std::string  strPath)

Definition at line 726 of file Beliefstate.cpp.

void beliefstate::Beliefstate::setBaseDataDirectory ( std::string  strBaseDataDirectory)

Definition at line 700 of file Beliefstate.cpp.

Spreads incoming system events to all subscribing plugins.

System events are being accumulated in the system event queue within the main Beliefstate class instance. They are then distributed among the plugins that subscribed to their specific event type.

Parameters:
evEventThe event to spread among subscribers
Returns:
Boolean signalling whether at least one subscriber consumes the event.

Definition at line 483 of file Beliefstate.cpp.

Spread incoming system service events to all subscribing plugins.

System service events are special events that require a reply from potential receivers. This function spreads a service event request, and its corresponding reply, to the respective plugin instances.

Parameters:
seServiceEventThe service event to spread among subscribers (and receivers of replies).

Definition at line 507 of file Beliefstate.cpp.

Triggers the belief state system shutdown.

Sets the m_bRun class member to false, effectively letting the main loop cycle() method stop execution and return from its blocking call.

Definition at line 690 of file Beliefstate.cpp.

Triggers the processing of a terminal resize event.

Definition at line 694 of file Beliefstate.cpp.

Returns the current version of the belief state system software.

The version string can contain a version number, and additional content, describing the exact version present.

Returns:
Software version string

Definition at line 65 of file Beliefstate.cpp.

Returns the current set workspace directory.

The workspace directory is a globally set path that can be used as a reference point for directory tokens. It is referenced as $WORKSPACE. In this function, the directory manually set in the config.cfg file is returned, or an empty string if it is not set there.

Reimplemented in beliefstate::BeliefstateROS.

Definition at line 711 of file Beliefstate.cpp.


Member Data Documentation

Internal copy of the global argc parameter holding the number of command line parameters supplied when starting the system. This parameter, together with m_argv, is handed to all plugins during initialization.

Definition at line 77 of file Beliefstate.h.

Internal copy of the global argv parameter holding the command line parameter values supplied when starting the system. This parameter, together with m_argc, is handed to all plugins during initialization.

Definition at line 82 of file Beliefstate.h.

Flag that signals whether command line output should be printed or not.

Definition at line 113 of file Beliefstate.h.

Flag that signals whether all, or only important messages should be printed to the console.

Reimplemented from beliefstate::UtilityBase.

Definition at line 116 of file Beliefstate.h.

Flag representing the current run state of the main loop cycle. If true, the main loop will continue to run; if false, will stop execution of the main loop and quit.

Definition at line 72 of file Beliefstate.h.

Flag that signals whether the terminal window is currently being resized.

Definition at line 110 of file Beliefstate.h.

std::list<std::string> beliefstate::Beliefstate::m_lstConfigFileLocations [protected]

Definition at line 122 of file Beliefstate.h.

List of currently available global events to process. The entries in this list only last one cycle of the main loop. They are dropped afterwards, but are handed to all plugins that subscribed to the respective event type beforehand. This is the main communication mechanism between the belief state system and loaded plugins.

Definition at line 93 of file Beliefstate.h.

std::list<std::string> beliefstate::Beliefstate::m_lstPluginsToLoad [private]

List of plugins to load. This list is populated by the plugins/load configuration section in the configuration file.

Definition at line 86 of file Beliefstate.h.

Mutex that controls whether terminal window resizes are currently being processed.

Terminal resize events can be received very qickly after another. When one of these events is being processed, it should not be interrupted by a new event following it, as system calls and non-thread-safe operations are involved.

Definition at line 107 of file Beliefstate.h.

Internal pointer to the PluginSystem class instance used for loading and managing plugin instances.

Definition at line 68 of file Beliefstate.h.

Variable holding the current version of the belief state system core software.

Definition at line 119 of file Beliefstate.h.

In case a static workspace directory was specified in the configuration file, its value is stored here. This value, if not empty, takes precedence over the dynamically resolved return value of workspaceDirectory().

Definition at line 98 of file Beliefstate.h.


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


beliefstate
Author(s): Jan Winkler
autogenerated on Sun Oct 5 2014 22:30:16