StatechartGroup.cpp
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#include "StatechartGroup.h"
25
27
28#include "StateTreeNode.h"
29
30using namespace armarx;
31
32StatechartGroup::StatechartGroup(QString groupDefinitionFilePath,
33 QString groupPath,
34 QString name,
35 QString description,
36 QString packageName,
37 const QList<QString>& proxies,
38 bool generateContext,
39 const QMap<QString, QString>& statechartGroupConfigurations,
40 WriteAccess writable)
41{
42 this->definitionFilePath = groupDefinitionFilePath;
43 this->groupPath = groupPath;
44 this->name = name;
45 this->description = description;
46 this->packageName = packageName;
47 this->proxies = proxies;
48 this->generateContext = generateContext;
49 this->statechartGroupConfigurations = statechartGroupConfigurations;
50 this->writable = writable;
51}
52
55{
56 return rootNode;
57}
58
59QString
61{
62 return name;
63}
64
65QString
67{
68 return definitionFilePath;
69}
70
71QString
73{
74 return groupPath;
75}
76
77std::filesystem::path
79{
80 return std::filesystem::path(groupPath.toUtf8().data());
81}
82
83std::filesystem::path
85{
86 return std::filesystem::path(definitionFilePath.toUtf8().data());
87}
88
89QString
91{
92 return description;
93}
94
95const QMap<QString, QString>&
97{
98 return statechartGroupConfigurations;
99}
100
101QList<QString>
103{
104 return proxies;
105}
106
107bool
109{
110 return generateContext;
111}
112
113void
115{
116 this->generateContext = generateContext;
117}
118
119bool
121{
122 return std::filesystem::exists(getBoostGroupPath() / "CMakeLists.txt");
123}
124
125void
127{
128 this->rootNode = rootNode;
129}
130
133{
134 return rootNode->findNodeByStateName(name);
135}
136
137QVector<StateTreeNodePtr>
139{
140 QVector<StateTreeNodePtr> result = rootNode->getAllSubNodesRecursively();
141 result.push_front(rootNode);
142 return result;
143}
144
145QVector<statechartmodel::StatePtr>
146StatechartGroup::getAllStates(bool localOnly) const
147{
148 return rootNode->getAllStatesRecursively(localOnly);
149}
150
151QString
153{
154 return packageName;
155}
156
157QString
159{
160 CMakePackageFinder finder(getPackageName().toStdString());
161 return QString::fromStdString(finder.getPackageDir());
162}
163
164void
165StatechartGroup::setDescription(const QString& description)
166{
167 this->description = description;
168}
169
170void
171StatechartGroup::setProxies(const QList<QString> proxies)
172{
173 this->proxies = proxies;
174}
175
176void
177StatechartGroup::setConfigurations(const QMap<QString, QString>& statechartGroupConfigurations)
178{
179 this->statechartGroupConfigurations = statechartGroupConfigurations;
180}
181
184{
185 return writable;
186}
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
std::string getPackageDir() const
Returns the top level path of a source package.
QVector< statechartmodel::StatePtr > getAllStates(bool localOnly=true) const
void setContextGeneration(bool generateContext)
void setRootNode(StateTreeNodePtr rootNode)
StateTreeNodePtr findNodeByStateName(QString name)
QList< QString > getProxies() const
void setDescription(const QString &description)
bool contextGenerationEnabled() const
std::filesystem::path getBoostGroupPath() const
StatechartGroup(QString definitionFilePath, QString groupPath, QString name, QString description, QString packageName, const QList< QString > &proxies, bool generateContext, const QMap< QString, QString > &statechartGroupConfigurations, WriteAccess writable)
QString getDescription() const
void setConfigurations(const QMap< QString, QString > &statechartGroupConfigurations)
QString getDefinitionFilePath() const
QVector< StateTreeNodePtr > getAllNodes() const
std::filesystem::path getBoostDefinitionFilePath() const
void setProxies(const QList< QString > proxies)
const QMap< QString, QString > & getConfigurations() const
StateTreeNodePtr getRootNode()
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< StateTreeNode > StateTreeNodePtr