Application Class Reference

Class containing data about an application Provides methods to get and set the date contained in the application. More...

#include <ArmarXCore/util/ScenarioManagerCommon/data_structure/Application.h>

+ Inheritance diagram for Application:

Public Member Functions

 Application (Application &app)
 Copy constructor.
 
 Application (std::string name, std::string executablePath, std::string packageName)
 Constructor that sets the name and the path to the executable of the application.
 
std::string getExecutableAbsPath ()
 
std::string getExecutableName ()
 
bool getFound ()
 
std::string getName ()
 
std::string getPackageName ()
 
std::string getPathToExecutable ()
 
armarx::PropertyDefinitionsPtr getProperties ()
 
bool isDefaultProperty (std::string name)
 
bool isDefaultPropertyEnabled (std::string name)
 
void setDefaultPropertyEnabled (std::string name, bool enabled)
 
void setIsDefaultProperty (std::string name, bool defaultValue)
 
void setProperties (armarx::PropertyDefinitionsPtr properties)
 Sets the properties of this application.
 
void updateFound ()
 Checks whether the executable exists and caches the result for getFound().
 

Protected Attributes

PropertyEnabledMap defaultMap
 
PropertyEnabledMap enabledMap
 
armarx::PropertyDefinitionsPtr properties
 
std::mutex propertiesMutex
 Guards properties, enabledMap and defaultMap.
 

Detailed Description

Class containing data about an application Provides methods to get and set the date contained in the application.

It doesn't manage the application therefore changes in this class won't synchronize to the actual configuration files.

Constructor & Destructor Documentation

◆ Application() [1/2]

Application ( std::string name,
std::string executablePath,
std::string packageName )

Constructor that sets the name and the path to the executable of the application.

Parameters
namename of the application
executablePathpath to the binary executable of the application

◆ Application() [2/2]

Copy constructor.

Parameters
namename of the application
executablePathpath to the binary executable of the application

Member Function Documentation

◆ getExecutableAbsPath()

std::string getExecutableAbsPath ( )
Returns
the absolute path to the executable of this application

◆ getExecutableName()

std::string getExecutableName ( )
Returns
the name of executable of this application

◆ getFound()

bool getFound ( )
Returns
whether the executable existed the last time updateFound() ran.

Deliberately does not hit the file system: this is read for every application on every status refresh of the GUI, and on a network mounted workspace the stat() calls alone were enough to stall the GUI thread. Call updateFound() to refresh it.

◆ getName()

std::string getName ( )
Returns
the name of this application

◆ getPackageName()

std::string getPackageName ( )

◆ getPathToExecutable()

std::string getPathToExecutable ( )
Returns
the path to the executable file of this application

◆ getProperties()

PropertyDefinitionsPtr getProperties ( )
Returns
the properties of this application

◆ isDefaultProperty()

bool isDefaultProperty ( std::string name)

◆ isDefaultPropertyEnabled()

bool isDefaultPropertyEnabled ( std::string name)

◆ setDefaultPropertyEnabled()

void setDefaultPropertyEnabled ( std::string name,
bool enabled )

◆ setIsDefaultProperty()

void setIsDefaultProperty ( std::string name,
bool defaultValue )

◆ setProperties()

void setProperties ( armarx::PropertyDefinitionsPtr properties)

Sets the properties of this application.

These properties (along with the default config) define the behaviour of the application on start.

Parameters
propertiesnew properties

◆ updateFound()

void updateFound ( )

Checks whether the executable exists and caches the result for getFound().

Involves a stat(), so avoid calling it from the GUI thread in a loop.

Member Data Documentation

◆ defaultMap

PropertyEnabledMap defaultMap
protected

◆ enabledMap

PropertyEnabledMap enabledMap
protected

◆ properties

armarx::PropertyDefinitionsPtr properties
protected

◆ propertiesMutex

std::mutex propertiesMutex
mutableprotected

Guards properties, enabledMap and defaultMap.

An application's properties are (re)loaded by the lifecycle worker that starts it while the GUI thread may be displaying them. The lock is deliberately held only around the pointer swap and the map accesses, never around parsing or around generating the property xml - those take seconds and would freeze the GUI. load() therefore builds a complete new container outside the lock and swaps it in, and getProperties() hands out a shared_ptr copy, so a reader keeps a consistent snapshot even if a new one is swapped in meanwhile.


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