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 
30 using namespace armarx;
31 
32 StatechartGroup::StatechartGroup(QString groupDefinitionFilePath, QString groupPath, QString name, QString description, QString packageName, const QList<QString>& proxies, bool generateContext, const QMap<QString, QString>& statechartGroupConfigurations, WriteAccess writable)
33 {
34  this->definitionFilePath = groupDefinitionFilePath;
35  this->groupPath = groupPath;
36  this->name = name;
37  this->description = description;
38  this->packageName = packageName;
39  this->proxies = proxies;
40  this->generateContext = generateContext;
41  this->statechartGroupConfigurations = statechartGroupConfigurations;
42  this->writable = writable;
43 }
44 
46 {
47  return rootNode;
48 }
49 QString StatechartGroup::getName() const
50 {
51  return name;
52 }
54 {
55  return definitionFilePath;
56 }
57 
59 {
60  return groupPath;
61 }
62 
63 std::filesystem::path StatechartGroup::getBoostGroupPath() const
64 {
65  return std::filesystem::path(groupPath.toUtf8().data());
66 }
67 
68 std::filesystem::path StatechartGroup::getBoostDefinitionFilePath() const
69 {
70  return std::filesystem::path(definitionFilePath.toUtf8().data());
71 }
73 {
74  return description;
75 }
76 
77 const QMap<QString, QString>& StatechartGroup::getConfigurations() const
78 {
79  return statechartGroupConfigurations;
80 }
81 
82 QList<QString> StatechartGroup::getProxies() const
83 {
84  return proxies;
85 }
86 
88 {
89  return generateContext;
90 }
91 
92 void StatechartGroup::setContextGeneration(bool generateContext)
93 {
94  this->generateContext = generateContext;
95 }
96 
98 {
99  return std::filesystem::exists(getBoostGroupPath() / "CMakeLists.txt");
100 }
101 
103 {
104  this->rootNode = rootNode;
105 }
106 
108 {
109  return rootNode->findNodeByStateName(name);
110 }
111 
112 QVector<StateTreeNodePtr> StatechartGroup::getAllNodes() const
113 {
114  QVector<StateTreeNodePtr> result = rootNode->getAllSubNodesRecursively();
115  result.push_front(rootNode);
116  return result;
117 }
118 
119 QVector<statechartmodel::StatePtr> StatechartGroup::getAllStates(bool localOnly) const
120 {
121  return rootNode->getAllStatesRecursively(localOnly);
122 }
123 
125 {
126  return packageName;
127 }
128 
130 {
131  CMakePackageFinder finder(getPackageName().toStdString());
132  return QString::fromStdString(finder.getPackageDir());
133 }
134 
135 void StatechartGroup::setDescription(const QString& description)
136 {
137  this->description = description;
138 }
139 
140 void StatechartGroup::setProxies(const QList<QString> proxies)
141 {
142  this->proxies = proxies;
143 }
144 
145 void StatechartGroup::setConfigurations(const QMap<QString, QString>& statechartGroupConfigurations)
146 {
147  this->statechartGroupConfigurations = statechartGroupConfigurations;
148 }
149 
151 {
152  return writable;
153 }
armarx::StatechartGroup::getGroupPath
QString getGroupPath() const
Definition: StatechartGroup.cpp:58
armarx::StatechartGroup::contextGenerationEnabled
bool contextGenerationEnabled() const
Definition: StatechartGroup.cpp:87
armarx::StatechartGroup::StatechartGroup
StatechartGroup(QString definitionFilePath, QString groupPath, QString name, QString description, QString packageName, const QList< QString > &proxies, bool generateContext, const QMap< QString, QString > &statechartGroupConfigurations, WriteAccess writable)
Definition: StatechartGroup.cpp:32
armarx::StatechartGroup::existsCMakeLists
bool existsCMakeLists() const
Definition: StatechartGroup.cpp:97
armarx::StateTreeNodePtr
std::shared_ptr< StateTreeNode > StateTreeNodePtr
Definition: StatechartGroupDefs.h:31
armarx::StatechartGroup::WriteAccess
WriteAccess
Definition: StatechartGroup.h:40
armarx::StatechartGroup::getConfigurations
const QMap< QString, QString > & getConfigurations() const
Definition: StatechartGroup.cpp:77
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:53
armarx::StatechartGroup::getDefinitionFilePath
QString getDefinitionFilePath() const
Definition: StatechartGroup.cpp:53
armarx::StatechartGroup::getBoostDefinitionFilePath
std::filesystem::path getBoostDefinitionFilePath() const
Definition: StatechartGroup.cpp:68
armarx::StatechartGroup::getWriteAccess
WriteAccess getWriteAccess()
Definition: StatechartGroup.cpp:150
armarx::StatechartGroup::getName
QString getName() const
Definition: StatechartGroup.cpp:49
armarx::StatechartGroup::getBoostGroupPath
std::filesystem::path getBoostGroupPath() const
Definition: StatechartGroup.cpp:63
armarx::StatechartGroup::getRootNode
StateTreeNodePtr getRootNode()
Definition: StatechartGroup.cpp:45
armarx::StatechartGroup::getDescription
QString getDescription() const
Definition: StatechartGroup.cpp:72
armarx::StatechartGroup::getProxies
QList< QString > getProxies() const
Definition: StatechartGroup.cpp:82
armarx::StatechartGroup::getAllNodes
QVector< StateTreeNodePtr > getAllNodes() const
Definition: StatechartGroup.cpp:112
armarx::StatechartGroup::findNodeByStateName
StateTreeNodePtr findNodeByStateName(QString name)
Definition: StatechartGroup.cpp:107
armarx::CMakePackageFinder::getPackageDir
std::string getPackageDir() const
Returns the top level path of a source package.
Definition: CMakePackageFinder.h:144
armarx::StatechartGroup::setConfigurations
void setConfigurations(const QMap< QString, QString > &statechartGroupConfigurations)
Definition: StatechartGroup.cpp:145
armarx::StatechartGroup::getPackageName
QString getPackageName() const
Definition: StatechartGroup.cpp:124
StatechartGroup.h
armarx::StatechartGroup::setDescription
void setDescription(const QString &description)
Definition: StatechartGroup.cpp:135
armarx::StatechartGroup::getPackagePath
QString getPackagePath() const
Definition: StatechartGroup.cpp:129
armarx::StatechartGroup::setRootNode
void setRootNode(StateTreeNodePtr rootNode)
Definition: StatechartGroup.cpp:102
CMakePackageFinder.h
armarx::StatechartGroup::getAllStates
QVector< statechartmodel::StatePtr > getAllStates(bool localOnly=true) const
Definition: StatechartGroup.cpp:119
StateTreeNode.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::StatechartGroup::setContextGeneration
void setContextGeneration(bool generateContext)
Definition: StatechartGroup.cpp:92
armarx::StatechartGroup::setProxies
void setProxies(const QList< QString > proxies)
Definition: StatechartGroup.cpp:140