opensurgsim
NamedVariantData.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2012-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_NAMEDVARIANTDATA_H
17 #define SURGSIM_DATASTRUCTURES_NAMEDVARIANTDATA_H
18 
19 #include <boost/any.hpp>
20 #include "SurgSim/DataStructures/NamedData.h"
21 #include "SurgSim/DataStructures/NamedDataBuilder.h"
22 
23 namespace SurgSim
24 {
25 namespace DataStructures
26 {
27 
28 typedef NamedDataBuilder<boost::any> NamedVariantDataBuilder;
29 
38 
39 class NamedVariantData : public NamedData<boost::any>
40 {
41 public:
43 
45  NamedVariantData(const NamedData<boost::any>& namedData); //NOLINT
46 
55  template <typename T>
56  inline bool hasTypedData(int index) const;
57 
66  template <typename T>
67  inline bool hasTypedData(const std::string& name) const;
68 
78  template <typename T>
79  inline bool get(int index, T* value) const;
80 
90  template <typename T>
91  inline bool get(const std::string& name, T* value) const;
92 };
93 
94 }; // namespace DataStructures
95 }; // namespace SurgSim
96 
97 
98 #include "SurgSim/DataStructures/NamedVariantData-inl.h"
99 
100 
101 #endif // SURGSIM_DATASTRUCTURES_NAMEDVARIANTDATA_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
A NamedData collection of variant data type.
Definition: NamedVariantData.h:39
A templated dictionary in which data can be accessed by name or index, with immutable names & indices...
Definition: NamedData.h:102
bool hasTypedData(int index) const
Check whether the entry with the specified index contains valid data.
Definition: NamedVariantData-inl.h:36