Package.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 "Scenario.h"
29 #include "Application.h"
30 #include <memory>
31 #include <string>
32 #include <vector>
33 
35 {
36  class Scenario;
37 
38  /**
39  * @class Package
40  * @ingroup Data_Structure
41  * @brief Class containing data about a package, its scenarios and its applications.
42  * Provides methods to get and set the data contained in the package. It is only representative
43  * and doesn't actually manage the package.
44  */
45  class Package
46  {
47 
48  private:
49  std::string name;
50  std::string path;
51  std::string scenarioPath;
52  ScenarioVectorPtr scenarios;
53  ApplicationVectorPtr applications;
54 
55  public:
56  /**
57  * Constructor that sets the name and the path of the package.
58  * @param name name of the package
59  * @param path path to the root of the package
60  */
61  Package(std::string name, std::string path, std::string scenarioPath);
62 
63  /**
64  * Constructor that creates a light copy of the given Package, only name and path get copied.
65  * @param other Package to copy
66  */
67  Package(const Package& other);
68 
69  /**
70  * @return name of this package
71  */
72  std::string getName();
73 
74  /**
75  * @return path of this package (.../PackageName/build/config)
76  */
77  std::string getPath();
78 
79 
80  std::string getScenarioPath();
82 
83  /**
84  * @return scenarios of this package
85  */
87 
88  /**
89  * @return applications of this package
90  */
92 
93  /**
94  * Adds a Scenario to this package.
95  * @param scenario Scenario to be added
96  */
97  void addScenario(ScenarioPtr scenario);
98  void removeScenario(ScenarioPtr scenario);
99 
100  /**
101  * Adds an Application to this package
102  * @param application Application to be added
103  */
104  void addApplication(ApplicationPtr application);
105 
106  /**
107  * Returns a Scenario contained in this package that has the given name.
108  * @param name name of the scenario
109  * @return a Scenario with the given name. Returns a null pointer if no scenario with that name exists.
110  */
111  ScenarioPtr getScenarioByName(std::string name);
112 
113  /**
114  * Returns an Application contained in this package that has the given name.
115  * @param name name of the application
116  * @return an Application with the given name. Returns a null pointer, if no Application with that name exists.
117  */
118  ApplicationPtr getApplicationByName(std::string name);
119  };
120 
121  using PackagePtr = std::shared_ptr<Package>;
122  using PackageVectorPtr = std::shared_ptr<std::vector<ScenarioManager::Data_Structure::PackagePtr>>;
123 }
ScenarioManager::Data_Structure::Package::Package
Package(std::string name, std::string path, std::string scenarioPath)
Constructor that sets the name and the path of the package.
Definition: Package.cpp:35
ScenarioManager::Data_Structure::Package::getPath
std::string getPath()
Definition: Package.cpp:53
ScenarioManager::Data_Structure::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Definition: Scenario.h:36
Scenario.h
ScenarioManager::Data_Structure::ApplicationVectorPtr
std::shared_ptr< std::vector< ApplicationPtr > > ApplicationVectorPtr
Definition: Application.h:120
ScenarioManager::Data_Structure::ApplicationPtr
std::shared_ptr< Application > ApplicationPtr
Definition: Application.h:119
ScenarioManager::Data_Structure::Package::getName
std::string getName()
Definition: Package.cpp:48
ScenarioManager::Data_Structure::Package::addApplication
void addApplication(ApplicationPtr application)
Adds an Application to this package.
Definition: Package.cpp:121
ScenarioManager::Data_Structure::Package::getApplications
ApplicationVectorPtr getApplications()
Definition: Package.cpp:99
ScenarioManager::Data_Structure::PackageVectorPtr
std::shared_ptr< std::vector< ScenarioManager::Data_Structure::PackagePtr > > PackageVectorPtr
Definition: Package.h:122
ScenarioManager::Data_Structure::Package::getApplicationByName
ApplicationPtr getApplicationByName(std::string name)
Returns an Application contained in this package that has the given name.
Definition: Package.cpp:138
ScenarioManager::Data_Structure::PackagePtr
std::shared_ptr< Package > PackagePtr
Definition: Package.h:121
ScenarioManager::Data_Structure
Definition: Application.cpp:166
ScenarioManager::Data_Structure::Package::addScenario
void addScenario(ScenarioPtr scenario)
Adds a Scenario to this package.
Definition: Package.cpp:104
ScenarioManager::Data_Structure::Package::removeScenario
void removeScenario(ScenarioPtr scenario)
Definition: Package.cpp:109
ScenarioManager::Data_Structure::Package::isScenarioPathWritable
bool isScenarioPathWritable()
Definition: Package.cpp:63
ScenarioManager::Data_Structure::Package::getScenarioByName
ScenarioPtr getScenarioByName(std::string name)
Returns a Scenario contained in this package that has the given name.
Definition: Package.cpp:126
ScenarioManager::Data_Structure::Package::getScenarioPath
std::string getScenarioPath()
Definition: Package.cpp:58
Application.h
ScenarioManager::Data_Structure::Package
Class containing data about a package, its scenarios and its applications. Provides methods to get an...
Definition: Package.h:45
ScenarioManager::Data_Structure::Package::getScenarios
ScenarioVectorPtr getScenarios()
Definition: Package.cpp:94
ScenarioManager::Data_Structure::ScenarioVectorPtr
std::shared_ptr< std::vector< ScenarioPtr > > ScenarioVectorPtr
Definition: Scenario.h:38