PCL
Variant.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.1.19
6 // ----------------------------------------------------------------------------
7 // pcl/Variant.h - Released 2019-11-07T10:59:34Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2019 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (http://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_Variant_h
53 #define __PCL_Variant_h
54 
56 
57 #include <pcl/Defs.h>
58 #include <pcl/Diagnostics.h>
59 
60 #include <pcl/ByteArray.h>
61 #include <pcl/Complex.h>
62 #include <pcl/Matrix.h>
63 #include <pcl/Point.h>
64 #include <pcl/Rectangle.h>
65 #include <pcl/StringList.h>
66 #include <pcl/TimePoint.h>
67 #include <pcl/Vector.h>
68 
69 namespace pcl
70 {
71 
72 // ----------------------------------------------------------------------------
73 
168 namespace VariantType
169 {
170  enum value_type
171  {
172  Invalid = 0,
173 
174  Bool,
175  Boolean = Bool,
176 
177  Int8,
178  Char = Int8,
179  Int16,
180  Short = Int16,
181  Int32,
182  Integer = Int32,
183  Int64,
184 
185  UInt8,
186  Byte = UInt8,
187  UInt16,
188  UShort = UInt16,
189  UInt32,
190  UInt = UInt32,
191  UInt64,
192 
193  Float32,
194  Float = Float32,
195  Float64,
196  Double = Float64,
197  Real = Double,
198 
199  Complex32,
200  FComplex = Complex32,
201  Complex64,
202  DComplex = Complex64,
203  Complex = DComplex,
204 
205  TimePoint,
206 
207  I32Point,
208  Point = I32Point,
209  F32Point,
210  FPoint = F32Point,
211  F64Point,
212  DPoint = F64Point,
213 
214  I32Rect,
215  Rect = I32Rect,
216  F32Rect,
217  FRect = F32Rect,
218  F64Rect,
219  DRect = F64Rect,
220 
221  I8Vector,
222  CharVector = I8Vector,
223  UI8Vector,
224  ByteVector = UI8Vector,
225  I16Vector,
226  UI16Vector,
227  I32Vector,
228  IVector = I32Vector,
229  UI32Vector,
230  UIVector = UI32Vector,
231  I64Vector,
232  UI64Vector,
233  F32Vector,
234  FVector = F32Vector,
235  F64Vector,
236  DVector = F64Vector,
237  C32Vector,
238  C64Vector,
239 
240  I8Matrix,
241  CharMatrix = I8Matrix,
242  UI8Matrix,
243  ByteMatrix = UI8Matrix,
244  I16Matrix,
245  UI16Matrix,
246  I32Matrix,
247  IMatrix = I32Matrix,
248  UI32Matrix,
249  UIMatrix = UI32Matrix,
250  I64Matrix,
251  UI64Matrix,
252  F32Matrix,
253  FMatrix = F32Matrix,
254  F64Matrix,
255  DMatrix = F64Matrix,
256  C32Matrix,
257  C64Matrix,
258 
259  ByteArray,
260 
261  String,
262  IsoString,
263 
264  StringList,
265  IsoStringList,
266 
267  StringKeyValue,
268  IsoStringKeyValue,
269 
270  StringKeyValueList,
271  IsoStringKeyValueList,
272 
273  NumberOfVariantTypes,
274 
275  FirstCustomType = 1024
276  };
277 }
278 
279 // ----------------------------------------------------------------------------
280 
331 class PCL_CLASS Variant
332 {
333 public:
334 
338  typedef VariantType::value_type data_type;
339 
343  Variant() : m_type( VariantType::Invalid )
344  {
345  m_data.anyValue = 0;
346  }
347 
351  Variant( bool b ) : m_type( VariantType::Bool )
352  {
353  m_data.boolValue = b;
354  }
355 
359  Variant( int8 i8 ) : m_type( VariantType::Int8 )
360  {
361  m_data.int8Value = i8;
362  }
363 
367  Variant( int16 i16 ) : m_type( VariantType::Int16 )
368  {
369  m_data.int16Value = i16;
370  }
371 
375  Variant( int32 i32 ) : m_type( VariantType::Int32 )
376  {
377  m_data.int32Value = i32;
378  }
379 
383  Variant( int64 i64 ) : m_type( VariantType::Int64 )
384  {
385  m_data.int64Value = i64;
386  }
387 
391  Variant( uint8 u8 ) : m_type( VariantType::UInt8 )
392  {
393  m_data.uint8Value = u8;
394  }
395 
399  Variant( uint16 u16 ) : m_type( VariantType::UInt16 )
400  {
401  m_data.uint16Value = u16;
402  }
403 
407  Variant( uint32 u32 ) : m_type( VariantType::UInt32 )
408  {
409  m_data.uint32Value = u32;
410  }
411 
415  Variant( uint64 u64 ) : m_type( VariantType::UInt64 )
416  {
417  m_data.uint64Value = u64;
418  }
419 
424  Variant( float f ) : m_type( VariantType::Float )
425  {
426  m_data.float32Value = f;
427  }
428 
433  Variant( double d ) : m_type( VariantType::Double )
434  {
435  m_data.float64Value = d;
436  }
437 
442  Variant( fcomplex fc ) : m_type( VariantType::FComplex )
443  {
444  m_data.anyValue = 0;
445  m_data.complex32Value = new fcomplex( fc );
446  }
447 
452  Variant( dcomplex dc ) : m_type( VariantType::DComplex )
453  {
454  m_data.anyValue = 0;
455  m_data.complex64Value = new dcomplex( dc );
456  }
457 
461  Variant( const TimePoint& t ) : m_type( VariantType::TimePoint )
462  {
463  m_data.anyValue = 0;
464  m_data.timePointValue = new TimePoint( t );
465  }
466 
471  Variant( const Point& p ) : m_type( VariantType::Point )
472  {
473  m_data.anyValue = 0;
474  m_data.i32PointValue = new Point( p );
475  }
476 
481  Variant( const FPoint& fp ) : m_type( VariantType::FPoint )
482  {
483  m_data.anyValue = 0;
484  m_data.f32PointValue = new FPoint( fp );
485  }
486 
491  Variant( const DPoint& dp ) : m_type( VariantType::DPoint )
492  {
493  m_data.anyValue = 0;
494  m_data.f64PointValue = new DPoint( dp );
495  }
496 
501  Variant( const Rect& r ) : m_type( VariantType::Rect )
502  {
503  m_data.anyValue = 0;
504  m_data.i32RectValue = new Rect( r );
505  }
506 
511  Variant( const FRect& fr ) : m_type( VariantType::FRect )
512  {
513  m_data.anyValue = 0;
514  m_data.f32RectValue = new FRect( fr );
515  }
516 
521  Variant( const DRect& dr ) : m_type( VariantType::DRect )
522  {
523  m_data.anyValue = 0;
524  m_data.f64RectValue = new DRect( dr );
525  }
526 
531  Variant( const CharVector& cv ) : m_type( VariantType::CharVector )
532  {
533  m_data.anyValue = 0;
534  m_data.i8VectorValue = new CharVector( cv );
535  }
536 
541  Variant( const ByteVector& bv ) : m_type( VariantType::ByteVector )
542  {
543  m_data.anyValue = 0;
544  m_data.ui8VectorValue = new ByteVector( bv );
545  }
546 
551  Variant( const I16Vector& i16v ) : m_type( VariantType::I16Vector )
552  {
553  m_data.anyValue = 0;
554  m_data.i16VectorValue = new I16Vector( i16v );
555  }
556 
561  Variant( const UI16Vector& ui16v ) : m_type( VariantType::UI16Vector )
562  {
563  m_data.anyValue = 0;
564  m_data.ui16VectorValue = new UI16Vector( ui16v );
565  }
566 
571  Variant( const IVector& iv ) : m_type( VariantType::IVector )
572  {
573  m_data.anyValue = 0;
574  m_data.i32VectorValue = new IVector( iv );
575  }
576 
581  Variant( const UIVector& uiv ) : m_type( VariantType::UIVector )
582  {
583  m_data.anyValue = 0;
584  m_data.ui32VectorValue = new UIVector( uiv );
585  }
586 
591  Variant( const I64Vector& i64v ) : m_type( VariantType::I64Vector )
592  {
593  m_data.anyValue = 0;
594  m_data.i64VectorValue = new I64Vector( i64v );
595  }
596 
601  Variant( const UI64Vector& ui64v ) : m_type( VariantType::UI64Vector )
602  {
603  m_data.anyValue = 0;
604  m_data.ui64VectorValue = new UI64Vector( ui64v );
605  }
606 
611  Variant( const FVector& fv ) : m_type( VariantType::FVector )
612  {
613  m_data.anyValue = 0;
614  m_data.f32VectorValue = new FVector( fv );
615  }
616 
621  Variant( const DVector& dv ) : m_type( VariantType::DVector )
622  {
623  m_data.anyValue = 0;
624  m_data.f64VectorValue = new DVector( dv );
625  }
626 
631  Variant( const C32Vector& c32v ) : m_type( VariantType::C32Vector )
632  {
633  m_data.anyValue = 0;
634  m_data.c32VectorValue = new C32Vector( c32v );
635  }
636 
641  Variant( const C64Vector& c64v ) : m_type( VariantType::C64Vector )
642  {
643  m_data.anyValue = 0;
644  m_data.c64VectorValue = new C64Vector( c64v );
645  }
646 
651  Variant( const CharMatrix& cm ) : m_type( VariantType::CharMatrix )
652  {
653  m_data.anyValue = 0;
654  m_data.i8MatrixValue = new CharMatrix( cm );
655  }
656 
661  Variant( const ByteMatrix& bm ) : m_type( VariantType::ByteMatrix )
662  {
663  m_data.anyValue = 0;
664  m_data.ui8MatrixValue = new ByteMatrix( bm );
665  }
666 
671  Variant( const I16Matrix& i16m ) : m_type( VariantType::I16Matrix )
672  {
673  m_data.anyValue = 0;
674  m_data.i16MatrixValue = new I16Matrix( i16m );
675  }
676 
681  Variant( const UI16Matrix& ui16m ) : m_type( VariantType::UI16Matrix )
682  {
683  m_data.anyValue = 0;
684  m_data.ui16MatrixValue = new UI16Matrix( ui16m );
685  }
686 
691  Variant( const IMatrix& im ) : m_type( VariantType::IMatrix )
692  {
693  m_data.anyValue = 0;
694  m_data.i32MatrixValue = new IMatrix( im );
695  }
696 
701  Variant( const UIMatrix& uim ) : m_type( VariantType::UIMatrix )
702  {
703  m_data.anyValue = 0;
704  m_data.ui32MatrixValue = new UIMatrix( uim );
705  }
706 
711  Variant( const I64Matrix& i64m ) : m_type( VariantType::I64Matrix )
712  {
713  m_data.anyValue = 0;
714  m_data.i64MatrixValue = new I64Matrix( i64m );
715  }
716 
721  Variant( const UI64Matrix& ui64m ) : m_type( VariantType::UI64Matrix )
722  {
723  m_data.anyValue = 0;
724  m_data.ui64MatrixValue = new UI64Matrix( ui64m );
725  }
726 
731  Variant( const FMatrix& fm ) : m_type( VariantType::FMatrix )
732  {
733  m_data.anyValue = 0;
734  m_data.f32MatrixValue = new FMatrix( fm );
735  }
736 
741  Variant( const DMatrix& dm ) : m_type( VariantType::DMatrix )
742  {
743  m_data.anyValue = 0;
744  m_data.f64MatrixValue = new DMatrix( dm );
745  }
746 
751  Variant( const C32Matrix& c32m ) : m_type( VariantType::C32Matrix )
752  {
753  m_data.anyValue = 0;
754  m_data.c32MatrixValue = new C32Matrix( c32m );
755  }
756 
761  Variant( const C64Matrix& c64m ) : m_type( VariantType::C64Matrix )
762  {
763  m_data.anyValue = 0;
764  m_data.c64MatrixValue = new C64Matrix( c64m );
765  }
766 
771  Variant( const ByteArray& ba ) : m_type( VariantType::ByteArray )
772  {
773  m_data.anyValue = 0;
774  m_data.byteArrayValue = new ByteArray( ba );
775  }
776 
780  Variant( const String& s ) : m_type( VariantType::String )
781  {
782  m_data.anyValue = 0;
783  m_data.stringValue = new String( s );
784  }
785 
790  Variant( const IsoString& s8 ) : m_type( VariantType::IsoString )
791  {
792  m_data.anyValue = 0;
793  m_data.isoStringValue = new IsoString( s8 );
794  }
795 
800  Variant( const char* cp ) : m_type( VariantType::IsoString )
801  {
802  m_data.anyValue = 0;
803  m_data.isoStringValue = new IsoString( cp );
804  }
805 
810  Variant( const StringList& sl ) : m_type( VariantType::StringList )
811  {
812  m_data.anyValue = 0;
813  m_data.stringListValue = new StringList( sl );
814  }
815 
820  Variant( const IsoStringList& isl ) : m_type( VariantType::IsoStringList )
821  {
822  m_data.anyValue = 0;
823  m_data.isoStringListValue = new IsoStringList( isl );
824  }
825 
830  Variant( const StringKeyValue& skv ) : m_type( VariantType::StringKeyValue )
831  {
832  m_data.anyValue = 0;
833  m_data.stringKeyValueValue = new StringKeyValue( skv );
834  }
835 
840  Variant( const IsoStringKeyValue& iskv ) : m_type( VariantType::IsoStringKeyValue )
841  {
842  m_data.anyValue = 0;
843  m_data.isoStringKeyValueValue = new IsoStringKeyValue( iskv );
844  }
845 
850  Variant( const StringKeyValueList& skvl ) : m_type( VariantType::StringKeyValueList )
851  {
852  m_data.anyValue = 0;
853  m_data.stringKeyValueListValue = new StringKeyValueList( skvl );
854  }
855 
860  Variant( const IsoStringKeyValueList& iskvl ) : m_type( VariantType::IsoStringKeyValueList )
861  {
862  m_data.anyValue = 0;
863  m_data.isoStringKeyValueListValue = new IsoStringKeyValueList( iskvl );
864  }
865 
870  Variant( const Variant& x ) : m_type( VariantType::Invalid )
871  {
872  m_data.anyValue = 0;
873  Copy( x );
874  }
875 
880  {
881  m_type = x.m_type;
882  m_data.anyValue = x.m_data.anyValue;
883  x.m_type = VariantType::Invalid;
884  }
885 
889  virtual ~Variant()
890  {
891  Clear();
892  }
893 
898  Variant& operator =( const Variant& x )
899  {
900  Assign( x );
901  return *this;
902  }
903 
908  void Assign( const Variant& x )
909  {
910  if ( &x != this )
911  {
912  Clear();
913  Copy( x );
914  }
915  }
916 
920  Variant& operator =( Variant&& x )
921  {
922  Transfer( x );
923  return *this;
924  }
925 
930  void Transfer( Variant& x )
931  {
932  if ( &x != this )
933  {
934  Clear();
935  m_type = x.m_type;
936  m_data.anyValue = x.m_data.anyValue;
937  x.m_type = VariantType::Invalid;
938  }
939  }
940 
945  void Transfer( Variant&& x )
946  {
947  if ( &x != this )
948  {
949  Clear();
950  m_type = x.m_type;
951  m_data.anyValue = x.m_data.anyValue;
952  x.m_type = VariantType::Invalid;
953  }
954  }
955 
960  bool IsValid() const
961  {
962  return m_type != VariantType::Invalid;
963  }
964 
968  data_type Type() const
969  {
970  return data_type( m_type );
971  }
972 
983  Variant ToType( data_type type ) const;
984 
989  void Clear();
990 
1009  int Compare( const Variant& x ) const;
1010 
1019  bool operator ==( const Variant& x ) const
1020  {
1021  return Compare( x ) == 0;
1022  }
1023 
1032  bool operator <( const Variant& x ) const
1033  {
1034  return Compare( x ) < 0;
1035  }
1036 
1044  bool ToBool() const;
1045 
1049  bool ToBoolean() const
1050  {
1051  return ToBool();
1052  }
1053 
1061  int ToInt() const;
1062 
1070  int64 ToInt64() const;
1071 
1079  unsigned int ToUInt() const;
1080 
1088  uint64 ToUInt64() const;
1089 
1097  float ToFloat() const;
1098 
1106  double ToDouble() const;
1107 
1115  fcomplex ToFComplex() const;
1116 
1124  dcomplex ToDComplex() const;
1125 
1130  {
1131  return ToDComplex();
1132  }
1133 
1141  TimePoint ToTimePoint() const;
1142 
1150  Point ToPoint() const;
1151 
1159  FPoint ToFPoint() const;
1160 
1168  DPoint ToDPoint() const;
1169 
1178  Rect ToRect() const;
1179 
1188  FRect ToFRect() const;
1189 
1198  DRect ToDRect() const;
1199 
1207  CharVector ToCharVector() const;
1208 
1216  ByteVector ToByteVector() const;
1217 
1225  I16Vector ToI16Vector() const;
1226 
1234  UI16Vector ToUI16Vector() const;
1235 
1243  IVector ToIVector() const;
1244 
1252  UIVector ToUIVector() const;
1253 
1261  I64Vector ToI64Vector() const;
1262 
1270  UI64Vector ToUI64Vector() const;
1271 
1279  FVector ToFVector() const;
1280 
1288  DVector ToDVector() const;
1289 
1294  {
1295  return ToDVector();
1296  }
1297 
1306  C32Vector ToC32Vector() const;
1307 
1316  C64Vector ToC64Vector() const;
1317 
1325  CharMatrix ToCharMatrix() const;
1326 
1334  ByteMatrix ToByteMatrix() const;
1335 
1343  I16Matrix ToI16Matrix() const;
1344 
1352  UI16Matrix ToUI16Matrix() const;
1353 
1361  IMatrix ToIMatrix() const;
1362 
1370  UIMatrix ToUIMatrix() const;
1371 
1379  I64Matrix ToI64Matrix() const;
1380 
1388  UI64Matrix ToUI64Matrix() const;
1389 
1397  FMatrix ToFMatrix() const;
1398 
1406  DMatrix ToDMatrix() const;
1407 
1412  {
1413  return ToDMatrix();
1414  }
1415 
1424  C32Matrix ToC32Matrix() const;
1425 
1434  C64Matrix ToC64Matrix() const;
1435 
1443  ByteArray ToByteArray() const;
1444 
1452  String ToString() const;
1453 
1461  IsoString ToIsoString() const;
1462 
1470  StringList ToStringList() const;
1471 
1479  IsoStringList ToIsoStringList() const;
1480 
1488  StringKeyValue ToStringKeyValue() const;
1489 
1497  IsoStringKeyValue ToIsoStringKeyValue() const;
1498 
1507  StringKeyValueList ToStringKeyValueList() const;
1508 
1517  IsoStringKeyValueList ToIsoStringKeyValueList() const;
1518 
1534  const void* InternalBlockAddress() const;
1535 
1543  size_type VectorLength() const;
1544 
1556  Rect MatrixDimensions() const;
1557 
1568  size_type BlockSize() const;
1569 
1576  static int BytesPerBlockElementForType( int type );
1577 
1586  {
1587  return BytesPerBlockElementForType( m_type );
1588  }
1589 
1595  static bool IsScalarType( int type );
1596 
1602  bool IsScalar() const
1603  {
1604  return IsScalarType( m_type );
1605  }
1606 
1611  static bool IsComplexType( int type )
1612  {
1613  return type == VariantType::Complex32 || type == VariantType::Complex64;
1614  }
1615 
1620  bool IsComplex() const
1621  {
1622  return IsComplexType( m_type );
1623  }
1624 
1628  static bool IsTimePointType( int type )
1629  {
1630  return type == VariantType::TimePoint;
1631  }
1632 
1637  bool IsTimePoint() const
1638  {
1639  return IsTimePointType( m_type );
1640  }
1641 
1647  static bool IsVectorType( int type );
1648 
1654  bool IsVector() const
1655  {
1656  return IsVectorType( m_type );
1657  }
1658 
1664  static bool IsMatrixType( int type );
1665 
1671  bool IsMatrix() const
1672  {
1673  return IsMatrixType( m_type );
1674  }
1675 
1680  static bool IsStringType( int type )
1681  {
1682  return type == VariantType::String || type == VariantType::IsoString;
1683  }
1684 
1689  bool IsString() const
1690  {
1691  return IsStringType( m_type );
1692  }
1693 
1700  static bool IsStructuredType( int type );
1701 
1712  bool IsStructured() const
1713  {
1714  return IsStructuredType( m_type );
1715  }
1716 
1721  static const char* TypeAsString( int type );
1722 
1723 private:
1724 
1725  union Data
1726  {
1727  bool boolValue;
1728 
1729  int8 int8Value;
1730  int16 int16Value;
1731  int32 int32Value;
1732  int64 int64Value;
1733 
1734  uint8 uint8Value;
1735  uint16 uint16Value;
1736  uint32 uint32Value;
1737  uint64 uint64Value;
1738 
1739  float float32Value;
1740  double float64Value;
1741 
1742  fcomplex* complex32Value;
1743  dcomplex* complex64Value;
1744 
1745  TimePoint* timePointValue;
1746 
1747  I32Point* i32PointValue;
1748  F32Point* f32PointValue;
1749  F64Point* f64PointValue;
1750 
1751  I32Rect* i32RectValue;
1752  F32Rect* f32RectValue;
1753  F64Rect* f64RectValue;
1754 
1755  I8Vector* i8VectorValue;
1756  UI8Vector* ui8VectorValue;
1757  I16Vector* i16VectorValue;
1758  UI16Vector* ui16VectorValue;
1759  I32Vector* i32VectorValue;
1760  UI32Vector* ui32VectorValue;
1761  I64Vector* i64VectorValue;
1762  UI64Vector* ui64VectorValue;
1763  F32Vector* f32VectorValue;
1764  F64Vector* f64VectorValue;
1765  C32Vector* c32VectorValue;
1766  C64Vector* c64VectorValue;
1767 
1768  I8Matrix* i8MatrixValue;
1769  UI8Matrix* ui8MatrixValue;
1770  I16Matrix* i16MatrixValue;
1771  UI16Matrix* ui16MatrixValue;
1772  I32Matrix* i32MatrixValue;
1773  UI32Matrix* ui32MatrixValue;
1774  I64Matrix* i64MatrixValue;
1775  UI64Matrix* ui64MatrixValue;
1776  F32Matrix* f32MatrixValue;
1777  F64Matrix* f64MatrixValue;
1778  C32Matrix* c32MatrixValue;
1779  C64Matrix* c64MatrixValue;
1780 
1781  ByteArray* byteArrayValue;
1782 
1783  String* stringValue;
1784  IsoString* isoStringValue;
1785 
1786  StringList* stringListValue;
1787  IsoStringList* isoStringListValue;
1788 
1789  StringKeyValue* stringKeyValueValue;
1790  IsoStringKeyValue* isoStringKeyValueValue;
1791 
1792  StringKeyValueList* stringKeyValueListValue;
1793  IsoStringKeyValueList* isoStringKeyValueListValue;
1794 
1795  uint64 anyValue;
1796  };
1797 
1798  Data m_data;
1799  int m_type;
1800 
1801  // Internal
1802  void Copy( const Variant& );
1803 
1804  friend class PCL_AssertVariantSize;
1805 };
1806 
1807 class PCL_AssertVariantSize
1808 {
1809 #ifndef _MSC_VER
1810 # ifdef __clang__
1811  _Pragma("clang diagnostic push")
1812  _Pragma("clang diagnostic ignored \"-Wunused-private-field\"")
1813 # endif
1814  Variant* v;
1815  static_assert( sizeof( v->m_data ) == sizeof( uint64 ), "Invalid sizeof( Variant::m_data )" );
1816  static_assert( sizeof( v->m_data.anyValue ) == sizeof( v->m_data ), "Invalid sizeof( Variant::m_data.anyValue )" );
1817 # ifdef __clang__
1818  _Pragma("clang diagnostic pop")
1819 # endif
1820 #else
1821  static_assert( sizeof( Variant::Data ) == sizeof( uint64 ), "Invalid sizeof( Variant::m_data )" );
1822 #endif
1823 };
1824 
1825 // ----------------------------------------------------------------------------
1826 
1827 } // pcl
1828 
1833 struct api_property_value;
1834 namespace pcl
1835 {
1836  Variant VariantFromAPIPropertyValue( const api_property_value& );
1837  void APIPropertyValueFromVariant( api_property_value&, const Variant& );
1838  Variant::data_type VariantTypeFromAPIPropertyType( uint64 );
1839  uint64 APIPropertyTypeFromVariantType( Variant::data_type );
1840 } // pcl
1841 
1842 #endif // __PCL_Variant_h
1843 
1844 // ----------------------------------------------------------------------------
1845 // EOF pcl/Variant.h - Released 2019-11-07T10:59:34Z
Variant(const UI16Vector &ui16v)
Definition: Variant.h:561
Variant(bool b)
Definition: Variant.h:351
Vector ToVector() const
Definition: Variant.h:1293
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)
Definition: Variant.h:1680
Variant(const char *cp)
Definition: Variant.h:800
An instant in any timescale.
Definition: TimePoint.h:102
Variant(int64 i64)
Definition: Variant.h:383
32-bit signed integer vector.
32-bit floating point complex vector.
32-bit floating point real vector.
Variant(const String &s)
Definition: Variant.h:780
unsigned char uint8
Definition: Defs.h:576
Variant(const StringKeyValueList &skvl)
Definition: Variant.h:850
Dynamic list of 8-bit strings.
signed short int16
Definition: Defs.h:582
int Compare(FI1 i1, FI1 j1, FI2 i2, FI2 j2)
Definition: Utility.h:639
virtual ~Variant()
Definition: Variant.h:889
PCL root namespace.
Definition: AbstractImage.h:76
Key-value association of two Unicode (UTF-16) strings.
Variant(const StringKeyValue &skv)
Definition: Variant.h:830
32-bit unsigned integer vector.
static bool IsComplexType(int type)
Definition: Variant.h:1611
32-bit signed integer matrix.
32-bit floating point real matrix.
64-bit integer matrix.
32-bit floating point complex matrix.
64-bit floating point real matrix.
bool IsVector() const
Definition: Variant.h:1654
64-bit floating point complex matrix.
64-bit integer vector.
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)
Definition: Variant.h:461
bool IsValid() const
Definition: Variant.h:960
bool IsScalar() const
Definition: Variant.h:1602
8-bit signed integer matrix.
static bool IsTimePointType(int type)
Definition: Variant.h:1628
64-bit floating point real matrix.
Variant(const DPoint &dp)
Definition: Variant.h:491
bool IsComplex() const
Definition: Variant.h:1620
Variant(float f)
Definition: Variant.h:424
Dynamic list of key-value associations implemented as 8-bit strings.
Variant(const DVector &dv)
Definition: Variant.h:621
Unsigned integer matrix.
Variant(const CharVector &cv)
Definition: Variant.h:531
Variant(const C32Vector &c32v)
Definition: Variant.h:631
32-bit integer point on the plane.
Variant(const I16Vector &i16v)
Definition: Variant.h:551
int BytesPerBlockElement() const
Definition: Variant.h:1585
Variant(const FRect &fr)
Definition: Variant.h:511
bool IsStructured() const
Definition: Variant.h:1712
size_t size_type
Definition: Defs.h:543
8-bit unsigned integer matrix.
64-bit floating-point rectangle in the R^2 space.
Variant(const ByteVector &bv)
Definition: Variant.h:541
Variant(const DRect &dr)
Definition: Variant.h:521
Variant(const IsoStringList &isl)
Definition: Variant.h:820
8-bit unsigned integer vector.
64-bit floating point real matrix.
Variant(Variant &&x)
Definition: Variant.h:879
Variant(const IsoStringKeyValueList &iskvl)
Definition: Variant.h:860
Variant(const C32Matrix &c32m)
Definition: Variant.h:751
Variant(const C64Vector &c64v)
Definition: Variant.h:641
Variant(const Variant &x)
Definition: Variant.h:870
Unicode (UTF-16) string.
Definition: String.h:7911
unsigned long long uint64
Definition: Defs.h:616
signed char int8
Definition: Defs.h:570
64-bit unsigned integer matrix.
8-bit signed integer vector.
64-bit floating point real vector.
Variant(const ByteMatrix &bm)
Definition: Variant.h:661
Variant(uint16 u16)
Definition: Variant.h:399
8-bit signed integer matrix.
unsigned short uint16
Definition: Defs.h:588
16-bit signed integer matrix.
Variant(uint8 u8)
Definition: Variant.h:391
bool ToBoolean() const
Definition: Variant.h:1049
bool IsMatrix() const
Definition: Variant.h:1671
Variant(const IsoStringKeyValue &iskv)
Definition: Variant.h:840
Variant(const Rect &r)
Definition: Variant.h:501
Variant(const CharMatrix &cm)
Definition: Variant.h:651
Dynamic list of key-value associations implemented as Unicode (UTF-16) strings.
32-bit unsigned integer matrix.
signed int int32
Definition: Defs.h:594
Dynamic list of Unicode (UTF-16) strings.
32-bit floating-point rectangle in the R^2 space.
32-bit unsigned integer vector.
Variant(uint32 u32)
Definition: Variant.h:407
Variant(int16 i16)
Definition: Variant.h:367
Variant(const UI16Matrix &ui16m)
Definition: Variant.h:681
64-bit unsigned integer components.
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2)
Definition: Array.h:2086
A complex number whose components are 64-bit floating point real numbers.
void Assign(const Variant &x)
Definition: Variant.h:908
Variant(uint64 u64)
Definition: Variant.h:415
32-bit floating-point point in the R^2 space.
void Transfer(Variant &&x)
Definition: Variant.h:945
Variant(const UIMatrix &uim)
Definition: Variant.h:701
Variant(fcomplex fc)
Definition: Variant.h:442
64-bit floating point real vector.
16-bit unsigned integer vector.
Variant(dcomplex dc)
Definition: Variant.h:452
Variant(const UI64Vector &ui64v)
Definition: Variant.h:601
Acts like a union to store instances of different data types.
Definition: Variant.h:331
Variant(const DMatrix &dm)
Definition: Variant.h:741
Variant(const IVector &iv)
Definition: Variant.h:571
Variant(const I16Matrix &i16m)
Definition: Variant.h:671
Variant(const IsoString &s8)
Definition: Variant.h:790
8-bit unsigned integer vector.
32-bit signed integer matrix.
data_type Type() const
Definition: Variant.h:968
64-bit floating-point point in the R^2 space.
Variant(const IMatrix &im)
Definition: Variant.h:691
Variant(const UIVector &uiv)
Definition: Variant.h:581
16-bit unsigned integer matrix.
A complex number whose components are 64-bit floating point real numbers.
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2)
Definition: Array.h:2075
32-bit integer point on the plane.
Variant(const FPoint &fp)
Definition: Variant.h:481
Variant(const I64Matrix &i64m)
Definition: Variant.h:711
Variant(const C64Matrix &c64m)
Definition: Variant.h:761
Variant(int8 i8)
Definition: Variant.h:359
VariantType::value_type data_type
Definition: Variant.h:338
32-bit floating point real matrix.
32-bit signed integer vector.
Variant(const StringList &sl)
Definition: Variant.h:810
Key-value association of two 8-bit strings.
complex ToComplex() const
Definition: Variant.h:1129
64-bit floating-point rectangle in the R^2 space.
32-bit integer rectangle on the plane.
Variant(int32 i32)
Definition: Variant.h:375
32-bit floating-point point in the R^2 space.
void Transfer(Variant &x)
Definition: Variant.h:930
Variant(const ByteArray &ba)
Definition: Variant.h:771
A complex number whose components are 32-bit floating point real numbers.
bool IsString() const
Definition: Variant.h:1689
Variant(const FVector &fv)
Definition: Variant.h:611
bool IsTimePoint() const
Definition: Variant.h:1637
Variant(const Point &p)
Definition: Variant.h:471
32-bit floating point real vector.
unsigned int uint32
Definition: Defs.h:600
signed long long int64
Definition: Defs.h:610
32-bit integer rectangle on the plane.
Variant(const UI64Matrix &ui64m)
Definition: Variant.h:721
Variant(double d)
Definition: Variant.h:433
Variant(const FMatrix &fm)
Definition: Variant.h:731
Matrix ToMatrix() const
Definition: Variant.h:1411
Variant(const I64Vector &i64v)
Definition: Variant.h:591
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Definition: String.h:5387
8-bit unsigned integer matrix.