CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
RxVariant.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24
25
26
27#if !defined(_ODVARIANT_H_INCLUDED_)
28#define _ODVARIANT_H_INCLUDED_
29
30#include "TD_PackPush.h"
31#include "OdPlatformSettings.h"
32#include "RxObject.h"
33
34#include "StringArray.h"
35#include "BoolArray.h"
36#include "Int8Array.h"
37#include "Int16Array.h"
38#include "Int32Array.h"
39#include "Int64Array.h"
40#include "UInt8Array.h"
41#include "UInt16Array.h"
42#include "UInt32Array.h"
43#include "UInt64Array.h"
44#include "DoubleArray.h"
45#include "OdString.h"
46#include "OdAnsiString.h"
47
55{
56public:
58};
59
60const int nOdVariantDataSize = 8;
61
68{
69protected:
70 int m_type;
71 union // Union is required to have proper data alignment which is important
72 { // for some platforms
74 double dbl;
75 void* ptr;
76 } m_uData;
77 void* data() const {return (void*)m_uData.uint8;}
78
79 virtual void setVarType(int newType, int& type, void* data);
80public:
82 {
83 virtual void construct(void* pData) const = 0;
84 virtual void destroy(void* pData) const = 0;
85 virtual ~TypeFactory() {}
86 };
87 static const TypeFactory* typeFactory(int type);
88public:
89 typedef enum
90 {
91 kVoid = 0x0000,
92 kString = 0x0001,
93 kBool = 0x0002,
94 kInt8 = 0x0003,
95 kUInt8 = 0x0003,
96 kInt16 = 0x0004,
97 kUInt16 = 0x0004,
98 kInt32 = 0x0005,
99 kUInt32 = 0x0005,
100 kInt64 = 0x0006,
101 kUInt64 = 0x0006,
102 kDouble = 0x0007,
103 kWString = 0x0008,
104 kAnsiString = 0x0008,
105 kRxObjectPtr = 0x0009,
106 kNextType = 0x000A,
107 kByRef = 0x0040,
108 kArray = 0x0080
109 } Type;
110
112 OdVariant(const OdVariant& val);
114 virtual ~OdVariant();
115
119 int varType() const { return m_type; }
123 Type type() const { return Type(m_type & (0x3F)); }
127 bool isArray() const { return (m_type & kArray)!=0; }
131 bool isByRef() const { return (m_type & kByRef)!=0; }
132
133 OdVariant(const OdString& val);
134 OdVariant(const OdAnsiString& val);
136 OdVariant(bool val);
145 OdVariant(double val);
146#ifdef OD_INTPTR_UNIQUE
147 OdVariant(OdIntPtr val);
148#endif
149
155 const OdString& getString() const;
156
162 const OdAnsiString& getAnsiString() const;
163
170
176 bool getBool() const;
177
184
191
198
205
212
219
226
233
240
246 double getDouble() const;
247
248
255
261 OdAnsiString* getAnsiStringPtr() const;
262
269
275 bool* getBoolPtr() const;
276
283
290
297
304
311
318
325
332
338 double* getDoublePtr() const;
339
340
347
353 const OdAnsiStringArray& getAnsiStringArray() const;
354
361
367 const OdBoolArray& getBoolArray () const;
368
374 const OdInt8Array& getInt8Array () const;
375
382
389
396
403
410
417
424
431
436
443 OdAnsiStringArray& asAnsiStringArray();
444
452
460
468
476
484
492
500
508
516
524
532
539
545 OdAnsiStringArray* getAnsiStringArrayPtr() const;
546
553
560
567
574
581
588
595
602
609
616
623
630
639 OdVariant& setAnsiString(const OdAnsiString& val);
640
650
659 OdVariant& setBool (bool val);
660
670
680
690
700
710
720
730
740
750
759 OdVariant& setDouble(double val);
760
770
779 OdVariant& setAnsiStringPtr(OdAnsiString* val);
780
790
799 OdVariant& setBoolPtr (bool* val);
800
810
820
830
840
850
860
870
880
889 OdVariant& setDoublePtr(double* val);
890
900
909 OdVariant& setAnsiStringArray(const OdAnsiStringArray& val);
910
920
930
940
950
960
970
980
990
1000
1010
1020
1021
1031
1040 OdVariant& setAnsiStringArrayPtr(OdAnsiStringArray* val);
1041
1051
1061
1071
1081
1091
1101
1111
1121
1131
1141
1151};
1152
1153
1154
1155#include "TD_PackPop.h"
1156
1157#endif //_ODVARIANT_H_INCLUDED_
1158
@ kVoid
Definition: BrepBuilder.h:49
unsigned int OdUInt32
short OdInt16
signed char OdInt8
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
ptrdiff_t OdIntPtr
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
const int nOdVariantDataSize
Definition: RxVariant.h:60
OdError & operator=(const OdError &source)
Definition: Int64.h:43
OdVariant & setStringArrayPtr(OdStringArray *val)
OdInt16 * getInt16Ptr() const
OdVariant & setDoubleArrayPtr(OdDoubleArray *val)
OdVariant & setInt32(OdInt32 val)
OdInt8 * getInt8Ptr() const
OdStringArray & asStringArray()
const OdStringArray & getStringArray() const
OdVariant & setUInt64Ptr(OdUInt64 *val)
OdVariant & setInt16Ptr(OdInt16 *val)
const OdAnsiStringArray & getAnsiStringArray() const
virtual void setVarType(int newType, int &type, void *data)
bool isByRef() const
Definition: RxVariant.h:131
const OdRxObjectPtrArray & getRxObjectPtrArray() const
OdVariant & setAnsiStringPtr(OdAnsiString *val)
OdVariant(const OdAnsiString &val)
double getDouble() const
OdRxObjectPtrArray & asRxObjectPtrArray()
OdVariant & setUInt16Ptr(OdUInt16 *val)
OdVariant & setUInt32Array(const OdUInt32Array &val)
OdVariant(OdUInt32 val)
const OdRxObjectPtr & getRxObjectPtr() const
double dbl
Definition: RxVariant.h:74
bool getBool() const
OdAnsiStringArray & asAnsiStringArray()
OdVariant(OdUInt64 val)
OdInt16Array & asInt16Array()
const OdUInt16Array & getUInt16Array() const
bool isArray() const
Definition: RxVariant.h:127
OdUInt8Array * getUInt8ArrayPtr() const
const OdInt64Array & getInt64Array() const
OdVariant & setInt64Array(const OdInt64Array &val)
const OdInt16Array & getInt16Array() const
OdInt32 * getInt32Ptr() const
OdVariant & setString(const OdString &val)
OdUInt16Array * getUInt16ArrayPtr() const
OdUInt32 getUInt32() const
OdVariant(OdUInt16 val)
OdInt64Array * getInt64ArrayPtr() const
const OdDoubleArray & getDoubleArray() const
OdVariant & setInt16(OdInt16 val)
OdUInt16 getUInt16() const
OdVariant & setInt8Ptr(OdInt8 *val)
OdUInt32 * getUInt32Ptr() const
OdVariant & setInt8Array(const OdInt8Array &val)
OdVariant(OdInt8 val)
OdVariant & setStringArray(const OdStringArray &val)
OdVariant & setAnsiStringArray(const OdAnsiStringArray &val)
OdVariant & setUInt32ArrayPtr(OdUInt32Array *val)
OdVariant(OdInt32 val)
OdUInt8 * getUInt8Ptr() const
OdVariant & setUInt32Ptr(OdUInt32 *val)
OdBoolArray & asBoolArray()
OdInt64 getInt64() const
OdVariant & setInt16ArrayPtr(OdInt16Array *val)
OdUInt8 getUInt8() const
OdVariant & setUInt32(OdUInt32 val)
OdDoubleArray & asDoubleArray()
OdBoolArray * getBoolArrayPtr() const
OdUInt64 getUInt64() const
OdVariant & setAnsiStringArrayPtr(OdAnsiStringArray *val)
OdDoubleArray * getDoubleArrayPtr() const
OdVariant(bool val)
OdVariant(OdInt16 val)
OdVariant(OdUInt8 val)
OdVariant & setDoublePtr(double *val)
OdVariant(const OdString &val)
OdVariant & setBoolPtr(bool *val)
virtual ~OdVariant()
const OdUInt64Array & getUInt64Array() const
OdInt16Array * getInt16ArrayPtr() const
OdVariant & setUInt8(OdUInt8 val)
OdVariant(const OdVariant &val)
OdInt64 * getInt64Ptr() const
OdRxObjectPtrArray * getRxObjectPtrArrayPtr() const
OdVariant & setRxObjectPtr(const OdRxObjectPtr &val)
OdVariant & setInt8ArrayPtr(OdInt8Array *val)
int m_type
Definition: RxVariant.h:70
OdVariant & setBoolArray(const OdBoolArray &val)
OdVariant & setUInt8ArrayPtr(OdUInt8Array *val)
OdVariant & setUInt16(OdUInt16 val)
OdVariant & setDouble(double val)
OdStringArray * getStringArrayPtr() const
OdVariant & setInt16Array(const OdInt16Array &val)
OdVariant & setBool(bool val)
OdVariant(double val)
static const TypeFactory * typeFactory(int type)
OdVariant & setBoolArrayPtr(OdBoolArray *val)
void * ptr
Definition: RxVariant.h:75
OdVariant & setInt64(OdInt64 val)
bool * getBoolPtr() const
OdString * getStringPtr() const
void * data() const
Definition: RxVariant.h:77
OdAnsiStringArray * getAnsiStringArrayPtr() const
OdInt64Array & asInt64Array()
OdInt8Array * getInt8ArrayPtr() const
OdUInt64 * getUInt64Ptr() const
OdIntPtr getIntPtr() const
OdVariant & setUInt64Array(const OdUInt64Array &val)
OdVariant & setIntPtr(OdIntPtr val)
const OdInt32Array & getInt32Array() const
OdUInt16Array & asUInt16Array()
OdVariant(OdInt64 val)
const OdInt8Array & getInt8Array() const
OdUInt64Array & asUInt64Array()
OdVariant & setRxObjectPtrArray(const OdRxObjectPtrArray &val)
OdVariant & setAnsiString(const OdAnsiString &val)
double * getDoublePtr() const
OdVariant & setInt64ArrayPtr(OdInt64Array *val)
OdVariant & setUInt16Array(const OdUInt16Array &val)
OdVariant & setInt64Ptr(OdInt64 *val)
OdVariant & setStringPtr(OdString *val)
OdVariant & setInt32ArrayPtr(OdInt32Array *val)
OdVariant & setDoubleArray(const OdDoubleArray &val)
Type type() const
Definition: RxVariant.h:123
const OdString & getString() const
OdInt8Array & asInt8Array()
OdVariant & setUInt16ArrayPtr(OdUInt16Array *val)
OdVariant(const OdRxObjectPtr &val)
const OdUInt32Array & getUInt32Array() const
OdVariant & setUInt8Ptr(OdUInt8 *val)
OdVariant & setUInt8Array(const OdUInt8Array &val)
OdInt32Array * getInt32ArrayPtr() const
OdUInt16 * getUInt16Ptr() const
OdInt16 getInt16() const
OdVariant & setRxObjectPtrPtr(OdRxObjectPtr *val)
OdUInt64Array * getUInt64ArrayPtr() const
OdUInt8Array & asUInt8Array()
OdVariant & setInt32Array(const OdInt32Array &val)
OdUInt32Array * getUInt32ArrayPtr() const
OdUInt32Array & asUInt32Array()
const OdAnsiString & getAnsiString() const
OdVariant & setUInt64(OdUInt64 val)
int varType() const
Definition: RxVariant.h:119
OdVariant & setRxObjectPtrArrayPtr(OdRxObjectPtrArray *val)
OdInt8 getInt8() const
OdInt32Array & asInt32Array()
OdAnsiString * getAnsiStringPtr() const
OdRxObjectPtr * getRxObjectPtrPtr() const
OdVariant & setUInt64ArrayPtr(OdUInt64Array *val)
OdVariant & setInt8(OdInt8 val)
OdInt32 getInt32() const
const OdBoolArray & getBoolArray() const
const OdUInt8Array & getUInt8Array() const
OdVariant & setInt32Ptr(OdInt32 *val)
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
virtual void destroy(void *pData) const =0
virtual ~TypeFactory()
Definition: RxVariant.h:85
virtual void construct(void *pData) const =0