MIRA
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
Framework Class Reference

This class represents the core element of a modular application. More...

#include <fw/Framework.h>

Inheritance diagram for Framework:
Inheritance graph
[legend]

Public Types

typedef ProtecteeMixin< MetaTypeDatabaseProtecteeDatabase
 
typedef Base::Type Type
 

Public Member Functions

 Framework (int argc, char **argv, bool startImmediately=false)
 Constructor that takes command line arguments and a flag. More...
 
 Framework (const std::vector< std::string > &args, bool startImmediately=false)
 Constructor that takes command line arguments as a vector and a flag. More...
 
virtual ~Framework ()
 
template<typename Reflector >
void reflect (Reflector &r)
 Reflect method for serialization. More...
 
boost::shared_ptr< PropertyNodegetProperties ()
 
void load (XMLDom &xml)
 Loads the specified XML configuration and applies all registered Loaders on it. More...
 
void load (const std::string &configFile)
 Opens the specified XML configuration file and applies all registered Loaders on it. More...
 
void load ()
 Loads configuration files given on command line if any by calling above load(const std::string& configFile) function. More...
 
void start ()
 Starts the framework and it's remote component (if one was configured or created) and returns immediately. More...
 
bool isStarted () const
 Return true if framework is started. More...
 
Duration getUptime () const
 Return duration since started. More...
 
virtual int exec ()
 Executes the framework and blocks until the framework is terminated, e.g. More...
 
virtual void requestTermination (int exitcode=0)
 Requests the termination of the framework and hence the whole application. More...
 
virtual bool isTerminationRequested () const
 Returns whether the termination of the framework is reqested. More...
 
int getTerminationExitCode () const
 Returns the exit code as specified by requestTermination(), or 0 if requestTermination() was not called. More...
 
int run ()
 Calls the above load() and start() methods according to the command line parameters that were passed in the constructor and finally calls exec(). More...
 
std::string getID () const
 Returns the ID of this framework. More...
 
std::string getGlobalID () const
 Return the fully qualified global id of this framework (includes namespace) More...
 
XMLVariablesMapgetVariables ()
 Returns the list of variables that are registered via command line or config file. More...
 
XMLDomPreprocessorgetXMLDomPreprocessor ()
 
ScopedAccess< ProtecteeDatabasegetMetaDatabase ()
 Return the meta database that contains all known meta information in this framework. More...
 
bool isInExec () const
 
Obtain access to framework components
NameRegistrygetNameRegistry ()
 Returns the reference to the name registry. More...
 
AuthorityManagergetAuthorityManager ()
 Returns the reference to the manager singleton for registered authorities. More...
 
ChannelManagergetChannelManager ()
 Returns the reference to the manager singleton for channels. More...
 
boost::shared_ptr< FrameworkTransformergetTransformer ()
 Returns the pointer to the transform framework. More...
 
ConfigurationLoadergetConfigurationLoader ()
 Returns the reference to the configuration file loader. More...
 
boost::shared_ptr< UnitManagergetUnitManager ()
 Returns the reference to the unit manager. More...
 
RPCManagergetRPCManager ()
 Returns the reference to the manager singleton for registered RPC services. More...
 
boost::shared_ptr< ErrorServicegetErrorService ()
 Returns the pointer to the persistent error service. More...
 
boost::shared_ptr< RemoteModulegetRemoteModule ()
 Returns the pointer to the remote module. More...
 

Static Public Member Functions

static Typeinstance ()
 Returns a reference to the singleton instance. More...
 
static bool isDestroyed ()
 Returns true, if the singleton was already destroyed. More...
 

Protected Member Functions

void initialize ()
 
void finalize ()
 
void ctrlCHandler (const IntSignal &sig)
 

Static Protected Member Functions

static void errorHandler (const IntSignal &sig)
 
static bool enterLeaveErrorHandler (bool enter)
 

Protected Attributes

bool mTerminationRequested
 
int mTerminationExitCode
 
bool mIsStarted
 
bool mInExec
 
bool mRemoteDisabled
 
boost::shared_ptr< Private::FrameworkAuthority > mAuthority
 
RootPropertyNode mPropertiesRoot
 
boost::shared_ptr< PropertyNodemProperties
 
NameRegistry mNames
 
boost::shared_ptr< RemoteModulemRemoteModule
 
RPCManager mRPCManager
 
ChannelManager mChannelManager
 
AuthorityManager mAuthorityManager
 
boost::shared_ptr< FrameworkTransformermTransformer
 
boost::shared_ptr< UnitManagermUnitManager
 
ConfigurationLoader mConfigurationLoader
 
boost::shared_ptr< ErrorServicemErrorServiceModule
 
std::string mName
 
XMLDomPreprocessor mXMLPreprocessor
 
XMLDom mConfigDom
 
ProtecteeDatabase mMetaDatabase
 
Time mStartTime
 

Friends

class Private::FrameworkStartup
 

Detailed Description

This class represents the core element of a modular application.

The Framework allows communication between different application parts, so called authorities, via data channels and remote procedure calls. The framework hides implementation details as well as sources, destinations of data and the way of data transmission from the developer of an authority. This allows the user to run the application on his local PC or distributed on PCs in a network without changing a single line of code.

Member Typedef Documentation

◆ ProtecteeDatabase

◆ Type

typedef Base::Type Type
inherited

Constructor & Destructor Documentation

◆ Framework() [1/2]

Framework ( int  argc,
char **  argv,
bool  startImmediately = false 
)

Constructor that takes command line arguments and a flag.

Parameters
argcNumber of command line arguments.
argvThe command line arguments.
startImmediatelyIf true the methods load() and start() are called after construction.

◆ Framework() [2/2]

Framework ( const std::vector< std::string > &  args,
bool  startImmediately = false 
)

Constructor that takes command line arguments as a vector and a flag.

Parameters
argsThe command line arguments.
startImmediatelyIf true the methods load() and start() are called after construction.

◆ ~Framework()

virtual ~Framework ( )
virtual

Member Function Documentation

◆ reflect()

void reflect ( Reflector &  r)
inline

Reflect method for serialization.

◆ getProperties()

boost::shared_ptr<PropertyNode> getProperties ( )
inline

◆ load() [1/3]

void load ( XMLDom xml)

Loads the specified XML configuration and applies all registered Loaders on it.

This will load libraries, instantiate and configure units, etc. This method will do nothing if the xml document is empty.

◆ load() [2/3]

void load ( const std::string &  configFile)

Opens the specified XML configuration file and applies all registered Loaders on it.

This will load libraries, instantiate and configure units, etc. This method will do nothing if configFile is empty.

◆ load() [3/3]

void load ( )

Loads configuration files given on command line if any by calling above load(const std::string& configFile) function.

◆ start()

void start ( )

Starts the framework and it's remote component (if one was configured or created) and returns immediately.

◆ isStarted()

bool isStarted ( ) const
inline

Return true if framework is started.

◆ getUptime()

Duration getUptime ( ) const
inline

Return duration since started.

◆ exec()

virtual int exec ( )
virtual

Executes the framework and blocks until the framework is terminated, e.g.

by pressing Ctrl+C. Returns the exit code as specified by requestTermination().

Reimplemented in FrameworkWithGui.

◆ requestTermination()

virtual void requestTermination ( int  exitcode = 0)
virtual

Requests the termination of the framework and hence the whole application.

Is called e.g. when user presses Ctrl+C. You can optionally specify an exit code that will be returned as exit code by exec(). Furthermore, this code is returned by the mira executables (mira, miragui, miracenter, etc.).

Reimplemented in FrameworkWithGui.

◆ isTerminationRequested()

virtual bool isTerminationRequested ( ) const
virtual

Returns whether the termination of the framework is reqested.

◆ getTerminationExitCode()

int getTerminationExitCode ( ) const

Returns the exit code as specified by requestTermination(), or 0 if requestTermination() was not called.

See also
isTerminationRequested().

◆ run()

int run ( )

Calls the above load() and start() methods according to the command line parameters that were passed in the constructor and finally calls exec().

Hence, this method will launch a fully operating framework and blocks until the framework is terminated, e.g. by pressing Ctrl+C. Returns the exit code as specified by requestTermination(), or 0 if no error or exception has occurred, otherwise -1.

◆ getNameRegistry()

NameRegistry& getNameRegistry ( )
inline

Returns the reference to the name registry.

◆ getAuthorityManager()

AuthorityManager& getAuthorityManager ( )
inline

Returns the reference to the manager singleton for registered authorities.

◆ getChannelManager()

ChannelManager& getChannelManager ( )
inline

Returns the reference to the manager singleton for channels.

◆ getTransformer()

boost::shared_ptr<FrameworkTransformer> getTransformer ( )
inline

Returns the pointer to the transform framework.

◆ getConfigurationLoader()

ConfigurationLoader& getConfigurationLoader ( )
inline

Returns the reference to the configuration file loader.

◆ getUnitManager()

boost::shared_ptr<UnitManager> getUnitManager ( )
inline

Returns the reference to the unit manager.

◆ getRPCManager()

RPCManager& getRPCManager ( )
inline

Returns the reference to the manager singleton for registered RPC services.

◆ getErrorService()

boost::shared_ptr<ErrorService> getErrorService ( )
inline

Returns the pointer to the persistent error service.

◆ getRemoteModule()

boost::shared_ptr<RemoteModule> getRemoteModule ( )
inline

Returns the pointer to the remote module.

◆ getID()

std::string getID ( ) const
inline

Returns the ID of this framework.

The ID can be specified via command line. If no ID is specified an UUID based one will be generated.

◆ getGlobalID()

std::string getGlobalID ( ) const
inline

Return the fully qualified global id of this framework (includes namespace)

Returns
Global ID

◆ getVariables()

XMLVariablesMap& getVariables ( )
inline

Returns the list of variables that are registered via command line or config file.

◆ getXMLDomPreprocessor()

XMLDomPreprocessor& getXMLDomPreprocessor ( )
inline

◆ getMetaDatabase()

ScopedAccess<ProtecteeDatabase> getMetaDatabase ( )
inline

Return the meta database that contains all known meta information in this framework.

◆ isInExec()

bool isInExec ( ) const
inline

◆ initialize()

void initialize ( )
protected

◆ finalize()

void finalize ( )
protected

◆ ctrlCHandler()

void ctrlCHandler ( const IntSignal sig)
protected

◆ errorHandler()

static void errorHandler ( const IntSignal sig)
staticprotected

◆ enterLeaveErrorHandler()

static bool enterLeaveErrorHandler ( bool  enter)
staticprotected

◆ instance()

static Type& instance ( )
inlinestaticinherited

Returns a reference to the singleton instance.

Exceptions
XSingletonIf the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation).

◆ isDestroyed()

static bool isDestroyed ( )
inlinestaticinherited

Returns true, if the singleton was already destroyed.

Trying to access it will result in an exception.

Friends And Related Function Documentation

◆ Private::FrameworkStartup

friend class Private::FrameworkStartup
friend

Member Data Documentation

◆ mTerminationRequested

bool mTerminationRequested
protected

◆ mTerminationExitCode

int mTerminationExitCode
protected

◆ mIsStarted

bool mIsStarted
protected

◆ mInExec

bool mInExec
protected

◆ mRemoteDisabled

bool mRemoteDisabled
protected

◆ mAuthority

boost::shared_ptr<Private::FrameworkAuthority> mAuthority
protected

◆ mPropertiesRoot

RootPropertyNode mPropertiesRoot
protected

◆ mProperties

boost::shared_ptr<PropertyNode> mProperties
protected

◆ mNames

NameRegistry mNames
protected

◆ mRemoteModule

boost::shared_ptr<RemoteModule> mRemoteModule
protected

◆ mRPCManager

RPCManager mRPCManager
protected

◆ mChannelManager

ChannelManager mChannelManager
protected

◆ mAuthorityManager

AuthorityManager mAuthorityManager
protected

◆ mTransformer

boost::shared_ptr<FrameworkTransformer> mTransformer
protected

◆ mUnitManager

boost::shared_ptr<UnitManager> mUnitManager
protected

◆ mConfigurationLoader

ConfigurationLoader mConfigurationLoader
protected

◆ mErrorServiceModule

boost::shared_ptr<ErrorService> mErrorServiceModule
protected

◆ mName

std::string mName
protected

◆ mXMLPreprocessor

XMLDomPreprocessor mXMLPreprocessor
protected

◆ mConfigDom

XMLDom mConfigDom
protected

◆ mMetaDatabase

ProtecteeDatabase mMetaDatabase
protected

◆ mStartTime

Time mStartTime
protected

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