/usr/include/vtk-6.2/vtkVariant.h is in libvtk6-dev 6.2.0+dfsg1-10build1.
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 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkVariant.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 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkVariant - A atomic type representing the union of many types
//
// .SECTION Description
//
// .SECTION Thanks
// Thanks to Patricia Crossno, Ken Moreland, Andrew Wilson and Brian Wylie from
// Sandia National Laboratories for their help in developing this class.
#ifndef vtkVariant_h
#define vtkVariant_h
#include "vtkCommonCoreModule.h" // For export macro
#include "vtkType.h" // To define type IDs and VTK_TYPE_USE_* flags
#include "vtkSystemIncludes.h" // To define ostream
#include "vtkSetGet.h" // For vtkNotUsed macro
#include "vtkStdString.h"
#include "vtkUnicodeString.h"
//
// The following should be eventually placed in vtkSetGet.h
//
//BTX
// This is same as extended template macro with an additional case for VTK_VARIANT
#define vtkExtraExtendedTemplateMacro(call) \
vtkExtendedTemplateMacro(call); \
vtkTemplateMacroCase(VTK_VARIANT, vtkVariant, call)
// This is same as Iterator Template macro with an additional case for VTK_VARIANT
#define vtkExtendedArrayIteratorTemplateMacro(call) \
vtkArrayIteratorTemplateMacro(call); \
vtkArrayIteratorTemplateMacroCase(VTK_VARIANT, vtkVariant, call);
//ETX
class vtkStdString;
class vtkUnicodeString;
class vtkObjectBase;
class vtkAbstractArray;
// workaround clang bug, needs export on forward declaration
#ifdef __clang__
class VTKCOMMONCORE_EXPORT vtkVariant;
#else
class vtkVariant;
#endif
struct vtkVariantLessThan;
//BTX
VTKCOMMONCORE_EXPORT ostream& operator << ( ostream& os, const vtkVariant& val );
//ETX
class VTKCOMMONCORE_EXPORT vtkVariant
{
public:
// Description:
// Create an invalid variant.
vtkVariant();
// Description:
// Destruct the variant.
~vtkVariant();
// Description:
// Copy constructor.
vtkVariant(const vtkVariant & other);
// Description:
// Create a bool variant. Internally store it as char.
vtkVariant(bool value);
// Description:
// Create a char variant.
vtkVariant(char value);
// Description:
// Create an unsigned char variant.
vtkVariant(unsigned char value);
// Description:
// Create a signed char variant.
vtkVariant(signed char value);
// Description:
// Create a short variant.
vtkVariant(short value);
// Description:
// Create an unsigned short variant.
vtkVariant(unsigned short value);
// Description:
// Create an integer variant.
vtkVariant(int value);
// Description:
// Create an unsigned integer variant.
vtkVariant(unsigned int value);
// Description:
// Create an long variant.
vtkVariant(long value);
// Description:
// Create an unsigned long variant.
vtkVariant(unsigned long value);
#if defined(VTK_TYPE_USE___INT64)
// Description:
// Create an __int64 variant.
vtkVariant(__int64 value);
// Description:
// Create an unsigned __int64 variant.
vtkVariant(unsigned __int64 value);
#endif
#if defined(VTK_TYPE_USE_LONG_LONG)
// Description:
// Create a long long variant.
vtkVariant(long long value);
// Description:
// Create an unsigned long long variant.
vtkVariant(unsigned long long value);
#endif
// Description:
// Create a float variant.
vtkVariant(float value);
// Description:
// Create a double variant.
vtkVariant(double value);
// Description:
// Create a string variant from a const char*.
vtkVariant(const char* value);
// Description:
// Create a string variant from a std string.
vtkVariant(vtkStdString value);
// Description:
// Create a Unicode string variant
vtkVariant(const vtkUnicodeString& value);
// Description:
// Create a vtkObjectBase variant.
vtkVariant(vtkObjectBase* value);
// Description:
// Create a variant of a specific type.
vtkVariant(const vtkVariant &other, unsigned int type);
// Description:
// Copy the value of one variant into another.
const vtkVariant & operator= (const vtkVariant & other);
// Description:
// Get whether the variant value is valid.
bool IsValid() const;
// Description:
// Get whether the variant is a string.
bool IsString() const;
// Description:
// Get whether the variant is a Unicode string.
bool IsUnicodeString() const;
// Description:
// Get whether the variant is any numeric type.
bool IsNumeric() const;
// Description:
// Get whether the variant is a float.
bool IsFloat() const;
// Description:
// Get whether the variant is a double.
bool IsDouble() const;
// Description:
// Get whether the variant is an char.
bool IsChar() const;
// Description:
// Get whether the variant is an unsigned char.
bool IsUnsignedChar() const;
// Description:
// Get whether the variant is an signed char.
bool IsSignedChar() const;
// Description:
// Get whether the variant is an short.
bool IsShort() const;
// Description:
// Get whether the variant is an unsigned short.
bool IsUnsignedShort() const;
// Description:
// Get whether the variant is an int.
bool IsInt() const;
// Description:
// Get whether the variant is an unsigned int.
bool IsUnsignedInt() const;
// Description:
// Get whether the variant is an long.
bool IsLong() const;
// Description:
// Get whether the variant is an unsigned long.
bool IsUnsignedLong() const;
// Description:
// Get whether the variant is an __int64.
bool Is__Int64() const;
// Description:
// Get whether the variant is an unsigned __int64.
bool IsUnsigned__Int64() const;
// Description:
// Get whether the variant is long long.
bool IsLongLong() const;
// Description:
// Get whether the variant is unsigned long long.
bool IsUnsignedLongLong() const;
// Description:
// Get whether the variant is a VTK object pointer.
bool IsVTKObject() const;
// Description:
// Get whether the variant is a VTK array (i.e. a subclass of vtkAbstractArray).
bool IsArray() const;
// Description:
// Get the type of the variant.
unsigned int GetType() const;
// Description:
// Get the type of the variant as a string.
const char* GetTypeAsString() const;
// Description:
// Convert the variant to a string.
vtkStdString ToString() const;
// Description:
// convert the variant to a Unicode string.
vtkUnicodeString ToUnicodeString() const;
// Description:
// Convert the variant to a numeric type:
// If it holds a numeric, cast to the appropriate type.
// If it holds a string, attempt to convert the string to the appropriate type;
// set the valid flag to false when the conversion fails.
// If it holds an array type, cast the first value of the array
// to the appropriate type.
// Fail if it holds a VTK object which is not an array.
float ToFloat(bool *valid) const;
float ToFloat() const {
return this->ToFloat(0); };
double ToDouble(bool *valid) const;
double ToDouble() const {
return this->ToDouble(0); };
char ToChar(bool *valid) const;
char ToChar() const {
return this->ToChar(0); };
unsigned char ToUnsignedChar(bool *valid) const;
unsigned char ToUnsignedChar() const {
return this->ToUnsignedChar(0); };
signed char ToSignedChar(bool *valid) const;
signed char ToSignedChar() const {
return this->ToSignedChar(0); };
short ToShort(bool *valid) const;
short ToShort() const {
return this->ToShort(0); };
unsigned short ToUnsignedShort(bool *valid) const;
unsigned short ToUnsignedShort() const {
return this->ToUnsignedShort(0); };
int ToInt(bool *valid) const;
int ToInt() const {
return this->ToInt(0); };
unsigned int ToUnsignedInt(bool *valid) const;
unsigned int ToUnsignedInt() const {
return this->ToUnsignedInt(0); };
long ToLong(bool *valid) const;
long ToLong() const {
return this->ToLong(0); };
unsigned long ToUnsignedLong(bool *valid) const;
unsigned long ToUnsignedLong() const {
return this->ToUnsignedLong(0); };
#if defined(VTK_TYPE_USE___INT64)
__int64 To__Int64(bool *valid) const;
__int64 To__Int64() const {
return this->To__Int64(0); };
unsigned __int64 ToUnsigned__Int64(bool *valid) const;
unsigned __int64 ToUnsigned__Int64() const {
return this->ToUnsigned__Int64(0); };
#endif
#if defined(VTK_TYPE_USE_LONG_LONG)
long long ToLongLong(bool *valid) const;
long long ToLongLong() const {
return this->ToLongLong(0); };
unsigned long long ToUnsignedLongLong(bool *valid) const;
unsigned long long ToUnsignedLongLong() const {
return this->ToUnsignedLongLong(0); };
#endif
vtkTypeInt64 ToTypeInt64(bool *valid) const;
vtkTypeInt64 ToTypeInt64() const {
return this->ToTypeInt64(0); };
vtkTypeUInt64 ToTypeUInt64(bool *valid) const;
vtkTypeUInt64 ToTypeUInt64() const {
return this->ToTypeUInt64(0); };
// Description:
// Return the VTK object, or NULL if not of that type.
vtkObjectBase* ToVTKObject() const;
// Description:
// Return the array, or NULL if not of that type.
vtkAbstractArray* ToArray() const;
// Description:
// Determines whether two variants have the same value. They do
// not need to be storing exactly the same type to have the same
// value. In practice you don't need to use this method: just use
// operator== instead. If you want precise equality down to the bit
// level use the following idiom:
//
// vtkVariantStrictEquality comparator;
// bool variantsEqual = comparator(firstVariant, secondVariant);
bool IsEqual(const vtkVariant& other) const;
// Description:
// Compare two variants for equality, greater than, and less than.
// These operators use the value represented by the variant instead
// of the particular type/bit pattern used to represent it. This
// behavior is similar to the default behavior in C and C++,
// including type promotion, with the following caveats:
//
// * When comparing type X with a string, type X will first be
// converted to string, then compared lexically (the usual
// behavior of string::operator< and company).
//
// * vtkObject pointers will be converted to an unsigned integer of
// appropriate size. If both variants contain vtkObjects then
// they are comparable directly.
//
// * Comparing char values with strings will not work the way you
// might expect if you're treating a char as a numeric type. Char
// values are written to strings as literal ASCII characters
// instead of numbers.
//
// This approach follows the principle of least surprise at the
// expense of speed. Casting integers to floating-point values is
// relatively slow. Casting numeric types to strings is very slow.
// If you prefer speed at the expense of counterintuitive behavior
// -- for example, when using vtkVariants as keys in STL containers
// -- you can use the functors described at the bottom of this file.
//
// The actual definitions of these operators are in
// vtkVariantInlineOperators.cxx.
bool operator==(const vtkVariant &other) const;
bool operator!=(const vtkVariant &other) const;
bool operator<(const vtkVariant &other) const;
bool operator>(const vtkVariant &other) const;
bool operator<=(const vtkVariant &other) const;
bool operator>=(const vtkVariant &other) const;
//BTX
friend VTKCOMMONCORE_EXPORT ostream& operator << ( ostream& os, const vtkVariant& val );
//ETX
private:
//BTX
template <typename T>
T ToNumeric(bool *valid, T* vtkNotUsed(ignored)) const;
union
{
vtkStdString* String;
vtkUnicodeString* UnicodeString;
float Float;
double Double;
char Char;
unsigned char UnsignedChar;
signed char SignedChar;
short Short;
unsigned short UnsignedShort;
int Int;
unsigned int UnsignedInt;
long Long;
unsigned long UnsignedLong;
#if defined(VTK_TYPE_USE___INT64)
__int64 __Int64;
unsigned __int64 Unsigned__Int64;
#endif
#if defined(VTK_TYPE_USE_LONG_LONG)
long long LongLong;
unsigned long long UnsignedLongLong;
#endif
vtkObjectBase* VTKObject;
} Data;
unsigned char Valid;
unsigned char Type;
friend struct vtkVariantLessThan;
friend struct vtkVariantEqual;
friend struct vtkVariantStrictWeakOrder;
friend struct vtkVariantStrictEquality;
//ETX
};
//BTX
#include "vtkVariantInlineOperators.h" // needed for operator== and company
// A STL-style function object so you can compare two variants using
// comp(s1,s2) where comp is an instance of vtkVariantStrictWeakOrder.
// This is a faster version of operator< that makes no attempt to
// compare values. It satisfies the STL requirement for a comparison
// function for ordered containers like map and set.
struct VTKCOMMONCORE_EXPORT vtkVariantLessThan
{
public:
bool operator()(const vtkVariant &s1, const vtkVariant &s2) const;
};
struct VTKCOMMONCORE_EXPORT vtkVariantEqual
{
public:
bool operator()(const vtkVariant &s1, const vtkVariant &s2) const;
};
struct VTKCOMMONCORE_EXPORT vtkVariantStrictWeakOrder
{
public:
bool operator()(const vtkVariant& s1, const vtkVariant& s2) const;
};
// Similarly, this is a fast version of operator== that requires that
// the types AND the values be equal in order to admit equality.
struct VTKCOMMONCORE_EXPORT vtkVariantStrictEquality
{
public:
bool operator()(const vtkVariant &s1, const vtkVariant &s2) const;
};
//ETX
#endif
// VTK-HeaderTest-Exclude: vtkVariant.h
|