Application.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Dennis Weigelt
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #pragma once
27 
30 #include <memory>
31 #include <string>
32 #include <filesystem>
33 
35 {
36  using PropertyEnabledMap = std::map<std::string, bool>;
37 
38  /**
39  * @class Application
40  * @ingroup data_structure
41  * @brief Class containing data about an application
42  * Provides methods to get and set the date contained in the application. It doesn't manage the application
43  * therefore changes in this class won't synchronize to the actual configuration files.
44  */
46  {
47 
48  private:
49  std::string name; /// pretty name of the app
50  std::string executableName; /// name of the executable
51  std::filesystem::path executablePath; /// directory where the app resides
52  std::string packageName;
53  bool found;
54 
55  protected:
59 
60  public:
61  /**
62  * Constructor that sets the name and the path to the executable of the application.
63  * @param name name of the application
64  * @param executablePath path to the binary executable of the application
65  */
66  Application(std::string name, std::string executablePath, std::string packageName);
67 
68  /**
69  * Copy constructor
70  * @param name name of the application
71  * @param executablePath path to the binary executable of the application
72  */
74 
75  /**
76  * @return the name of this application
77  */
78  std::string getName();
79 
80  /**
81  * @return the name of executable of this application
82  */
83  std::string getExecutableName();
84 
85  /**
86  * @return the absolute path to the executable of this application
87  */
88  std::string getExecutableAbsPath();
89 
90  /**
91  * @return the path to the executable file of this application
92  */
93  std::string getPathToExecutable();
94 
95  std::string getPackageName();
96 
97  bool isDefaultPropertyEnabled(std::string name);
98  void setDefaultPropertyEnabled(std::string name, bool enabled);
99 
100  bool isDefaultProperty(std::string name);
101  void setIsDefaultProperty(std::string name, bool defaultValue);
102 
103  /**
104  * @return the properties of this application
105  **/
107 
108  /**
109  * Sets the properties of this application. These properties (along with the
110  * default config) define the behaviour of the application on start.
111  * @param properties new properties
112  */
114 
115  bool getFound();
116 
117  void updateFound();
118  };
119  using ApplicationPtr = std::shared_ptr<Application>;
120  using ApplicationVectorPtr = std::shared_ptr<std::vector<ApplicationPtr>>;
121 }
ScenarioManager::Data_Structure::Application::getProperties
armarx::PropertyDefinitionsPtr getProperties()
Definition: Application.cpp:104
ScenarioManager::Data_Structure::Application::updateFound
void updateFound()
Definition: Application.cpp:124
ScenarioManager::Data_Structure::ApplicationVectorPtr
std::shared_ptr< std::vector< ApplicationPtr > > ApplicationVectorPtr
Definition: Application.h:120
ScenarioManager::Data_Structure::Application::isDefaultPropertyEnabled
bool isDefaultPropertyEnabled(std::string name)
Definition: Application.cpp:129
ScenarioManager::Data_Structure::ApplicationPtr
std::shared_ptr< Application > ApplicationPtr
Definition: Application.h:119
ScenarioManager::Data_Structure::Application::getExecutableAbsPath
std::string getExecutableAbsPath()
Definition: Application.cpp:173
ScenarioManager::Data_Structure::Application::properties
armarx::PropertyDefinitionsPtr properties
Definition: Application.h:56
ScenarioManager::Data_Structure::Application
Class containing data about an application Provides methods to get and set the date contained in the ...
Definition: Application.h:45
ScenarioManager::Data_Structure::Application::setProperties
void setProperties(armarx::PropertyDefinitionsPtr properties)
Sets the properties of this application.
Definition: Application.cpp:109
ScenarioManager::Data_Structure::Application::getFound
bool getFound()
Definition: Application.cpp:119
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
ScenarioManager::Data_Structure::PropertyEnabledMap
std::map< std::string, bool > PropertyEnabledMap
Definition: Application.h:36
ScenarioManager::Data_Structure
Definition: Application.cpp:166
ScenarioManager::Data_Structure::Application::getExecutableName
std::string getExecutableName()
Definition: Application.cpp:168
PropertyDefinitionContainer.h
ScenarioManager::Data_Structure::Application::getPathToExecutable
std::string getPathToExecutable()
Definition: Application.cpp:94
ScenarioManager::Data_Structure::Application::enabledMap
PropertyEnabledMap enabledMap
Definition: Application.h:57
IceUtil::Handle< class PropertyDefinitionContainer >
ScenarioManager::Data_Structure::Application::getName
std::string getName()
Definition: Application.cpp:89
ScenarioManager::Data_Structure::Application::Application
Application(std::string name, std::string executablePath, std::string packageName)
Constructor that sets the name and the path to the executable of the application.
Definition: Application.cpp:58
ScenarioManager::Data_Structure::Application::getPackageName
std::string getPackageName()
Definition: Application.cpp:99
ScenarioManager::Data_Structure::Application::defaultMap
PropertyEnabledMap defaultMap
Definition: Application.h:58
ScenarioManager::Data_Structure::Application::setDefaultPropertyEnabled
void setDefaultPropertyEnabled(std::string name, bool enabled)
Definition: Application.cpp:142
IceProperties.h
ScenarioManager::Data_Structure::Application::isDefaultProperty
bool isDefaultProperty(std::string name)
Definition: Application.cpp:152
ScenarioManager::Data_Structure::Application::setIsDefaultProperty
void setIsDefaultProperty(std::string name, bool defaultValue)
Definition: Application.cpp:161