Actin  Version 5.5.5
Software for Robotics Simulation and Control
Ec::Application Class Reference

Provides global allocation and access to manager objects. More...

#include <ecApplication.h>

Inheritance diagram for Ec::Application:
[legend]
Collaboration diagram for Ec::Application:
[legend]

Public Member Functions

void setFileExactMatch (const EcBoolean exactMatch)
 
EcBoolean getFileExactMatch () const
 Obtain the flag detailed above.
 
ConnectionManagerconnectionManager ()
 get the connection manager
 
FileUtilfileUtil ()
 get the FileUtil object
 
PluginManagerpluginManager ()
 get the plugin manager
 
PrintprintManager ()
 get the print manager
 
template<typename T >
void registerManager (const EcString &mgrName, T *pManager)
 
template<typename T >
void registerManager (const EcString &mgrName, ecboost::shared_ptr< T > pManager)
 Provide a mechanism to register global manager objects. More...
 

Static Public Member Functions

static Applicationinstance ()
 
static EcBoolean instanceExists ()
 
static PluginloadPlugin (const EcString &fileName, const EcBoolean unloadOnFailure=EcTrue)
 
static EcBoolean unloadPlugin (const EcString &pluginName)
 
static EcString findFile (const EcString &fileName)
 
static EcBoolean addDirectory (const EcString &path)
 
static EcString getDataDirectory (const EcString &name="toolkits")
 
static EcString getMruFilePath ()
 
template<typename T >
static T * instance (const EcString &managerName)
 
static EcBoolean managerExists (const EcString &managerName)
 Does a requestable manager exist, useful for shutdown coordination. More...
 
static void destroyInstance ()
 
static void restoreSavedSignalHandlers ()
 

Detailed Description

Provides global allocation and access to manager objects.

Definition at line 28 of file ecApplication.h.

Member Function Documentation

static EcBoolean Ec::Application::addDirectory ( const EcString path)
static

Append a search directory when performing file loading.

Returns
EcBoolean Success or failure of command
Examples:
controlExecutiveModifierExampleMain.cpp, ecCollisionAvoidanceExample.cpp, and ecPathPlanningCoreMain.cpp.
static void Ec::Application::destroyInstance ( )
static

A static method to destroy the only instance of this class, if it exists, by deleting it and setting the static pointer to NULL. A new instance will be created when instance() is called.

static EcString Ec::Application::findFile ( const EcString fileName)
static

Search for a file. If given a path (relative or absolute), look there first. If it fails, then based upon the search trait will either fail or continue with the search paths until it either finds a matching file or fails. This routine will perform a search among all of the directory paths in order to locate the file. If the file contains a path, then that directory will be added to the list.

Returns
EcString Either empty string or fully-qualified path + filename
static EcString Ec::Application::getDataDirectory ( const EcString name = "toolkits")
static

Retrieve data directory path. With no argument, it returns the toolkit data directory, either from the environment variable $(EC_TOOLKITS_DATA) or from a previous setDataDirectory() call.

Returns
EcString Empty string or fully-qualified path to data directory
Examples:
controlExecutiveModifierExampleMain.cpp, ecCollisionAvoidanceExample.cpp, and ecPathPlanningCoreMain.cpp.
static EcString Ec::Application::getMruFilePath ( )
static

Retrieve the Most Recently Used file path (path + file).

Returns
EcString Last file used when loading in a file
static Application& Ec::Application::instance ( )
static

A static method that returns the only instance of this class. The instance is only created the first time this method is called

template<typename T >
static T* Ec::Application::instance ( const EcString managerName)
inlinestatic

Attempt to retrieve a thread-safe handle to a managerial object.

Returns
T* Handle to object or NULL if unavailable
Parameters
[in]managerNameName of manager object to retrieve

Definition at line 151 of file ecApplication.h.

References EcNULL.

static EcBoolean Ec::Application::instanceExists ( )
static

A check to see if the instance exists. This is useful for small applications that create a EcIoDataBroker object globally so that if the application has allready cleaned up, the broker won't ask for an instance, this speeds up shutdown and prevents shutdown race conditions.

static Plugin* Ec::Application::loadPlugin ( const EcString fileName,
const EcBoolean  unloadOnFailure = EcTrue 
)
static

Use this method to create a new instance of a plugin. It loads the shared library into memory and adds it to the list of managed plugins.

Returns
Ec::Plugin* Returns pointer to loaded plugin, or EcNULL on failure
static EcBoolean Ec::Application::managerExists ( const EcString managerName)
inlinestatic

Does a requestable manager exist, useful for shutdown coordination.

Parameters
[in]managerNameName of manager object to retrieve

Definition at line 171 of file ecApplication.h.

References EcFalse, and EcTrue.

template<typename T >
void Ec::Application::registerManager ( const EcString mgrName,
T *  pManager 
)
inline

Provide a mechanism to register global manager objects. This class will own the object and cleanup when the application exits. It also provides thread-safe access.

Parameters
[in]mgrNameName to associate with this manager
[in]pManagerHandle of object to own

Definition at line 122 of file ecApplication.h.

template<typename T >
void Ec::Application::registerManager ( const EcString mgrName,
ecboost::shared_ptr< T >  pManager 
)
inline

Provide a mechanism to register global manager objects.

Parameters
[in]mgrNameName to associate with this manager
[in]pManagerHandle of object to own

Definition at line 136 of file ecApplication.h.

static void Ec::Application::restoreSavedSignalHandlers ( )
static

A static method to restore saved signal handlers. The handlers are saved when instance() is called and are restored automatically when destroyInstance() is called. This method allows the handlers to be restored before destruction. If called outside of destroyInstance() destroyInstance() must be called manually also.

void Ec::Application::setFileExactMatch ( const EcBoolean  exactMatch)

Specify whether to enable or disable file searches when trying to load a file given the pathname. The default is to perform the search until it finds the file or all paths have been searched. This provides behavior to the application that keeps it from finding potentially incorrect files that are named the same as the desired file, but located somewhere else.

Parameters
[in]exactMatchWhether to allow searching for files
static EcBoolean Ec::Application::unloadPlugin ( const EcString pluginName)
static

Use this method to remove a loaded plugin. It removes it from the list of managed plugins.

Returns
EcBoolean Returns EcTrue or EcFalse if the plugin was in the list.

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