PCL
pcl::Variant Class Reference

Acts like a union to store instances of different data types. More...

#include <Variant.h>

Public Types

typedef VariantType::value_type data_type
 

Public Member Functions

 Variant ()
 
 Variant (bool b)
 
 Variant (int8 i8)
 
 Variant (int16 i16)
 
 Variant (int32 i32)
 
 Variant (int64 i64)
 
 Variant (uint8 u8)
 
 Variant (uint16 u16)
 
 Variant (uint32 u32)
 
 Variant (uint64 u64)
 
 Variant (float f)
 
 Variant (double d)
 
 Variant (fcomplex fc)
 
 Variant (dcomplex dc)
 
 Variant (const TimePoint &t)
 
 Variant (const Point &p)
 
 Variant (const FPoint &fp)
 
 Variant (const DPoint &dp)
 
 Variant (const Rect &r)
 
 Variant (const FRect &fr)
 
 Variant (const DRect &dr)
 
 Variant (const CharVector &cv)
 
 Variant (const ByteVector &bv)
 
 Variant (const I16Vector &i16v)
 
 Variant (const UI16Vector &ui16v)
 
 Variant (const IVector &iv)
 
 Variant (const UIVector &uiv)
 
 Variant (const I64Vector &i64v)
 
 Variant (const UI64Vector &ui64v)
 
 Variant (const FVector &fv)
 
 Variant (const DVector &dv)
 
 Variant (const C32Vector &c32v)
 
 Variant (const C64Vector &c64v)
 
 Variant (const CharMatrix &cm)
 
 Variant (const ByteMatrix &bm)
 
 Variant (const I16Matrix &i16m)
 
 Variant (const UI16Matrix &ui16m)
 
 Variant (const IMatrix &im)
 
 Variant (const UIMatrix &uim)
 
 Variant (const I64Matrix &i64m)
 
 Variant (const UI64Matrix &ui64m)
 
 Variant (const FMatrix &fm)
 
 Variant (const DMatrix &dm)
 
 Variant (const C32Matrix &c32m)
 
 Variant (const C64Matrix &c64m)
 
 Variant (const ByteArray &ba)
 
 Variant (const String &s)
 
 Variant (const IsoString &s8)
 
 Variant (const char *cp)
 
 Variant (const StringList &sl)
 
 Variant (const IsoStringList &isl)
 
 Variant (const StringKeyValue &skv)
 
 Variant (const IsoStringKeyValue &iskv)
 
 Variant (const StringKeyValueList &skvl)
 
 Variant (const IsoStringKeyValueList &iskvl)
 
 Variant (const Variant &x)
 
 Variant (Variant &&x)
 
virtual ~Variant ()
 
void Assign (const Variant &x)
 
size_type BlockSize () const
 
int BytesPerBlockElement () const
 
void Clear ()
 
int Compare (const Variant &x) const
 
const void * InternalBlockAddress () const
 
bool IsComplex () const
 
bool IsMatrix () const
 
bool IsScalar () const
 
bool IsString () const
 
bool IsStructured () const
 
bool IsTimePoint () const
 
bool IsValid () const
 
bool IsVector () const
 
Rect MatrixDimensions () const
 
bool operator< (const Variant &x) const
 
Variantoperator= (const Variant &x)
 
Variantoperator= (Variant &&x)
 
bool operator== (const Variant &x) const
 
bool ToBool () const
 
bool ToBoolean () const
 
ByteArray ToByteArray () const
 
ByteMatrix ToByteMatrix () const
 
ByteVector ToByteVector () const
 
C32Matrix ToC32Matrix () const
 
C32Vector ToC32Vector () const
 
C64Matrix ToC64Matrix () const
 
C64Vector ToC64Vector () const
 
CharMatrix ToCharMatrix () const
 
CharVector ToCharVector () const
 
complex ToComplex () const
 
dcomplex ToDComplex () const
 
DMatrix ToDMatrix () const
 
double ToDouble () const
 
DPoint ToDPoint () const
 
DRect ToDRect () const
 
DVector ToDVector () const
 
fcomplex ToFComplex () const
 
float ToFloat () const
 
FMatrix ToFMatrix () const
 
FPoint ToFPoint () const
 
FRect ToFRect () const
 
FVector ToFVector () const
 
I16Matrix ToI16Matrix () const
 
I16Vector ToI16Vector () const
 
I64Matrix ToI64Matrix () const
 
I64Vector ToI64Vector () const
 
IMatrix ToIMatrix () const
 
int ToInt () const
 
int64 ToInt64 () const
 
IsoString ToIsoString () const
 
IsoStringKeyValue ToIsoStringKeyValue () const
 
IsoStringKeyValueList ToIsoStringKeyValueList () const
 
IsoStringList ToIsoStringList () const
 
IVector ToIVector () const
 
Matrix ToMatrix () const
 
Point ToPoint () const
 
Rect ToRect () const
 
String ToString () const
 
StringKeyValue ToStringKeyValue () const
 
StringKeyValueList ToStringKeyValueList () const
 
StringList ToStringList () const
 
TimePoint ToTimePoint () const
 
Variant ToType (data_type type) const
 
UI16Matrix ToUI16Matrix () const
 
UI16Vector ToUI16Vector () const
 
UI64Matrix ToUI64Matrix () const
 
UI64Vector ToUI64Vector () const
 
UIMatrix ToUIMatrix () const
 
unsigned int ToUInt () const
 
uint64 ToUInt64 () const
 
UIVector ToUIVector () const
 
Vector ToVector () const
 
void Transfer (Variant &x)
 
void Transfer (Variant &&x)
 
data_type Type () const
 
size_type VectorLength () const
 

Static Public Member Functions

static int BytesPerBlockElementForType (int type)
 
static bool IsComplexType (int type)
 
static bool IsMatrixType (int type)
 
static bool IsScalarType (int type)
 
static bool IsStringType (int type)
 
static bool IsStructuredType (int type)
 
static bool IsTimePointType (int type)
 
static bool IsVectorType (int type)
 
static const char * TypeAsString (int type)
 

Detailed Description

Sometimes you have to implement a single class or function able to work with several data types. In C++ and other languages supporting template metaprogramming, the obvious way to implement this functionality is by using class or function templates.

However, in order to use templates all of the types must be known without ambiguity at compile time, which is not always feasible. When the data types can only be known at runtime, variant constructs are the only practical way to implement code able to work with multiple data types dynamically.

An instance of the Variant class can store one object of any of the supported Variant types, which have been enumerated in the VariantType namespace. In this way Variant can be used as a sort of envelope to transport objects of different types under a common interface.

Variant supports explicit type conversions through a set of dedicated ToXXX() member functions. For example, one of the most useful and often used conversion functions is Variant::ToString():

Variant v( 3 ); // v transports an integer value
Console().WriteLn( v.ToString() ); // writes "3" to the console

This conversion function is extremely useful for object serialization. Using this conversion, a function can generate string representations of all the data types supported by Variant:

void PrintVariable( const String& name, const Variant& value )
{
Console().WriteLn( name + " = " + value.ToString() );
}

A Variant instance owns its stored object and cannot share it with other objects, including other Variant instances; it can only provide temporary rvalues generated from its stored object, but never references to it. This prevents unexpected object destruction and other problems with the objects transported by Variant instances.

Variant is an essential component of the introspection mechanisms implemented by the Process, ProcessParameter and ProcessInstance classes. Thanks to Variant, these classes are able to represent and interface with any installed process on the PixInsight platform.

Definition at line 331 of file Variant.h.

Member Typedef Documentation

◆ data_type

typedef VariantType::value_type pcl::Variant::data_type

An enumeration of all supported Variant data types.

Definition at line 338 of file Variant.h.

Constructor & Destructor Documentation

◆ Variant() [1/57]

pcl::Variant::Variant ( )
inline

Constructs an invalid Variant instance that stores no object.

Definition at line 343 of file Variant.h.

◆ Variant() [2/57]

pcl::Variant::Variant ( bool  b)
inline

Constructs a Variant instance to store a bool value.

Definition at line 351 of file Variant.h.

◆ Variant() [3/57]

pcl::Variant::Variant ( int8  i8)
inline

Constructs a Variant instance to store a signed 8-bit integer value.

Definition at line 359 of file Variant.h.

◆ Variant() [4/57]

pcl::Variant::Variant ( int16  i16)
inline

Constructs a Variant instance to store a signed 16-bit integer value.

Definition at line 367 of file Variant.h.

◆ Variant() [5/57]

pcl::Variant::Variant ( int32  i32)
inline

Constructs a Variant instance to store a signed 32-bit integer value.

Definition at line 375 of file Variant.h.

◆ Variant() [6/57]

pcl::Variant::Variant ( int64  i64)
inline

Constructs a Variant instance to store a signed 64-bit integer value.

Definition at line 383 of file Variant.h.

◆ Variant() [7/57]

pcl::Variant::Variant ( uint8  u8)
inline

Constructs a Variant instance to store an unsigned 8-bit integer value.

Definition at line 391 of file Variant.h.

◆ Variant() [8/57]

pcl::Variant::Variant ( uint16  u16)
inline

Constructs a Variant instance to store an unsigned 16-bit integer value.

Definition at line 399 of file Variant.h.

◆ Variant() [9/57]

pcl::Variant::Variant ( uint32  u32)
inline

Constructs a Variant instance to store an unsigned 32-bit integer value.

Definition at line 407 of file Variant.h.

◆ Variant() [10/57]

pcl::Variant::Variant ( uint64  u64)
inline

Constructs a Variant instance to store an unsigned 64-bit integer value.

Definition at line 415 of file Variant.h.

◆ Variant() [11/57]

pcl::Variant::Variant ( float  f)
inline

Constructs a Variant instance to store a float value (32-bit floating point).

Definition at line 424 of file Variant.h.

◆ Variant() [12/57]

pcl::Variant::Variant ( double  d)
inline

Constructs a Variant instance to store a double value (64-bit floating point).

Definition at line 433 of file Variant.h.

◆ Variant() [13/57]

pcl::Variant::Variant ( fcomplex  fc)
inline

Constructs a Variant instance to store a complex number with float components (fcomplex).

Definition at line 442 of file Variant.h.

◆ Variant() [14/57]

pcl::Variant::Variant ( dcomplex  dc)
inline

Constructs a Variant instance to store a complex number with double components (dcomplex).

Definition at line 452 of file Variant.h.

◆ Variant() [15/57]

pcl::Variant::Variant ( const TimePoint t)
inline

Constructs a Variant instance to store a time point value (TimePoint).

Definition at line 461 of file Variant.h.

◆ Variant() [16/57]

pcl::Variant::Variant ( const Point p)
inline

Constructs a Variant instance to store a two-dimensional point with integer coordinates (Point).

Definition at line 471 of file Variant.h.

◆ Variant() [17/57]

pcl::Variant::Variant ( const FPoint fp)
inline

Constructs a Variant instance to store a two-dimensional point with float coordinates (FPoint).

Definition at line 481 of file Variant.h.

◆ Variant() [18/57]

pcl::Variant::Variant ( const DPoint dp)
inline

Constructs a Variant instance to store a two-dimensional point with double coordinates (DPoint).

Definition at line 491 of file Variant.h.

◆ Variant() [19/57]

pcl::Variant::Variant ( const Rect r)
inline

Constructs a Variant instance to store a two-dimensional rectangle with integer coordinates (Rect).

Definition at line 501 of file Variant.h.

◆ Variant() [20/57]

pcl::Variant::Variant ( const FRect fr)
inline

Constructs a Variant instance to store a two-dimensional rectangle with float coordinates (FRect).

Definition at line 511 of file Variant.h.

◆ Variant() [21/57]

pcl::Variant::Variant ( const DRect dr)
inline

Constructs a Variant instance to store a two-dimensional rectangle with double coordinates (DRect).

Definition at line 521 of file Variant.h.

◆ Variant() [22/57]

pcl::Variant::Variant ( const CharVector cv)
inline

Constructs a Variant instance to store a vector of 8-bit signed integer components (CharVector).

Definition at line 531 of file Variant.h.

◆ Variant() [23/57]

pcl::Variant::Variant ( const ByteVector bv)
inline

Constructs a Variant instance to store a vector of 8-bit unsigned integer components (ByteVector).

Definition at line 541 of file Variant.h.

◆ Variant() [24/57]

pcl::Variant::Variant ( const I16Vector i16v)
inline

Constructs a Variant instance to store a vector of 16-bit signed integer components (I16Vector).

Definition at line 551 of file Variant.h.

◆ Variant() [25/57]

pcl::Variant::Variant ( const UI16Vector ui16v)
inline

Constructs a Variant instance to store a vector of 16-bit unsigned integer components (UI16Vector).

Definition at line 561 of file Variant.h.

◆ Variant() [26/57]

pcl::Variant::Variant ( const IVector iv)
inline

Constructs a Variant instance to store a vector of 32-bit signed integer components (IVector).

Definition at line 571 of file Variant.h.

◆ Variant() [27/57]

pcl::Variant::Variant ( const UIVector uiv)
inline

Constructs a Variant instance to store a vector of 32-bit unsigned integer components (UIVector).

Definition at line 581 of file Variant.h.

◆ Variant() [28/57]

pcl::Variant::Variant ( const I64Vector i64v)
inline

Constructs a Variant instance to store a vector of 64-bit signed integer components (I64Vector).

Definition at line 591 of file Variant.h.

◆ Variant() [29/57]

pcl::Variant::Variant ( const UI64Vector ui64v)
inline

Constructs a Variant instance to store a vector of 64-bit unsigned integer components (UI64Vector).

Definition at line 601 of file Variant.h.

◆ Variant() [30/57]

pcl::Variant::Variant ( const FVector fv)
inline

Constructs a Variant instance to store a vector of 32-bit floating point real components (FVector).

Definition at line 611 of file Variant.h.

◆ Variant() [31/57]

pcl::Variant::Variant ( const DVector dv)
inline

Constructs a Variant instance to store a vector of 64-bit floating point real components (DVector).

Definition at line 621 of file Variant.h.

◆ Variant() [32/57]

pcl::Variant::Variant ( const C32Vector c32v)
inline

Constructs a Variant instance to store a vector of 32-bit floating point complex components (C32Vector).

Definition at line 631 of file Variant.h.

◆ Variant() [33/57]

pcl::Variant::Variant ( const C64Vector c64v)
inline

Constructs a Variant instance to store a vector of 64-bit floating point complex components (C64Vector).

Definition at line 641 of file Variant.h.

◆ Variant() [34/57]

pcl::Variant::Variant ( const CharMatrix cm)
inline

Constructs a Variant instance to store a matrix of 8-bit signed integer elements (CharMatrix).

Definition at line 651 of file Variant.h.

◆ Variant() [35/57]

pcl::Variant::Variant ( const ByteMatrix bm)
inline

Constructs a Variant instance to store a matrix of 8-bit unsigned integer elements (ByteMatrix).

Definition at line 661 of file Variant.h.

◆ Variant() [36/57]

pcl::Variant::Variant ( const I16Matrix i16m)
inline

Constructs a Variant instance to store a matrix of 16-bit signed integer elements (I16Matrix).

Definition at line 671 of file Variant.h.

◆ Variant() [37/57]

pcl::Variant::Variant ( const UI16Matrix ui16m)
inline

Constructs a Variant instance to store a matrix of 16-bit unsigned integer elements (UI16Matrix).

Definition at line 681 of file Variant.h.

◆ Variant() [38/57]

pcl::Variant::Variant ( const IMatrix im)
inline

Constructs a Variant instance to store a matrix of 32-bit signed integer elements (IMatrix).

Definition at line 691 of file Variant.h.

◆ Variant() [39/57]

pcl::Variant::Variant ( const UIMatrix uim)
inline

Constructs a Variant instance to store a matrix of 32-bit unsigned integer elements (UIMatrix).

Definition at line 701 of file Variant.h.

◆ Variant() [40/57]

pcl::Variant::Variant ( const I64Matrix i64m)
inline

Constructs a Variant instance to store a matrix of 64-bit integer elements (I64Matrix).

Definition at line 711 of file Variant.h.

◆ Variant() [41/57]

pcl::Variant::Variant ( const UI64Matrix ui64m)
inline

Constructs a Variant instance to store a matrix of 64-bit unsigned integer elements (UI64Matrix).

Definition at line 721 of file Variant.h.

◆ Variant() [42/57]

pcl::Variant::Variant ( const FMatrix fm)
inline

Constructs a Variant instance to store a matrix of 32-bit floating point real elements (FMatrix).

Definition at line 731 of file Variant.h.

◆ Variant() [43/57]

pcl::Variant::Variant ( const DMatrix dm)
inline

Constructs a Variant instance to store a matrix of 64-bit floating point real elements (DMatrix).

Definition at line 741 of file Variant.h.

◆ Variant() [44/57]

pcl::Variant::Variant ( const C32Matrix c32m)
inline

Constructs a Variant instance to store a matrix of 32-bit floating point complex elements (C32Matrix).

Definition at line 751 of file Variant.h.

◆ Variant() [45/57]

pcl::Variant::Variant ( const C64Matrix c64m)
inline

Constructs a Variant instance to store a matrix of 64-bit floating point complex elements (C64Matrix).

Definition at line 761 of file Variant.h.

◆ Variant() [46/57]

pcl::Variant::Variant ( const ByteArray ba)
inline

Constructs a Variant instance to store a dynamic array of unsigned 8-bit integers (ByteArray).

Definition at line 771 of file Variant.h.

◆ Variant() [47/57]

pcl::Variant::Variant ( const String s)
inline

Constructs a Variant instance to store a UTF-16 Unicode string (String).

Definition at line 780 of file Variant.h.

◆ Variant() [48/57]

pcl::Variant::Variant ( const IsoString s8)
inline

Constructs a Variant instance to store an 8-bit ISO/IEC 8859-1 or UTF-8 Unicode string (IsoString).

Definition at line 790 of file Variant.h.

◆ Variant() [49/57]

pcl::Variant::Variant ( const char *  cp)
inline

Constructs a Variant instance to store an 8-bit ISO/IEC 8859-1 or UTF-8 Unicode string (IsoString), constructed from a null-terminated C string.

Definition at line 800 of file Variant.h.

◆ Variant() [50/57]

pcl::Variant::Variant ( const StringList sl)
inline

Constructs a Variant instance to store a list of UTF-16 Unicode strings (StringList).

Definition at line 810 of file Variant.h.

◆ Variant() [51/57]

pcl::Variant::Variant ( const IsoStringList isl)
inline

Constructs a Variant instance to store a list of 8-bit strings (IsoStringList).

Definition at line 820 of file Variant.h.

◆ Variant() [52/57]

pcl::Variant::Variant ( const StringKeyValue skv)
inline

Constructs a Variant instance to store a key/value pair of UTF-16 Unicode strings (StringKeyValue).

Definition at line 830 of file Variant.h.

◆ Variant() [53/57]

pcl::Variant::Variant ( const IsoStringKeyValue iskv)
inline

Constructs a Variant instance to store a key/value pair of 8-bit strings (IsoStringKeyValue).

Definition at line 840 of file Variant.h.

◆ Variant() [54/57]

pcl::Variant::Variant ( const StringKeyValueList skvl)
inline

Constructs a Variant instance to store a list of key/value pairs of UTF-16 Unicode strings (StringKeyValueList).

Definition at line 850 of file Variant.h.

◆ Variant() [55/57]

pcl::Variant::Variant ( const IsoStringKeyValueList iskvl)
inline

Constructs a Variant instance to store a list of key/value pairs of 8-bit strings (IsoStringKeyValueList).

Definition at line 860 of file Variant.h.

◆ Variant() [56/57]

pcl::Variant::Variant ( const Variant x)
inline

Copy constructor. This Variant will store a copy of the object stored in another Variant x.

Definition at line 870 of file Variant.h.

◆ Variant() [57/57]

pcl::Variant::Variant ( Variant &&  x)
inline

Move constructor.

Definition at line 879 of file Variant.h.

◆ ~Variant()

virtual pcl::Variant::~Variant ( )
inlinevirtual

Virtual destructor. The object stored in this Variant will be destroyed.

Definition at line 889 of file Variant.h.

Member Function Documentation

◆ Assign()

void pcl::Variant::Assign ( const Variant x)
inline

Causes this Variant to store a copy of the object stored in another Variant x.

Definition at line 908 of file Variant.h.

◆ BlockSize()

size_type pcl::Variant::BlockSize ( ) const

Returns the size in bytes of the scalar, complex, point, rectangle, vector or matrix object transported by this Variant object.

The value returned by this function can be used along with InternalBlockAddress() for object serialization purposes.

If this Variant does not transport a scalar, complex, vector-like or matrix object, this member function throws an Error exception.

◆ BytesPerBlockElement()

int pcl::Variant::BytesPerBlockElement ( ) const
inline

Returns the length in bytes of a block element, if this Variant object transports a scalar, complex, vector, matrix or string object.

If this Variant does not transport a scalar, complex, vector-like or matrix object, this function throws an Error exception.

Definition at line 1585 of file Variant.h.

◆ BytesPerBlockElementForType()

static int pcl::Variant::BytesPerBlockElementForType ( int  type)
static

Returns the length in bytes of a block element for the specified type.

type must be a scalar, complex, vector, matrix or string type. Otherwise this function will throw an Error exception.

◆ Clear()

void pcl::Variant::Clear ( )

Destroys the object stored in this Variant and leaves this object in an invalid state.

◆ Compare()

int pcl::Variant::Compare ( const Variant x) const

Compares the object stored in this Variant with the object stored in another Variant x.

If both Variant instances store objects of different types, the object in x is converted to the type of this Variant as a temporary object, and the comparison is made between the object in this variant and the temporary object. If the object in x cannot be converted to the type of this Variant, an Error exception is thrown.

On success, returns an integer indicating the comparison result:

0 if the objects are equal.
-1 if this object precedes the object in x.
+1 if this object postcedes the object in x.

See also
operator ==(), operator <()

◆ InternalBlockAddress()

const void* pcl::Variant::InternalBlockAddress ( ) const

Returns a pointer to the immutable block of data stored in this Variant object.

For scalar and complex data types (bool, int32, float, fcomplex, etc.), this member function returns a pointer to the transported object.

For vector, matrix and string types, this function returns the starting address of the contiguous data block stored by the transported object. For example, if a ByteArray object is being transported by this Variant object, this function returns ByteArray::Begin().

For other structured types such as points, rectangles and lists, this function throws an Error exception.

◆ IsComplex()

bool pcl::Variant::IsComplex ( ) const
inline

Returns true only if the object transported by this Variant is of a complex type: Complex32 or Complex64.

Definition at line 1620 of file Variant.h.

◆ IsComplexType()

static bool pcl::Variant::IsComplexType ( int  type)
inlinestatic

Returns true only if the specified type is a complex Variant type: Complex32 or Complex64.

Definition at line 1611 of file Variant.h.

◆ IsMatrix()

bool pcl::Variant::IsMatrix ( ) const
inline

Returns true only if the object transported by this Variant is of a matrix type: CharMatrix, ByteMatrix, IMatrix, UIMatrix, I64Matrix, UI64Matrix, FMatrix or DMatrix.

Definition at line 1671 of file Variant.h.

◆ IsMatrixType()

static bool pcl::Variant::IsMatrixType ( int  type)
static

Returns true only if the specified type is a matrix Variant type: CharMatrix, ByteMatrix, IMatrix, UIMatrix, I64Matrix, UI64Matrix, FMatrix or DMatrix.

◆ IsScalar()

bool pcl::Variant::IsScalar ( ) const
inline

Returns true only if the object transported by this Variant is of a scalar type: bool, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float or double.

Definition at line 1602 of file Variant.h.

◆ IsScalarType()

static bool pcl::Variant::IsScalarType ( int  type)
static

Returns true only if the specified type is a scalar Variant type: bool, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float or double.

◆ IsString()

bool pcl::Variant::IsString ( ) const
inline

Returns true only if the object transported by this Variant is of a character string type: String or IsoString.

Definition at line 1689 of file Variant.h.

◆ IsStringType()

static bool pcl::Variant::IsStringType ( int  type)
inlinestatic

Returns true only if the specified type is a character string Variant type: String or IsoString.

Definition at line 1680 of file Variant.h.

◆ IsStructured()

bool pcl::Variant::IsStructured ( ) const
inline

Returns true only if the object transported by this Variant is of a structured type: fcomplex, dcomplex, Point, FPoint, DPoint, Rect, FRect, DRect, StringList, IsoStringList, StringKeyValue, IsoStringKeyValue, StringKeyValueList or IsoStringKeyValueList.

For structured objects the InternalBlockAddress() and BlockSize() member functions cannot be used, since these objects cannot be accessed through a unique pointer and a length in bytes.

Definition at line 1712 of file Variant.h.

◆ IsStructuredType()

static bool pcl::Variant::IsStructuredType ( int  type)
static

Returns true only if the specified type is a structured Variant type: fcomplex, dcomplex, Point, FPoint, DPoint, Rect, FRect, DRect, StringList, IsoStringList, StringKeyValue, IsoStringKeyValue, StringKeyValueList or IsoStringKeyValueList.

◆ IsTimePoint()

bool pcl::Variant::IsTimePoint ( ) const
inline

Returns true only if the object transported by this Variant is of the TimePoint type.

Definition at line 1637 of file Variant.h.

◆ IsTimePointType()

static bool pcl::Variant::IsTimePointType ( int  type)
inlinestatic

Returns true only if the specified type is VariantType::TimePoint.

Definition at line 1628 of file Variant.h.

◆ IsValid()

bool pcl::Variant::IsValid ( ) const
inline

Returns true iff this Variant stores an object. Returns false if this is an invalid Variant object.

Definition at line 960 of file Variant.h.

◆ IsVector()

bool pcl::Variant::IsVector ( ) const
inline

Returns true only if the object transported by this Variant is of a vector or vector-like type: CharVector, ByteVector, IVector, UIVector, I64Vector, UI64Vector, FVector, DVector, ByteArray, String or IsoString.

Definition at line 1654 of file Variant.h.

◆ IsVectorType()

static bool pcl::Variant::IsVectorType ( int  type)
static

Returns true only if the specified type is a vector or vector-like Variant type: CharVector, ByteVector, IVector, UIVector, I64Vector, UI64Vector, FVector, DVector, ByteArray, String or IsoString.

◆ MatrixDimensions()

Rect pcl::Variant::MatrixDimensions ( ) const

Returns the dimensions of the matrix stored in this Variant object.

If this Variant does not transport a matrix object (IMatrix, FMatrix, DMatrix), this member function throws an Error exception.

The returned rectangle is anchored at {0,0} and has the same dimensions as the transported matrix: Rect::Height() or Rect::y1 is the number of matrix rows, and Rect::Width() or Rect::x1 is the number of matrix columns.

◆ operator<()

bool pcl::Variant::operator< ( const Variant x) const
inline

Returns true iff the object stored in this Variant precedes the object in another Variant x.

This operator is equivalent to:

Compare( x ) < 0;

Definition at line 1032 of file Variant.h.

References pcl::Compare().

◆ operator=() [1/2]

Variant& pcl::Variant::operator= ( const Variant x)
inline

Copy assignment operator. This Variant will store a copy of the object stored in another Variant x. Returns a reference to this object.

Definition at line 898 of file Variant.h.

◆ operator=() [2/2]

Variant& pcl::Variant::operator= ( Variant &&  x)
inline

Move assignment operator.

Definition at line 920 of file Variant.h.

◆ operator==()

bool pcl::Variant::operator== ( const Variant x) const
inline

Returns true iff the object stored in this Variant is equal to the object in another Variant x.

This operator is equivalent to:

Compare( x ) == 0;

Definition at line 1019 of file Variant.h.

References pcl::Compare().

◆ ToBool()

bool pcl::Variant::ToBool ( ) const

Converts the object stored in this Variant to a Boolean value, and returns the result of the conversion.

Throws an Error exception if a Boolean conversion is not possible for the object currently stored in this Variant.

◆ ToBoolean()

bool pcl::Variant::ToBoolean ( ) const
inline

A convenience synonym for ToBool().

Definition at line 1049 of file Variant.h.

◆ ToByteArray()

ByteArray pcl::Variant::ToByteArray ( ) const

Converts the object stored in this Variant to a dynamic array of unsigned 8-bit integers, and returns the result of the conversion.

Throws an Error exception if a conversion to the ByteArray class is not possible for the object currently stored in this Variant.

◆ ToByteMatrix()

ByteMatrix pcl::Variant::ToByteMatrix ( ) const

Converts the object stored in this Variant to a matrix of 8-bit unsigned integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the ByteMatrix class is not possible for the object currently stored in this Variant.

◆ ToByteVector()

ByteVector pcl::Variant::ToByteVector ( ) const

Converts the object stored in this Variant to a vector of 8-bit unsigned integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the ByteVector class is not possible for the object currently stored in this Variant.

◆ ToC32Matrix()

C32Matrix pcl::Variant::ToC32Matrix ( ) const

Converts the object stored in this Variant to a matrix of 32-bit floating point complex elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the C32Matrix class is not possible for the object currently stored in this Variant.

◆ ToC32Vector()

C32Vector pcl::Variant::ToC32Vector ( ) const

Converts the object stored in this Variant to a vector of 32-bit floating point complex components, and returns the result of the conversion.

Throws an Error exception if a conversion to the C32Vector class is not possible for the object currently stored in this Variant.

◆ ToC64Matrix()

C64Matrix pcl::Variant::ToC64Matrix ( ) const

Converts the object stored in this Variant to a matrix of 64-bit floating point complex elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the C64Matrix class is not possible for the object currently stored in this Variant.

◆ ToC64Vector()

C64Vector pcl::Variant::ToC64Vector ( ) const

Converts the object stored in this Variant to a vector of 64-bit floating point complex components, and returns the result of the conversion.

Throws an Error exception if a conversion to the C64Vector class is not possible for the object currently stored in this Variant.

◆ ToCharMatrix()

CharMatrix pcl::Variant::ToCharMatrix ( ) const

Converts the object stored in this Variant to a matrix of 8-bit signed integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the CharMatrix class is not possible for the object currently stored in this Variant.

◆ ToCharVector()

CharVector pcl::Variant::ToCharVector ( ) const

Converts the object stored in this Variant to a vector of 8-bit signed integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the CharVector class is not possible for the object currently stored in this Variant.

◆ ToComplex()

complex pcl::Variant::ToComplex ( ) const
inline

A convenience synonym for ToDComplex().

Definition at line 1129 of file Variant.h.

◆ ToDComplex()

dcomplex pcl::Variant::ToDComplex ( ) const

Converts the object stored in this Variant to a complex value with double components, and returns the result of the conversion.

Throws an Error exception if a conversion to the dcomplex type is not possible for the object currently stored in this Variant.

◆ ToDMatrix()

DMatrix pcl::Variant::ToDMatrix ( ) const

Converts the object stored in this Variant to a matrix of double elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the DMatrix class is not possible for the object currently stored in this Variant.

◆ ToDouble()

double pcl::Variant::ToDouble ( ) const

Converts the object stored in this Variant to a 64-bit floating point value, and returns the result of the conversion.

Throws an Error exception if a conversion to the double type is not possible for the object currently stored in this Variant.

◆ ToDPoint()

DPoint pcl::Variant::ToDPoint ( ) const

Converts the object stored in this Variant to a two-dimensional point with double coordinates, and returns the result of the conversion.

Throws an Error exception if a conversion to the DPoint class is not possible for the object currently stored in this Variant.

◆ ToDRect()

DRect pcl::Variant::ToDRect ( ) const

Converts the object stored in this Variant to a two-dimensional rectangle with double coordinates, and returns the result of the conversion.

Throws an Error exception if a conversion to the DRect class is not possible for the object currently stored in this Variant.

◆ ToDVector()

DVector pcl::Variant::ToDVector ( ) const

Converts the object stored in this Variant to a vector of double components, and returns the result of the conversion.

Throws an Error exception if a conversion to the DVector class is not possible for the object currently stored in this Variant.

◆ ToFComplex()

fcomplex pcl::Variant::ToFComplex ( ) const

Converts the object stored in this Variant to a complex value with float components, and returns the result of the conversion.

Throws an Error exception if a conversion to the fcomplex type is not possible for the object currently stored in this Variant.

◆ ToFloat()

float pcl::Variant::ToFloat ( ) const

Converts the object stored in this Variant to a 32-bit floating point value, and returns the result of the conversion.

Throws an Error exception if a conversion to the float type is not possible for the object currently stored in this Variant.

◆ ToFMatrix()

FMatrix pcl::Variant::ToFMatrix ( ) const

Converts the object stored in this Variant to a matrix of float elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the FMatrix class is not possible for the object currently stored in this Variant.

◆ ToFPoint()

FPoint pcl::Variant::ToFPoint ( ) const

Converts the object stored in this Variant to a two-dimensional point with float coordinates, and returns the result of the conversion.

Throws an Error exception if a conversion to the FPoint class is not possible for the object currently stored in this Variant.

◆ ToFRect()

FRect pcl::Variant::ToFRect ( ) const

Converts the object stored in this Variant to a two-dimensional rectangle with float coordinates, and returns the result of the conversion.

Throws an Error exception if a conversion to the FRect class is not possible for the object currently stored in this Variant.

◆ ToFVector()

FVector pcl::Variant::ToFVector ( ) const

Converts the object stored in this Variant to a vector of float components, and returns the result of the conversion.

Throws an Error exception if a conversion to the FVector class is not possible for the object currently stored in this Variant.

◆ ToI16Matrix()

I16Matrix pcl::Variant::ToI16Matrix ( ) const

Converts the object stored in this Variant to a matrix of 16-bit signed integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the I16Matrix class is not possible for the object currently stored in this Variant.

◆ ToI16Vector()

I16Vector pcl::Variant::ToI16Vector ( ) const

Converts the object stored in this Variant to a vector of 16-bit signed integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the I16Vector class is not possible for the object currently stored in this Variant.

◆ ToI64Matrix()

I64Matrix pcl::Variant::ToI64Matrix ( ) const

Converts the object stored in this Variant to a matrix of 64-bit integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the I64Matrix class is not possible for the object currently stored in this Variant.

◆ ToI64Vector()

I64Vector pcl::Variant::ToI64Vector ( ) const

Converts the object stored in this Variant to a vector of 64-bit integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the I64Vector class is not possible for the object currently stored in this Variant.

◆ ToIMatrix()

IMatrix pcl::Variant::ToIMatrix ( ) const

Converts the object stored in this Variant to a matrix of integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the IMatrix class is not possible for the object currently stored in this Variant.

◆ ToInt()

int pcl::Variant::ToInt ( ) const

Converts the object stored in this Variant to a 32-bit integer value, and returns the result of the conversion.

Throws an Error exception if a conversion to the int type is not possible for the object currently stored in this Variant.

◆ ToInt64()

int64 pcl::Variant::ToInt64 ( ) const

Converts the object stored in this Variant to a 64-bit integer value, and returns the result of the conversion.

Throws an Error exception if a conversion to the int64 type is not possible for the object currently stored in this Variant.

◆ ToIsoString()

IsoString pcl::Variant::ToIsoString ( ) const

Converts the object stored in this Variant to an 8-bit ISO/IEC 8859-1 or UTF-8 Unicode string, and returns the result of the conversion.

Throws an Error exception if a conversion to the IsoString class is not possible for the object currently stored in this Variant.

◆ ToIsoStringKeyValue()

IsoStringKeyValue pcl::Variant::ToIsoStringKeyValue ( ) const

Converts the object stored in this Variant to a key/value pair of 8-bit strings, and returns the result of the conversion.

Throws an Error exception if a conversion to the IsoStringKeyValue class is not possible for the object currently stored in this Variant.

◆ ToIsoStringKeyValueList()

IsoStringKeyValueList pcl::Variant::ToIsoStringKeyValueList ( ) const

Converts the object stored in this Variant to a dynamic list of key/value pairs of 8-bit strings, and returns the result of th conversion.

Throws an Error exception if a conversion to the IsoStringKeyValueList class is not possible for the object currently stored in this Variant.

◆ ToIsoStringList()

IsoStringList pcl::Variant::ToIsoStringList ( ) const

Converts the object stored in this Variant to a dynamic list of 8-bit strings, and returns the result of the conversion.

Throws an Error exception if a conversion to the IsoStringList class is not possible for the object currently stored in this Variant.

◆ ToIVector()

IVector pcl::Variant::ToIVector ( ) const

Converts the object stored in this Variant to a vector of integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the IVector class is not possible for the object currently stored in this Variant.

◆ ToMatrix()

Matrix pcl::Variant::ToMatrix ( ) const
inline

A convenience synonym for ToDMatrix().

Definition at line 1411 of file Variant.h.

◆ ToPoint()

Point pcl::Variant::ToPoint ( ) const

Converts the object stored in this Variant to a two-dimensional point with integer coordinates, and returns the result of the conversion.

Throws an Error exception if a conversion to the Point class is not possible for the object currently stored in this Variant.

◆ ToRect()

Rect pcl::Variant::ToRect ( ) const

Converts the object stored in this Variant to a two-dimensional rectangle with integer coordinates, and returns the result of the conversion.

Throws an Error exception if a conversion to the Rect class is not possible for the object currently stored in this Variant.

◆ ToString()

String pcl::Variant::ToString ( ) const

Converts the object stored in this Variant to a UTF-16 Unicode string, and returns the result of the conversion.

Throws an Error exception if a conversion to the String class is not possible for the object currently stored in this Variant.

◆ ToStringKeyValue()

StringKeyValue pcl::Variant::ToStringKeyValue ( ) const

Converts the object stored in this Variant to a key/value pair of UTF-16 Unicode strings, and returns the result of the conversion.

Throws an Error exception if a conversion to the StringKeyValue class is not possible for the object currently stored in this Variant.

◆ ToStringKeyValueList()

StringKeyValueList pcl::Variant::ToStringKeyValueList ( ) const

Converts the object stored in this Variant to a dynamic list of key/value pairs of UTF-16 Unicode strings, and returns the result of the conversion.

Throws an Error exception if a conversion to the StringKeyValueList class is not possible for the object currently stored in this Variant.

◆ ToStringList()

StringList pcl::Variant::ToStringList ( ) const

Converts the object stored in this Variant to a dynamic list of UTF-16 Unicode strings, and returns the result of the conversion.

Throws an Error exception if a conversion to the StringList class is not possible for the object currently stored in this Variant.

◆ ToTimePoint()

TimePoint pcl::Variant::ToTimePoint ( ) const

Converts the object stored in this Variant to a time point value, and returns the result of the conversion.

Throws an Error exception if a conversion to the TimePoint class is not possible for the object currently stored in this Variant.

◆ ToType()

Variant pcl::Variant::ToType ( data_type  type) const

Converts the object currently stored in this Variant instance to the specified type.

Returns a Variant object with the result of the conversion.

If this Variant is invalid, or if the currently stored object cannot be converted to the requested type, this function throws an Error exception with a descriptive message.

◆ ToUI16Matrix()

UI16Matrix pcl::Variant::ToUI16Matrix ( ) const

Converts the object stored in this Variant to a matrix of 16-bit unsigned integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the UI16Matrix class is not possible for the object currently stored in this Variant.

◆ ToUI16Vector()

UI16Vector pcl::Variant::ToUI16Vector ( ) const

Converts the object stored in this Variant to a vector of 16-bit unsigned integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the UI16Vector class is not possible for the object currently stored in this Variant.

◆ ToUI64Matrix()

UI64Matrix pcl::Variant::ToUI64Matrix ( ) const

Converts the object stored in this Variant to a matrix of 64-bit unsigned integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the UI64Matrix class is not possible for the object currently stored in this Variant.

◆ ToUI64Vector()

UI64Vector pcl::Variant::ToUI64Vector ( ) const

Converts the object stored in this Variant to a vector of 64-bit unsigned integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the UI64Vector class is not possible for the object currently stored in this Variant.

◆ ToUIMatrix()

UIMatrix pcl::Variant::ToUIMatrix ( ) const

Converts the object stored in this Variant to a matrix of unsigned integer elements, and returns the result of the conversion.

Throws an Error exception if a conversion to the UIMatrix class is not possible for the object currently stored in this Variant.

◆ ToUInt()

unsigned int pcl::Variant::ToUInt ( ) const

Converts the object stored in this Variant to an unsigned 32-bit integer value, and returns the result of the conversion.

Throws an Error exception if a conversion to the unsigned int type is not possible for the object currently stored in this Variant.

◆ ToUInt64()

uint64 pcl::Variant::ToUInt64 ( ) const

Converts the object stored in this Variant to an unsigned 64-bit integer value, and returns the result of the conversion.

Throws an Error exception if a conversion to the uint64 type is not possible for the object currently stored in this Variant.

◆ ToUIVector()

UIVector pcl::Variant::ToUIVector ( ) const

Converts the object stored in this Variant to a vector of unsigned integer components, and returns the result of the conversion.

Throws an Error exception if a conversion to the UIVector class is not possible for the object currently stored in this Variant.

◆ ToVector()

Vector pcl::Variant::ToVector ( ) const
inline

A convenience synonym for ToDVector().

Definition at line 1293 of file Variant.h.

◆ Transfer() [1/2]

void pcl::Variant::Transfer ( Variant x)
inline

Transfers the object stored in another Variant x to this Variant. The source object x is left empty/invalid.

Definition at line 930 of file Variant.h.

◆ Transfer() [2/2]

void pcl::Variant::Transfer ( Variant &&  x)
inline

Transfers the object stored in another Variant x to this Variant. The source object x is left empty/invalid.

Definition at line 945 of file Variant.h.

◆ Type()

data_type pcl::Variant::Type ( ) const
inline

Returns the type of the object currently stored in this Variant.

Definition at line 968 of file Variant.h.

◆ TypeAsString()

static const char* pcl::Variant::TypeAsString ( int  type)
static

Returns a static null-terminated string with the name of the specified Variant type.

◆ VectorLength()

size_type pcl::Variant::VectorLength ( ) const

Returns the length of the vector stored in this Variant object.

If this Variant does not transport a vector or vector-like object (IVector, FVector, DVector, ByteArray, String or IsoString), this member function throws an Error exception.


The documentation for this class was generated from the following file: