ROSEndEffector
ROS End-Effector package: provides a ROS-based set of standard interfaces to command robotics end-effectors in an agnostic fashion.
YamlWorker.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 <copyright holder> <email>
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __ROSEE_YAMLWORKER_H
18 #define __ROSEE_YAMLWORKER_H
19 
20 #define DEFAULT_ACTION_FOLDER "/configs/actions/"
21 
22 #include <memory>
23 
24 //yaml
25 #include <yaml-cpp/yaml.h>
26 
27 //to create directories
28 #include <end_effector/Utils.h>
29 
37 
40 
41 namespace ROSEE
42 {
43 
48 {
49 
50 public:
51 
55  YamlWorker ( );
56 
63  std::string createYamlFile ( const std::map < std::set <std::string> , ActionPrimitive* > mapOfActions,
64  const std::string actionName, std::string pathFolder ) ;
65 
72  std::string createYamlFile ( const Action* action, std::string pathFolder) ;
73  std::string createYamlFile ( const ActionGeneric::Ptr, std::string pathFolder) ;
74 
80  std::map < std::set < std::string>, ROSEE::ActionPrimitive::Ptr > parseYamlPrimitive (std::string fileWithPath);
81 
82  std::map < std::set < std::string>, ROSEE::ActionPrimitive::Ptr > parseYamlPrimitive (std::string fileWithPath, ROSEE::ActionPrimitive::Type);
83 
89  ROSEE::ActionComposed parseYamlComposed (std::string fileWithPath);
90 
96  std::shared_ptr < ROSEE::ActionTimed > parseYamlTimed ( std::string fileWithPath);
97 
98  ROSEE::ActionGeneric::Ptr parseYamlGeneric ( std::string fileWithPath );
99 
100 private:
106  std::string emitYaml ( const std::map < std::set <std::string> , ActionPrimitive* > ) ;
107 
113  std::string emitYaml ( const Action* action) ;
114  std::string emitYaml ( const ActionGeneric::Ptr action) ;
115 
116 
117 
118 };
119 
120 } //namespace ROSEE
121 
122 #endif // __ROSEE_YAMLWORKER_H
Virtual class, Base of all the primitive actions.
std::map< std::set< std::string >, ROSEE::ActionPrimitive::Ptr > parseYamlPrimitive(std::string fileWithPath)
Parse a yaml file and return the map with all the actions present in the file.
Definition: YamlWorker.cpp:144
std::shared_ptr< ROSEE::ActionTimed > parseYamlTimed(std::string fileWithPath)
Parse a timed Action.
Definition: YamlWorker.cpp:300
ROSEE::ActionGeneric::Ptr parseYamlGeneric(std::string fileWithPath)
Definition: YamlWorker.cpp:238
The pure virtual class representing an Action.
Definition: Action.h:71
A ActionComposed, which is formed by one or more Primitives (or even other composed).
std::shared_ptr< ActionGeneric > Ptr
Definition: ActionGeneric.h:35
std::shared_ptr< ActionPrimitive > Ptr
Type
Enum useful to discriminate each primitive action when, for example, we want to parse a file if you ...
std::string emitYaml(const std::map< std::set< std::string >, ActionPrimitive * >)
support functions for createYamlFile
Definition: YamlWorker.cpp:52
YamlWorker()
Costructor default.
Definition: YamlWorker.cpp:19
ROSEE::ActionComposed parseYamlComposed(std::string fileWithPath)
Parse a composed Action.
Definition: YamlWorker.cpp:218
std::string createYamlFile(const std::map< std::set< std::string >, ActionPrimitive * > mapOfActions, const std::string actionName, std::string pathFolder)
Create/overwrite yaml file and emit info on it about each ActionPrimitive inside the given mapOfActio...
Definition: YamlWorker.cpp:39