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