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 
28 #include <filesystem>
29 #include <memory>
30 #include <string>
31 
34 
36 {
37  using PropertyEnabledMap = std::map<std::string, bool>;
38 
39  /**
40  * @class Application
41  * @ingroup data_structure
42  * @brief Class containing data about an application
43  * Provides methods to get and set the date contained in the application. It doesn't manage the application
44  * therefore changes in this class won't synchronize to the actual configuration files.
45  */
47  {
48 
49  private:
50  std::string name; /// pretty name of the app
51  std::string executableName; /// name of the executable
52  std::filesystem::path executablePath; /// directory where the app resides
53  std::string packageName;
54  bool found;
55 
56  protected:
60 
61  public:
62  /**
63  * Constructor that sets the name and the path to the executable of the application.
64  * @param name name of the application
65  * @param executablePath path to the binary executable of the application
66  */
67  Application(std::string name, std::string executablePath, std::string packageName);
68 
69  /**
70  * Copy constructor
71  * @param name name of the application
72  * @param executablePath path to the binary executable of the application
73  */
75 
76  /**
77  * @return the name of this application
78  */
79  std::string getName();
80 
81  /**
82  * @return the name of executable of this application
83  */
84  std::string getExecutableName();
85 
86  /**
87  * @return the absolute path to the executable of this application
88  */
89  std::string getExecutableAbsPath();
90 
91  /**
92  * @return the path to the executable file of this application
93  */
94  std::string getPathToExecutable();
95 
96  std::string getPackageName();
97 
98  bool isDefaultPropertyEnabled(std::string name);
99  void setDefaultPropertyEnabled(std::string name, bool enabled);
100 
101  bool isDefaultProperty(std::string name);
102  void setIsDefaultProperty(std::string name, bool defaultValue);
103 
104  /**
105  * @return the properties of this application
106  **/
108 
109  /**
110  * Sets the properties of this application. These properties (along with the
111  * default config) define the behaviour of the application on start.
112  * @param properties new properties
113  */
115 
116  bool getFound();
117 
118  void updateFound();
119  };
120 
121  using ApplicationPtr = std::shared_ptr<Application>;
122  using ApplicationVectorPtr = std::shared_ptr<std::vector<ApplicationPtr>>;
123 } // namespace ScenarioManager::Data_Structure
ScenarioManager::Data_Structure::Application::getProperties
armarx::PropertyDefinitionsPtr getProperties()
Definition: Application.cpp:110
ScenarioManager::Data_Structure::Application::updateFound
void updateFound()
Definition: Application.cpp:135
ScenarioManager::Data_Structure::ApplicationVectorPtr
std::shared_ptr< std::vector< ApplicationPtr > > ApplicationVectorPtr
Definition: Application.h:122
ScenarioManager::Data_Structure::Application::isDefaultPropertyEnabled
bool isDefaultPropertyEnabled(std::string name)
Definition: Application.cpp:141
ScenarioManager::Data_Structure::ApplicationPtr
std::shared_ptr< Application > ApplicationPtr
Definition: Application.h:121
ScenarioManager::Data_Structure::Application::getExecutableAbsPath
std::string getExecutableAbsPath()
Definition: Application.cpp:189
ScenarioManager::Data_Structure::Application::properties
armarx::PropertyDefinitionsPtr properties
Definition: Application.h:57
ScenarioManager::Data_Structure::Application
Class containing data about an application Provides methods to get and set the date contained in the ...
Definition: Application.h:46
ScenarioManager::Data_Structure::Application::setProperties
void setProperties(armarx::PropertyDefinitionsPtr properties)
Sets the properties of this application.
Definition: Application.cpp:116
ScenarioManager::Data_Structure::Application::getFound
bool getFound()
Definition: Application.cpp:129
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
ScenarioManager::Data_Structure::PropertyEnabledMap
std::map< std::string, bool > PropertyEnabledMap
Definition: Application.h:37
ScenarioManager::Data_Structure
Definition: Application.cpp:180
ScenarioManager::Data_Structure::Application::getExecutableName
std::string getExecutableName()
Definition: Application.cpp:183
PropertyDefinitionContainer.h
ScenarioManager::Data_Structure::Application::getPathToExecutable
std::string getPathToExecutable()
Definition: Application.cpp:98
ScenarioManager::Data_Structure::Application::enabledMap
PropertyEnabledMap enabledMap
Definition: Application.h:58
IceUtil::Handle< class PropertyDefinitionContainer >
ScenarioManager::Data_Structure::Application::getName
std::string getName()
Definition: Application.cpp:92
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:104
ScenarioManager::Data_Structure::Application::defaultMap
PropertyEnabledMap defaultMap
Definition: Application.h:59
ScenarioManager::Data_Structure::Application::setDefaultPropertyEnabled
void setDefaultPropertyEnabled(std::string name, bool enabled)
Definition: Application.cpp:155
IceProperties.h
ScenarioManager::Data_Structure::Application::isDefaultProperty
bool isDefaultProperty(std::string name)
Definition: Application.cpp:165
ScenarioManager::Data_Structure::Application::setIsDefaultProperty
void setIsDefaultProperty(std::string name, bool defaultValue)
Definition: Application.cpp:175