All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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);
38 };
39 
42 template <class T, size_t N>
43 struct convert<std::array<T, N>>
44 {
45  static Node encode(const std::array<T, N>& rhs);
46  static bool decode(const Node& node, std::array<T, N>& rhs);
47 };
48 
51 template <class Key, class T>
52 struct convert<std::unordered_map<Key, T>>
53 {
54  static Node encode(const std::unordered_map<Key, T>& rhs);
55  static bool decode(const Node& node, std::unordered_map<Key, T>& rhs);
56 };
57 
60 template <class Value>
61 struct convert<std::unordered_set<Value>>
62 {
63  static Node encode(const std::unordered_set<Value>& rhs);
64  static bool decode(const Node& node, std::unordered_set<Value>& rhs);
65 };
66 
67 } // namespace YAML
68 
70 
71 #endif // SURGSIM_DATASTRUCTURES_DATASTRUCTURESCONVERT_H
Container class that can indicate whether the object has been assigned a value.
Definition: OptionalValue.h:29
SurgSim::Math::Matrix44f convert(boost::any val)
Specialization for convert() to correctly cast Matrix44d to Matrix44f, will throw if the val is no...
Definition: Accessible.cpp:180
#define SURGSIM_DOUBLE_SPECIALIZATION
Definition: Macros.h:44