17 #ifndef vtkVariantBoostSerialization_h
18 #define vtkVariantBoostSerialization_h
20 #include "vtkSetGet.h"
29 #include <boost/archive/binary_oarchive.hpp>
31 #include <boost/serialization/base_object.hpp>
32 #include <boost/serialization/export.hpp>
33 #include <boost/serialization/extended_type_info_no_rtti.hpp>
34 #include <boost/serialization/split_free.hpp>
36 VTK_ABI_NAMESPACE_BEGIN
41 template <
typename Archiver>
44 ar& boost::serialization::base_object<std::string>(str);
49 template <
typename Archiver>
55 template <
typename Archiver>
67 template <
typename Archiver>
82 #define VTK_VARIANT_SAVE(Value, Type, Function) \
85 Type value = variant.Function(); \
106 std::cerr <<
"cannot serialize variant with type " << variant.
GetType() <<
'\n';
108 #undef VTK_VARIANT_SAVE
111 template <
typename Archiver>
117 #define VTK_VARIANT_LOAD(Value, Type) \
122 variant = vtkVariant(value); \
145 std::cerr <<
"cannot deserialize variant with type " <<
static_cast<unsigned int>(
Type)
149 #undef VTK_VARIANT_LOAD
152 VTK_ABI_NAMESPACE_END
156 VTK_ABI_NAMESPACE_BEGIN
162 template <typename Archiver>
169 if (array.
GetName() !=
nullptr)
182 template <
typename Archiver>
211 VTK_ABI_NAMESPACE_END
Wrapper around std::string to keep symbols short.
virtual void SetNumberOfTuples(vtkIdType numTuples)
Set the number of tuples (a component group) in the array.
An array holding vtkVariants.
#define VTK_UNSIGNED_SHORT
A type representing the union of many types.
virtual void SetName(const char *)
Set/get array's name.
void SetValue(vtkIdType id, ValueType value)
Set the data at a particular index.
void save(Archiver &ar, const std::string &str, const unsigned int version)
virtual char * GetName()
Set/get array's name.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
void serialize(Archiver &ar, vtkStdString &str, const unsigned int version)
#define VTK_UNSIGNED_CHAR
ValueType & GetValue(vtkIdType id) const
Get the data at a particular index.
#define VTK_VARIANT_LOAD(Value, Type)
#define VTK_UNSIGNED_LONG
unsigned int GetType() const
Get the type of the variant.
#define VTK_UNSIGNED_LONG_LONG
void load(Archiver &ar, std::string &str, const unsigned int version)
#define VTK_VARIANT_SAVE(Value, Type, Function)
bool IsValid() const
Get whether the variant value is valid.