/usr/include/vtk-6.3/vtkVariantBoostSerialization.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkVariantBoostSerialization.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*
* Copyright (C) 2008 The Trustees of Indiana University.
* Use, modification and distribution is subject to the Boost Software
* License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)
*/
// .NAME vtkVariantBoostSerialization - Serialization support for
// vtkVariant and vtkVariantArray using the Boost.Serialization
// library.
//
// .SECTION Description
// The header includes the templates required to serialize the
// vtkVariant and vtkVariantArray with the Boost.Serialization
// library. Just including the header suffices to get serialization
// support; no other action is needed.
#ifndef vtkVariantBoostSerialization_h
#define vtkVariantBoostSerialization_h
#include "vtkSetGet.h"
#include "vtkType.h"
#include "vtkVariant.h"
#include "vtkVariantArray.h"
// This include fixes header-ordering issues in Boost.Serialization
// prior to Boost 1.35.0.
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include <boost/serialization/split_free.hpp>
//----------------------------------------------------------------------------
// vtkStdString serialization code
//----------------------------------------------------------------------------
template<typename Archiver>
void serialize(Archiver& ar, vtkStdString& str,
const unsigned int vtkNotUsed(version))
{
ar & boost::serialization::base_object<std::string>(str);
}
//----------------------------------------------------------------------------
// vtkUnicodeString serialization code
//----------------------------------------------------------------------------
template<typename Archiver>
void save(Archiver& ar, const vtkUnicodeString& str,
const unsigned int vtkNotUsed(version))
{
std::string utf8(str.utf8_str());
ar & utf8;
}
template<typename Archiver>
void load(Archiver& ar, vtkUnicodeString& str,
const unsigned int vtkNotUsed(version))
{
std::string utf8;
ar & utf8;
str = vtkUnicodeString::from_utf8(utf8);
}
BOOST_SERIALIZATION_SPLIT_FREE(vtkUnicodeString)
//----------------------------------------------------------------------------
// vtkVariant serialization code
//----------------------------------------------------------------------------
template<typename Archiver>
void save(Archiver& ar, const vtkVariant& variant,
const unsigned int vtkNotUsed(version))
{
if (!variant.IsValid())
{
char null = 0;
ar & null;
return;
}
// Output the type
char Type = variant.GetType();
ar & Type;
// Output the value
#define VTK_VARIANT_SAVE(Value,Type,Function) \
case Value: \
{ \
Type value = variant.Function(); \
ar & value; \
} \
return
switch (Type)
{
VTK_VARIANT_SAVE(VTK_STRING,vtkStdString,ToString);
VTK_VARIANT_SAVE(VTK_UNICODE_STRING,vtkUnicodeString,ToUnicodeString);
VTK_VARIANT_SAVE(VTK_FLOAT,float,ToFloat);
VTK_VARIANT_SAVE(VTK_DOUBLE,double,ToDouble);
VTK_VARIANT_SAVE(VTK_CHAR,char,ToChar);
VTK_VARIANT_SAVE(VTK_UNSIGNED_CHAR,unsigned char,ToUnsignedChar);
VTK_VARIANT_SAVE(VTK_SHORT,short,ToShort);
VTK_VARIANT_SAVE(VTK_UNSIGNED_SHORT,unsigned short,ToUnsignedShort);
VTK_VARIANT_SAVE(VTK_INT,int,ToInt);
VTK_VARIANT_SAVE(VTK_UNSIGNED_INT,unsigned int,ToUnsignedInt);
VTK_VARIANT_SAVE(VTK_LONG,long,ToLong);
VTK_VARIANT_SAVE(VTK_UNSIGNED_LONG,unsigned long,ToUnsignedLong);
#if defined(VTK_TYPE_USE___INT64)
VTK_VARIANT_SAVE(VTK___INT64,vtkTypeInt64,ToTypeInt64);
VTK_VARIANT_SAVE(VTK_UNSIGNED___INT64,vtkTypeUInt64,ToTypeUInt64);
#endif
#if defined(VTK_TYPE_USE_LONG_LONG)
VTK_VARIANT_SAVE(VTK_LONG_LONG,long long,ToLongLong);
VTK_VARIANT_SAVE(VTK_UNSIGNED_LONG_LONG,unsigned long long,
ToUnsignedLongLong);
#endif
default:
cerr << "cannot serialize variant with type " << variant.GetType()
<< '\n';
}
#undef VTK_VARIANT_SAVE
}
template<typename Archiver>
void load(Archiver& ar, vtkVariant& variant,
const unsigned int vtkNotUsed(version))
{
char Type;
ar & Type;
#define VTK_VARIANT_LOAD(Value,Type) \
case Value: \
{ \
Type value; \
ar & value; \
variant = vtkVariant(value); \
} \
return
switch (Type)
{
case 0: variant = vtkVariant(); return;
VTK_VARIANT_LOAD(VTK_STRING,vtkStdString);
VTK_VARIANT_LOAD(VTK_UNICODE_STRING,vtkUnicodeString);
VTK_VARIANT_LOAD(VTK_FLOAT,float);
VTK_VARIANT_LOAD(VTK_DOUBLE,double);
VTK_VARIANT_LOAD(VTK_CHAR,char);
VTK_VARIANT_LOAD(VTK_UNSIGNED_CHAR,unsigned char);
VTK_VARIANT_LOAD(VTK_SHORT,short);
VTK_VARIANT_LOAD(VTK_UNSIGNED_SHORT,unsigned short);
VTK_VARIANT_LOAD(VTK_INT,int);
VTK_VARIANT_LOAD(VTK_UNSIGNED_INT,unsigned int);
VTK_VARIANT_LOAD(VTK_LONG,long);
VTK_VARIANT_LOAD(VTK_UNSIGNED_LONG,unsigned long);
#if defined(VTK_TYPE_USE___INT64)
VTK_VARIANT_LOAD(VTK___INT64,vtkTypeInt64);
VTK_VARIANT_LOAD(VTK_UNSIGNED___INT64,vtkTypeUInt64);
#endif
#if defined(VTK_TYPE_USE_LONG_LONG)
VTK_VARIANT_LOAD(VTK_LONG_LONG,long long);
VTK_VARIANT_LOAD(VTK_UNSIGNED_LONG_LONG,unsigned long long);
#endif
default:
cerr << "cannot deserialize variant with type " << static_cast<unsigned int>(Type) << '\n';
variant = vtkVariant();
}
#undef VTK_VARIANT_LOAD
}
BOOST_SERIALIZATION_SPLIT_FREE(vtkVariant)
//----------------------------------------------------------------------------
// vtkVariantArray serialization code
//----------------------------------------------------------------------------
template<typename Archiver>
void save(Archiver& ar, const vtkVariantArray& c_array,
const unsigned int vtkNotUsed(version))
{
vtkVariantArray& array = const_cast<vtkVariantArray&>(c_array);
// Array name
vtkStdString name;
if(array.GetName()!=NULL) name=array.GetName();
ar & name;
// Array data
vtkIdType n = array.GetNumberOfTuples();
ar & n;
for (vtkIdType i = 0; i < n; ++i)
{
ar & array.GetValue(i);
}
}
template<typename Archiver>
void load(Archiver& ar, vtkVariantArray& array,
const unsigned int vtkNotUsed(version))
{
// Array name
vtkStdString name;
ar & name;
array.SetName(name.c_str());
if(name.empty())
{
array.SetName(0);
}
else
{
array.SetName(name.c_str());
}
// Array data
vtkIdType n;
ar & n;
array.SetNumberOfTuples(n);
vtkVariant value;
for (vtkIdType i = 0; i < n; ++i)
{
ar & value;
array.SetValue(i, value);
}
}
BOOST_SERIALIZATION_SPLIT_FREE(vtkVariantArray)
#endif
// VTK-HeaderTest-Exclude: vtkVariantBoostSerialization.h
|