52 #ifndef __PCL_Variant_h 53 #define __PCL_Variant_h 58 #include <pcl/Diagnostics.h> 168 namespace VariantType
200 FComplex = Complex32,
202 DComplex = Complex64,
222 CharVector = I8Vector,
224 ByteVector = UI8Vector,
230 UIVector = UI32Vector,
241 CharMatrix = I8Matrix,
243 ByteMatrix = UI8Matrix,
249 UIMatrix = UI32Matrix,
271 IsoStringKeyValueList,
273 NumberOfVariantTypes,
275 FirstCustomType = 1024
344 : m_type( VariantType::Invalid )
353 : m_type( VariantType::Bool )
355 m_data.boolValue = b;
362 : m_type( VariantType::Int8 )
364 m_data.int8Value = i8;
371 : m_type( VariantType::Int16 )
373 m_data.int16Value = i16;
380 : m_type( VariantType::Int32 )
382 m_data.int32Value = i32;
389 : m_type( VariantType::Int64 )
391 m_data.int64Value = i64;
398 : m_type( VariantType::UInt8 )
400 m_data.uint8Value = u8;
407 : m_type( VariantType::UInt16 )
409 m_data.uint16Value = u16;
417 m_data.uint32Value = u32;
424 : m_type( VariantType::UInt64 )
426 m_data.uint64Value = u64;
434 : m_type( VariantType::Float )
436 m_data.float32Value = f;
444 : m_type( VariantType::Double )
446 m_data.float64Value = d;
454 : m_type( VariantType::FComplex )
457 m_data.complex32Value =
new fcomplex( fc );
465 : m_type( VariantType::DComplex )
468 m_data.complex64Value =
new dcomplex( dc );
478 m_data.timePointValue =
new TimePoint( t );
486 : m_type( VariantType::
Point )
489 m_data.i32PointValue =
new Point( p );
497 : m_type( VariantType::
FPoint )
500 m_data.f32PointValue =
new FPoint( fp );
508 : m_type( VariantType::
DPoint )
511 m_data.f64PointValue =
new DPoint( dp );
519 : m_type( VariantType::
Rect )
522 m_data.i32RectValue =
new Rect( r );
530 : m_type( VariantType::
FRect )
533 m_data.f32RectValue =
new FRect( fr );
541 : m_type( VariantType::
DRect )
544 m_data.f64RectValue =
new DRect( dr );
577 m_data.i16VectorValue =
new I16Vector( i16v );
588 m_data.ui16VectorValue =
new UI16Vector( ui16v );
596 : m_type( VariantType::
IVector )
599 m_data.i32VectorValue =
new IVector( iv );
610 m_data.ui32VectorValue =
new UIVector( uiv );
621 m_data.i64VectorValue =
new I64Vector( i64v );
632 m_data.ui64VectorValue =
new UI64Vector( ui64v );
640 : m_type( VariantType::
FVector )
643 m_data.f32VectorValue =
new FVector( fv );
651 : m_type( VariantType::
DVector )
654 m_data.f64VectorValue =
new DVector( dv );
665 m_data.c32VectorValue =
new C32Vector( c32v );
676 m_data.c64VectorValue =
new C64Vector( c64v );
709 m_data.i16MatrixValue =
new I16Matrix( i16m );
720 m_data.ui16MatrixValue =
new UI16Matrix( ui16m );
728 : m_type( VariantType::
IMatrix )
731 m_data.i32MatrixValue =
new IMatrix( im );
742 m_data.ui32MatrixValue =
new UIMatrix( uim );
753 m_data.i64MatrixValue =
new I64Matrix( i64m );
764 m_data.ui64MatrixValue =
new UI64Matrix( ui64m );
772 : m_type( VariantType::
FMatrix )
775 m_data.f32MatrixValue =
new FMatrix( fm );
783 : m_type( VariantType::
DMatrix )
786 m_data.f64MatrixValue =
new DMatrix( dm );
797 m_data.c32MatrixValue =
new C32Matrix( c32m );
808 m_data.c64MatrixValue =
new C64Matrix( c64m );
819 m_data.byteArrayValue =
new ByteArray( ba );
826 : m_type( VariantType::
String )
829 m_data.stringValue =
new String( s );
840 m_data.isoStringValue =
new IsoString( s8 );
851 m_data.isoStringValue =
new IsoString( cp );
862 m_data.stringListValue =
new StringList( sl );
925 : m_type( VariantType::Invalid )
937 m_data.anyValue = x.m_data.anyValue;
938 x.m_type = VariantType::Invalid;
991 m_data.anyValue = x.m_data.anyValue;
992 x.m_type = VariantType::Invalid;
1006 m_data.anyValue = x.m_data.anyValue;
1007 x.m_type = VariantType::Invalid;
1017 return m_type != VariantType::Invalid;
1025 return data_type( m_type );
1038 Variant ToType( data_type type )
const;
1099 bool ToBool()
const;
1125 int64 ToInt64()
const;
1134 unsigned int ToUInt()
const;
1152 float ToFloat()
const;
1161 double ToDouble()
const;
1186 return ToDComplex();
1205 Point ToPoint()
const;
1233 Rect ToRect()
const;
1243 FRect ToFRect()
const;
1253 DRect ToDRect()
const;
1589 const void* InternalBlockAddress()
const;
1611 Rect MatrixDimensions()
const;
1631 static int BytesPerBlockElementForType(
int type );
1642 return BytesPerBlockElementForType( m_type );
1650 static bool IsScalarType(
int type );
1659 return IsScalarType( m_type );
1668 return type == VariantType::Complex32 || type == VariantType::Complex64;
1677 return IsComplexType( m_type );
1685 return type == VariantType::TimePoint;
1694 return IsTimePointType( m_type );
1702 static bool IsVectorType(
int type );
1711 return IsVectorType( m_type );
1719 static bool IsMatrixType(
int type );
1728 return IsMatrixType( m_type );
1737 return type == VariantType::String || type == VariantType::IsoString;
1746 return IsStringType( m_type );
1755 static bool IsStructuredType(
int type );
1769 return IsStructuredType( m_type );
1776 static const char* TypeAsString(
int type );
1795 double float64Value;
1859 friend class PCL_AssertVariantSize;
1862 class PCL_AssertVariantSize
1866 _Pragma(
"clang diagnostic push")
1867 _Pragma(
"clang diagnostic ignored \"-Wunused-private-field\"")
1870 static_assert(
sizeof( v->m_data ) ==
sizeof(
uint64 ),
"Invalid sizeof( Variant::m_data )" );
1871 static_assert(
sizeof( v->m_data.anyValue ) ==
sizeof( v->m_data ),
"Invalid sizeof( Variant::m_data.anyValue )" );
1873 _Pragma(
"clang diagnostic pop")
1876 static_assert(
sizeof( Variant::Data ) ==
sizeof(
uint64 ),
"Invalid sizeof( Variant::m_data )" );
1888 struct api_property_value;
1891 Variant VariantFromAPIPropertyValue(
const api_property_value& );
1892 void APIPropertyValueFromVariant( api_property_value&,
const Variant& );
1893 Variant::data_type VariantTypeFromAPIPropertyType(
uint64 );
1894 uint64 APIPropertyTypeFromVariantType( Variant::data_type );
1897 #endif // __PCL_Variant_h Variant(const UI16Vector &ui16v)
8-bit signed integer vector.
16-bit signed integer vector.
64-bit floating-point point in the R^2 space.
static bool IsStringType(int type)
An instant in any timescale.
32-bit signed integer vector.
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
32-bit floating point complex vector.
32-bit floating point real vector.
Variant(const StringKeyValueList &skvl)
Dynamic list of 8-bit strings.
Key-value association of two Unicode (UTF-16) strings.
Variant(const StringKeyValue &skv)
32-bit unsigned integer vector.
static bool IsComplexType(int type)
32-bit signed integer matrix.
32-bit floating point real matrix.
32-bit floating point complex matrix.
64-bit floating point real matrix.
64-bit floating point complex matrix.
32-bit floating-point rectangle in the R^2 space.
Dynamic array of 8-bit unsigned integers.
64-bit floating point complex vector.
64-bit floating point real vector.
Variant(const TimePoint &t)
8-bit signed integer matrix.
static bool IsTimePointType(int type)
64-bit floating point real matrix.
Variant(const DPoint &dp)
Dynamic list of key-value associations implemented as 8-bit strings.
Variant(const DVector &dv)
Variant(const CharVector &cv)
Variant(const C32Vector &c32v)
32-bit integer point on the plane.
Variant(const I16Vector &i16v)
int BytesPerBlockElement() const
bool IsStructured() const
8-bit unsigned integer matrix.
64-bit floating-point rectangle in the R^2 space.
Variant(const ByteVector &bv)
Variant(const IsoStringList &isl)
8-bit unsigned integer vector.
64-bit floating point real matrix.
Variant(const IsoStringKeyValueList &iskvl)
int Compare(FI1 i1, FI1 j1, FI2 i2, FI2 j2) noexcept
Variant(const C32Matrix &c32m)
Variant(const C64Vector &c64v)
Variant(const Variant &x)
unsigned long long uint64
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
64-bit unsigned integer matrix.
8-bit signed integer vector.
64-bit floating point real vector.
Variant(const ByteMatrix &bm)
8-bit signed integer matrix.
16-bit signed integer matrix.
Variant(const IsoStringKeyValue &iskv)
Variant(const CharMatrix &cm)
Dynamic list of key-value associations implemented as Unicode (UTF-16) strings.
32-bit unsigned integer matrix.
Dynamic list of Unicode (UTF-16) strings.
32-bit floating-point rectangle in the R^2 space.
32-bit unsigned integer vector.
Variant(const UI16Matrix &ui16m)
64-bit unsigned integer vector.
A complex number whose components are 64-bit floating point real numbers.
void Assign(const Variant &x)
32-bit floating-point point in the R^2 space.
void Transfer(Variant &&x)
Variant(const UIMatrix &uim)
64-bit floating point real vector.
16-bit unsigned integer vector.
Variant(const UI64Vector &ui64v)
Acts like a union to store instances of different data types.
Variant(const DMatrix &dm)
Variant(const IVector &iv)
Variant(const I16Matrix &i16m)
Variant(const IsoString &s8)
8-bit unsigned integer vector.
32-bit signed integer matrix.
64-bit floating-point point in the R^2 space.
Variant(const IMatrix &im)
Variant(const UIVector &uiv)
16-bit unsigned integer matrix.
A complex number whose components are 64-bit floating point real numbers.
32-bit integer point on the plane.
Variant(const FPoint &fp)
Variant(const I64Matrix &i64m)
Variant(const C64Matrix &c64m)
VariantType::value_type data_type
32-bit floating point real matrix.
32-bit signed integer vector.
Variant(const StringList &sl)
Key-value association of two 8-bit strings.
complex ToComplex() const
64-bit floating-point rectangle in the R^2 space.
32-bit integer rectangle on the plane.
32-bit floating-point point in the R^2 space.
void Transfer(Variant &x)
Variant(const ByteArray &ba)
A complex number whose components are 32-bit floating point real numbers.
Variant(const FVector &fv)
32-bit floating point real vector.
32-bit integer rectangle on the plane.
Variant(const UI64Matrix &ui64m)
Variant(const FMatrix &fm)
Variant(const I64Vector &i64v)
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
8-bit unsigned integer matrix.