DataStructuresConvert.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
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 #ifndef SURGSIM_DATASTRUCTURES_DATASTRUCTURESCONVERT_H
17 #define SURGSIM_DATASTRUCTURES_DATASTRUCTURESCONVERT_H
18 
19 #include <array>
20 #include <memory>
21 #include <unordered_map>
22 #include <unordered_set>
23 #include <yaml-cpp/yaml.h>
24 
27 
28 namespace YAML
29 {
30 
33 template <class T>
34 struct convert<SurgSim::DataStructures::OptionalValue<T>>
35 {
36  static Node encode(const SurgSim::DataStructures::OptionalValue<T>& rhs);
37  static bool decode(const Node& node, SurgSim::DataStructures::OptionalValue<T>& rhs); //NOLINT
38 };
39 
42 template <class Key, class T>
43 struct convert<std::unordered_map<Key, T>>
44 {
45  static Node encode(const std::unordered_map<Key, T>& rhs);
46  static bool decode(const Node& node, std::unordered_map<Key, T>& rhs); //NOLINT
47 };
48 
51 template <class Value>
52 struct convert<std::unordered_set<Value>>
53 {
54  static Node encode(const std::unordered_set<Value>& rhs);
55  static bool decode(const Node& node, std::unordered_set<Value>& rhs); //NOLINT
56 };
57 
58 } // namespace YAML
59 
61 
62 #endif // SURGSIM_DATASTRUCTURES_DATASTRUCTURESCONVERT_H
Macros.h
SurgSim::DataStructures::OptionalValue
Container class that can indicate whether the object has been assigned a value.
Definition: OptionalValue.h:30
OptionalValue.h
YAML
Definition: DataStructuresConvert.h:29
SURGSIM_DOUBLE_SPECIALIZATION
#define SURGSIM_DOUBLE_SPECIALIZATION
Definition: Macros.h:44
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Framework::convert
SurgSim::Math::Matrix44f convert(boost::any val)
Wrap boost::any_cast to use in std::bind, for some reason it does not work by itself.
Definition: Accessible.cpp:210
DataStructuresConvert-inl.h