52 #ifndef __PCL_Variant_h
53 #define __PCL_Variant_h
58 #include <pcl/Diagnostics.h>
168 namespace VariantType
273 NumberOfVariantTypes,
275 FirstCustomType = 1024
338 using data_type = VariantType::value_type;
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 );
1110 bool ToBoolean()
const
1120 return CanConvertToBool();
1151 bool CanConvertToInt64() const noexcept;
1160 unsigned int ToUInt() const;
1166 bool CanConvertToUInt() const noexcept;
1181 bool CanConvertToUInt64() const noexcept;
1190 float ToFloat() const;
1196 bool CanConvertToFloat() const noexcept;
1205 double ToDouble() const;
1211 bool CanConvertToDouble() const noexcept;
1226 bool CanConvertToFComplex() const noexcept;
1241 bool CanConvertToDComplex() const noexcept;
1248 return ToDComplex();
1256 return CanConvertToDComplex();
1287 bool CanConvertToPoint() const noexcept;
1302 bool CanConvertToFPoint() const noexcept;
1317 bool CanConvertToDPoint() const noexcept;
1333 bool CanConvertToRect() const noexcept;
1349 bool CanConvertToFRect() const noexcept;
1365 bool CanConvertToDRect() const noexcept;
1380 bool CanConvertToCharVector() const noexcept;
1395 bool CanConvertToByteVector() const noexcept;
1410 bool CanConvertToI16Vector() const noexcept;
1425 bool CanConvertToUI16Vector() const noexcept;
1440 bool CanConvertToIVector() const noexcept;
1455 bool CanConvertToUIVector() const noexcept;
1470 bool CanConvertToI64Vector() const noexcept;
1485 bool CanConvertToUI64Vector() const noexcept;
1500 bool CanConvertToFVector() const noexcept;
1515 bool CanConvertToDVector() const noexcept;
1530 return CanConvertToDVector();
1563 bool CanConvertToC64Vector() const noexcept;
1578 bool CanConvertToCharMatrix() const noexcept;
1593 bool CanConvertToByteMatrix() const noexcept;
1608 bool CanConvertToI16Matrix() const noexcept;
1623 bool CanConvertToUI16Matrix() const noexcept;
1638 bool CanConvertToIMatrix() const noexcept;
1653 bool CanConvertToUIMatrix() const noexcept;
1668 bool CanConvertToI64Matrix() const noexcept;
1683 bool CanConvertToUI64Matrix() const noexcept;
1698 bool CanConvertToFMatrix() const noexcept;
1713 bool CanConvertToDMatrix() const noexcept;
1728 return CanConvertToDMatrix();
1761 bool CanConvertToC64Matrix() const noexcept;
1776 bool CanConvertToByteArray() const noexcept;
1791 bool CanConvertToString() const noexcept;
1806 bool CanConvertToIsoString() const noexcept;
1821 bool CanConvertToStringList() const noexcept;
1836 bool CanConvertToIsoStringList() const noexcept;
1891 const
void* InternalBlockAddress() const;
1933 static
int BytesPerBlockElementForType(
int type );
1942 int BytesPerBlockElement()
const
1944 return BytesPerBlockElementForType( m_type );
1961 return IsScalarType( m_type );
1970 return type == VariantType::Complex32 || type == VariantType::Complex64;
1979 return IsComplexType( m_type );
1987 return type == VariantType::TimePoint;
1996 return IsTimePointType( m_type );
2013 return IsVectorType( m_type );
2030 return IsMatrixType( m_type );
2039 return type == VariantType::String || type == VariantType::IsoString;
2048 return IsStringType( m_type );
2071 return IsStructuredType( m_type );
2097 double float64Value;
2161 friend class PCL_AssertVariantSize;
2164 class PCL_AssertVariantSize
2168 _Pragma(
"clang diagnostic push")
2169 _Pragma("clang diagnostic ignored \"-Wunused-private-field\"")
2172 static_assert(
sizeof( v->m_data ) ==
sizeof(
uint64 ),
"Invalid sizeof( Variant::m_data )" );
2173 static_assert(
sizeof( v->m_data.anyValue ) ==
sizeof( v->m_data ),
"Invalid sizeof( Variant::m_data.anyValue )" );
2175 _Pragma(
"clang diagnostic pop")
2178 static_assert(
sizeof( Variant::Data ) ==
sizeof(
uint64 ),
"Invalid sizeof( Variant::m_data )" );
2190 struct api_property_value;
2193 Variant VariantFromAPIPropertyValue(
const api_property_value& );
2194 void APIPropertyValueFromVariant( api_property_value&,
const Variant& );
Dynamic array of 8-bit unsigned integers.
8-bit unsigned integer matrix.
8-bit unsigned integer vector.
32-bit floating point complex matrix.
32-bit floating point complex vector.
64-bit floating point complex matrix.
64-bit floating point complex vector.
8-bit signed integer matrix.
8-bit signed integer vector.
A complex number whose components are 32-bit floating point real numbers.
A complex number whose components are 64-bit floating point real numbers.
64-bit floating point real matrix.
64-bit floating-point point in the R^2 space.
64-bit floating-point rectangle in the R^2 space.
64-bit floating point real vector.
32-bit floating point real matrix.
32-bit floating-point point in the R^2 space.
32-bit floating-point rectangle in the R^2 space.
32-bit floating point real vector.
64-bit floating point real matrix.
64-bit floating-point point in the R^2 space.
64-bit floating-point rectangle in the R^2 space.
64-bit floating point real vector.
32-bit floating point real matrix.
32-bit floating-point point in the R^2 space.
32-bit floating-point rectangle in the R^2 space.
32-bit floating point real vector.
Generic dynamic matrix of arbitrary dimensions.
A generic point in the two-dimensional space.
A generic rectangle in the two-dimensional space.
Generic vector of arbitrary length.
16-bit signed integer matrix.
16-bit signed integer vector.
32-bit signed integer matrix.
32-bit integer point on the plane.
32-bit integer rectangle on the plane.
32-bit signed integer vector.
8-bit signed integer matrix.
8-bit signed integer vector.
32-bit signed integer matrix.
32-bit signed integer vector.
Dynamic list of key-value associations implemented as 8-bit strings.
Key-value association of two 8-bit strings.
Dynamic list of 8-bit strings.
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Generic key-value association.
32-bit integer point on the plane.
32-bit integer rectangle on the plane.
Dynamic list of key-value associations implemented as Unicode (UTF-16) strings.
Key-value association of two Unicode (UTF-16) strings.
Dynamic list of Unicode (UTF-16) strings.
An instant in any timescale.
16-bit unsigned integer matrix.
16-bit unsigned integer vector.
32-bit unsigned integer matrix.
32-bit unsigned integer vector.
64-bit unsigned integer matrix.
64-bit unsigned integer vector.
8-bit unsigned integer matrix.
8-bit unsigned integer vector.
32-bit unsigned integer vector.
Acts like a union to store instances of different data types.
static bool IsComplexType(int type)
Variant(const StringKeyValueList &skvl)
Variant(const UI16Matrix &ui16m)
Variant(const ByteMatrix &bm)
bool CanConvertToTimePoint() const noexcept
static bool IsStringType(int type)
Variant(const C64Matrix &c64m)
Variant(const IsoString &s8)
void Transfer(Variant &&x)
Variant(const DVector &dv)
Variant(const ByteVector &bv)
Variant(const CharVector &cv)
static bool IsVectorType(int type)
void Assign(const Variant &x)
Variant(const UIMatrix &uim)
Variant(const UI64Matrix &ui64m)
Variant(const DPoint &dp)
VariantType::value_type data_type
Variant(const ByteArray &ba)
Variant(const IsoStringKeyValue &iskv)
Variant(const UI16Vector &ui16v)
bool CanConvertToBool() const noexcept
Variant(const TimePoint &t)
static bool IsTimePointType(int type)
Variant(const IMatrix &im)
TimePoint ToTimePoint() const
Variant(const Variant &x)
Variant(const I64Vector &i64v)
static bool IsMatrixType(int type)
Variant(const C32Matrix &c32m)
Variant(const CharMatrix &cm)
bool CanConvertToC32Matrix() const noexcept
Variant(const I16Matrix &i16m)
Variant(const DMatrix &dm)
Variant(const FPoint &fp)
bool CanConvertToBoolean() const noexcept
Variant(const FVector &fv)
static const char * TypeAsString(int type)
int Compare(const Variant &x) const
Variant ToType(data_type type) const
Variant(const StringList &sl)
C32Vector ToC32Vector() const
Variant(const I16Vector &i16v)
Variant(const I64Matrix &i64m)
bool CanConvertToC32Vector() const noexcept
bool CanConvertToComplex() const noexcept
Variant(const UI64Vector &ui64v)
void Transfer(Variant &x)
C32Matrix ToC32Matrix() const
Variant(const IVector &iv)
bool CanConvertToMatrix() const noexcept
Variant(const IsoStringList &isl)
bool IsStructured() const
static bool IsScalarType(int type)
Variant(const IsoStringKeyValueList &iskvl)
Variant(const StringKeyValue &skv)
Variant(const C32Vector &c32v)
bool CanConvertToInt() const noexcept
Variant(const C64Vector &c64v)
static bool IsStructuredType(int type)
bool CanConvertToVector() const noexcept
Variant(const UIVector &uiv)
Variant(const FMatrix &fm)
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
unsigned long long uint64
int Compare(FI1 i1, FI1 j1, FI2 i2, FI2 j2) noexcept