StatechartProfiles.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
19 * @author
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24#pragma once
25
26#include <memory>
27#include <set>
28#include <string>
29#include <vector>
30
32
33namespace armarx
34{
36 using StatechartProfilesPtr = std::shared_ptr<StatechartProfiles>;
37
39 using StatechartProfilePtr = std::shared_ptr<StatechartProfile>;
40 using StatechartProfileWeakPtr = std::weak_ptr<StatechartProfile>;
41
42 class StatechartProfile : public std::enable_shared_from_this<StatechartProfile>
43 {
44 friend class StatechartProfiles;
45
46 public:
47 StatechartProfile(const std::string& name, StatechartProfilePtr parent);
49 bool isLeaf() const;
50 bool isRoot() const;
51 std::vector<std::string> getAllPackages() const;
52 std::string getName() const;
53 /**
54 * @brief Returns name of profile with all parents in the form of
55 * *Root::Armar3Base::Armar3Simualation* if *Armar3Simulation* is the current profile.
56 */
57 std::string getFullName() const;
58 StatechartProfilePtr findByNameRecursive(std::string name) const;
59 const std::vector<StatechartProfilePtr>& getChildren() const;
60 StatechartProfilePtr getChildByName(std::string name) const;
62 int getNesting() const;
63 std::string getStatechartGroupPrefix() const;
64 std::string getAdditionalProperties() const;
65
66 private:
68 std::vector<StatechartProfilePtr> children;
69 std::vector<std::string> packages;
70 std::string name;
71 std::string additionalProperties;
72 };
73
75 {
76 public:
77 static std::string
79 {
80 return "Root";
81 }
82
83
84 public:
87
88 static StatechartProfilesPtr ReadProfileFiles(const std::vector<std::string>& packages);
89
90 std::vector<StatechartProfilePtr> getAllLeaves() const;
91 std::set<std::string> getAllLeafNames() const;
92 StatechartProfilePtr getProfileByName(std::string name);
94
95 private:
96 StatechartProfilePtr rootProfile;
97 void getAllLeaves(StatechartProfilePtr currentProfile,
98 std::vector<StatechartProfilePtr>& profiles) const;
99 };
100} // namespace armarx
std::string getStatechartGroupPrefix() const
const std::vector< StatechartProfilePtr > & getChildren() const
std::string getFullName() const
Returns name of profile with all parents in the form of Root::Armar3Base::Armar3Simualation if Armar3...
StatechartProfilePtr getParent() const
StatechartProfile(const std::string &name, StatechartProfilePtr parent)
StatechartProfilePtr getChildByName(std::string name) const
std::vector< std::string > getAllPackages() const
void readFromXml(RapidXmlReaderNode node)
StatechartProfilePtr findByNameRecursive(std::string name) const
std::string getAdditionalProperties() const
StatechartProfilePtr getRootProfile() const
StatechartProfilePtr getProfileByName(std::string name)
static StatechartProfilesPtr ReadProfileFiles(const std::vector< std::string > &packages)
std::vector< StatechartProfilePtr > getAllLeaves() const
static std::string GetRootName()
std::set< std::string > getAllLeafNames() const
void readStatechartProfiles(RapidXmlReaderPtr reader)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::weak_ptr< StatechartProfile > StatechartProfileWeakPtr
std::shared_ptr< StatechartProfiles > StatechartProfilesPtr
std::shared_ptr< RapidXmlReader > RapidXmlReaderPtr
std::shared_ptr< class StatechartProfile > StatechartProfilePtr