StateGroupGenerator.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 <filesystem>
27#include <optional>
28
31
32#include "GroupXmlReader.h"
33
34namespace armarx
35{
36
38 {
39 public:
40 static Ice::StringSeq findStatechartGroupFiles(const std::string& statechartsPath);
41
42 static bool
43 generateStateFile(const std::string& statechartGroupXmlFilePath,
44 const std::string& statePath,
45 const std::string& packagePath,
46 const std::optional<std::string>& packageIncludePath = std::nullopt);
47
49 const std::string& statechartGroupXmlFilePath,
50 const std::string& packagePath,
51 const std::optional<std::string>& packageIncludePath = std::nullopt);
52
53 static bool
54 generateStateFile(const std::string& stateName,
55 RapidXmlReaderPtr reader,
56 std::filesystem::path buildDir,
57 const std::string& packageName,
58 const std::string& groupName,
59 const std::vector<std::string>& proxies,
60 bool contextGenerationEnabled,
61 const VariantInfoPtr& variantInfo,
62 bool forceRewrite,
63 const std::optional<std::string>& packageIncludePath = std::nullopt);
64
66 std::filesystem::path buildDir,
67 const std::string& packageName,
68 const std::string& groupName,
69 const std::vector<std::string>& proxies,
70 const VariantInfoPtr& variantInfo,
71 const std::set<std::string>& usedVariantTypes,
72 bool forceRewrite,
73 const std::optional<std::string>& packageIncludePath = std::nullopt);
74
75 static bool writeFileContentsIfChanged(const std::string& path,
76 const std::string& contents);
77
78 static void writeFileContents(const std::string& path, const std::string& contents);
79
81 const std::string& statechartGroupXmlFilePath,
82 const std::filesystem::path& buildDir,
83 bool forceRewrite,
84 const std::optional<std::string>& packageIncludePath = std::nullopt,
85 bool nextGenBehavior = false);
86
88 const std::string& packageName,
89 const std::string& statechartGroupXmlFilePath,
90 const std::filesystem::path& buildDir,
91 bool forceRewrite,
92 const std::string& dataDir,
93 const std::map<std::string, std::string>& dependencies,
94 const std::optional<std::string>& packageIncludePath = std::nullopt,
95 bool nextGenBehavior = false);
96
98 const std::string& packageName,
99 const std::string& statechartGroupXmlFilePath,
100 const std::filesystem::path& buildDir,
101 bool forceRewrite,
102 const std::string& dataDir,
103 const std::map<std::string, std::string>& dependencies,
104 const std::optional<std::string>& packageIncludePath = std::nullopt,
105 bool nextGenBehavior = false);
106
109 const std::filesystem::path& buildDir,
110 VariantInfoPtr variantInfo,
111 bool forceRewrite,
112 const std::optional<std::string>& packageIncludePath = std::nullopt,
113 bool nextGenBehavior = false);
114
115 private:
116 static std::set<std::string>
117 getVariantTypesOfStates(StatechartGroupXmlReaderPtr groupReader,
118 const VariantInfoPtr& variantInfo);
119
120 static std::set<std::string>
121 getVariantTypesOfStatesWithNoCpp(StatechartGroupXmlReaderPtr groupReader,
122 const VariantInfoPtr& variantInfo);
123 /**
124 * @brief Helper function to read VariantInfo files, if root package is not yet cmaked
125 */
126 static VariantInfoPtr
127 readVariantInfoWithPaths(const std::string& packageName,
128 const std::string& buildDir,
129 const std::string& dataDir,
130 const std::map<std::string, std::string>& dependencies);
131 };
132
133} // namespace armarx
static void writeFileContents(const std::string &path, const std::string &contents)
static bool generateStatechartGroupCMakeSourceListFiles(const std::string &packageName, const std::string &statechartGroupXmlFilePath, const std::filesystem::path &buildDir, bool forceRewrite, const std::string &dataDir, const std::map< std::string, std::string > &dependencies, const std::optional< std::string > &packageIncludePath=std::nullopt, bool nextGenBehavior=false)
static Ice::StringSeq findStatechartGroupFiles(const std::string &statechartsPath)
static bool generateStateFile(const std::string &statechartGroupXmlFilePath, const std::string &statePath, const std::string &packagePath, const std::optional< std::string > &packageIncludePath=std::nullopt)
static bool generateStatechartContextFile(const std::string &statechartGroupXmlFilePath, const std::string &packagePath, const std::optional< std::string > &packageIncludePath=std::nullopt)
static bool generateStatechartGroupCMakeSourceListFile(const std::string &statechartGroupXmlFilePath, const std::filesystem::path &buildDir, bool forceRewrite, const std::optional< std::string > &packageIncludePath=std::nullopt, bool nextGenBehavior=false)
static bool writeFileContentsIfChanged(const std::string &path, const std::string &contents)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< StatechartGroupXmlReader > StatechartGroupXmlReaderPtr
std::shared_ptr< RapidXmlReader > RapidXmlReaderPtr
std::shared_ptr< VariantInfo > VariantInfoPtr
Definition VariantInfo.h:39