OSVR-Core
SerializationTraitExample_Simple.h
Go to the documentation of this file.
1 
12 // Copyright 2015 Sensics, Inc.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 
26 #ifndef INCLUDED_SerializationTraitExample_Simple_h_GUID_1CD49F21_AA18_4DBE_2019_1F40B6695E00
27 #define INCLUDED_SerializationTraitExample_Simple_h_GUID_1CD49F21_AA18_4DBE_2019_1F40B6695E00
28 
29 // Internal Includes
31 #include <osvr/Util/StdInt.h>
32 
33 // Library/third-party includes
34 // - none
35 
36 // Standard includes
37 // - none
38 
39 namespace osvr {
40 namespace common {
41  // Dummy example for your type.
42  struct YourSimpleType {
43  double A;
44  uint32_t B;
45  int16_t C;
46  };
47 
48  namespace serialization {
62  template <>
65  template <typename F, typename T> static void apply(F &f, T &val) {
66  f(val.A);
67  f(val.B);
68  f(val.C);
69  }
70  };
71 
72  } // namespace serialization
73 
74 } // namespace common
75 } // namespace osvr
76 #endif // INCLUDED_SerializationTraitExample_Simple_h_GUID_1CD49F21_AA18_4DBE_2019_1F40B6695E00
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
An alternate, simpler method of serializing things that are effectively structs is to explicitly spec...
Definition: SerializationTraits.h:153
Header wrapping the C99 standard stdint header.
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
typename F::template apply< Args... > apply
Apply an alias class.
Definition: Apply.h:44
Definition: SerializationTraitExample_Simple.h:42
Mandatory base class for SimpleStructSerialization specializations: allows detection of specializatio...
Definition: SerializationTraits.h:158