serialization_extensions.h
Go to the documentation of this file.
1 
25 #ifndef TESSERACT_COMMON_SERIALIZATION_EXTENSIONS_H
26 #define TESSERACT_COMMON_SERIALIZATION_EXTENSIONS_H
27 
30 #include <boost/mpl/string.hpp>
32 
34 
35 CREATE_MEMBER_CHECK(extension_type);
36 
37 namespace tesseract_common
38 {
39 namespace serialization::xml
40 {
41 template <class T>
42 struct extension
43 {
44  template <class U>
46  {
47  using extension_type = typename U::extenstion;
48  };
49 
50  using extension_type = typename boost::mpl::eval_if<has_member_extension_type<T>,
52  boost::mpl::string<'.', 't', 'r', 's', 'x'>>::type;
53 
54  static constexpr const char* value = boost::mpl::c_str<extension::extension_type>::value;
55 };
56 } // namespace serialization::xml
57 
58 namespace serialization::binary
59 {
60 template <class T>
61 struct extension
62 {
63  template <class U>
65  {
66  using extension_type = typename U::extenstion;
67  };
68 
69  using extension_type = typename boost::mpl::eval_if<has_member_extension_type<T>,
71  boost::mpl::string<'.', 't', 'r', 's', 'b'>>::type;
72 
73  static constexpr const char* value = boost::mpl::c_str<extension::extension_type>::value;
74 };
75 } // namespace serialization::binary
76 } // namespace tesseract_common
77 
85 #define TESSERACT_CLASS_EXTENSION(T, X, B) \
86  namespace tesseract_common \
87  { \
88  namespace serialization::xml \
89  { \
90  template <> \
91  struct extension<T> \
92  { \
93  static constexpr const char* value = X; \
94  static_assert(value[0] == '.', "XML extension value must start with a '.'"); \
95  }; \
96  } \
97  namespace serialization::binary \
98  { \
99  template <> \
100  struct extension<T> \
101  { \
102  static constexpr const char* value = B; \
103  static_assert(value[0] == '.', "Binary extension value must start with a '.'"); \
104  }; \
105  } \
106  }
107 
108 #endif // TESSERACT_COMMON_SERIALIZATION_EXTENSIONS_H
tesseract_common
Definition: allowed_collision_matrix.h:19
tesseract_common::serialization::binary::extension::extension_type
typename boost::mpl::eval_if< has_member_extension_type< T >, traits_class_extension< T >, boost::mpl::string<'.', 't', 'r', 's', 'b'> >::type extension_type
Definition: serialization_extensions.h:71
tesseract_common::serialization::xml::extension
Definition: serialization_extensions.h:42
tesseract_common::serialization::xml::extension::traits_class_extension
Definition: serialization_extensions.h:45
sfinae_utils.h
macros.h
Common Tesseract Macros.
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
tesseract_common::serialization::binary::extension
Definition: serialization_extensions.h:61
tesseract_common::serialization::xml::extension::extension_type
typename boost::mpl::eval_if< has_member_extension_type< T >, traits_class_extension< T >, boost::mpl::string<'.', 't', 'r', 's', 'x'> >::type extension_type
Definition: serialization_extensions.h:52
tesseract_common::serialization::binary::extension::traits_class_extension
Definition: serialization_extensions.h:64
CREATE_MEMBER_CHECK
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH TESSERACT_COMMON_IGNORE_WARNINGS_POP CREATE_MEMBER_CHECK(extension_type)
tesseract_common::serialization::xml::extension::traits_class_extension::extension_type
typename U::extenstion extension_type
Definition: serialization_extensions.h:47
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#define TESSERACT_COMMON_IGNORE_WARNINGS_POP
Definition: macros.h:72
tesseract_common::serialization::binary::extension::value
static constexpr const char * value
Definition: serialization_extensions.h:73
tesseract_common::serialization::xml::extension::value
static constexpr const char * value
Definition: serialization_extensions.h:54
tesseract_common::serialization::binary::extension::traits_class_extension::extension_type
typename U::extenstion extension_type
Definition: serialization_extensions.h:66


tesseract_common
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:40