Go to the documentation of this file.00001
00011
00012
00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00014 #pragma once
00015 #endif
00016
00017 #ifndef __XSIVALUE_H__
00018 #define __XSIVALUE_H__
00019
00020 #include "sicppsdk.h"
00021 #include "xsi_ref.h"
00022
00023 namespace XSI {
00024
00025 class CLongArray;
00026 class CFloatArray;
00027 class CValueArray;
00028
00029 namespace MATH {
00030 class CVector3;
00031 class CVector2f;
00032 class CVector3f;
00033 class CVector4f;
00034 class CQuaternionf;
00035 class CRotationf;
00036 class CMatrix3f;
00037 class CMatrix4f;
00038 class CColor4f;
00039 class CShape;
00040 };
00041
00042
00157
00158
00159 class SICPPSDKDECL CValue
00160 {
00161 public:
00162 typedef void* siPtrType;
00163
00164 struct Blob
00165 {
00166 ULONG m_nSize;
00167 unsigned char* m_pBlobData;
00168 };
00169 typedef Blob siBlobType;
00170
00172 enum DataType
00173 {
00174 siEmpty = 0,
00175 siInt2 = 2,
00176 siInt4 = 3,
00177 siInt8 = 10,
00178 siFloat = 4,
00179 siDouble = 5,
00180 siString = 8,
00181 siIDispatch = 9,
00186 siBool = 11,
00187 siIUnknown = 13,
00190 siInt1 = 16,
00191 siUInt1 = 17,
00192 siUInt2 = 18,
00193 siUInt4 = 19,
00194 siUInt8 = 20,
00195 siWStr = 31,
00197 siRef = 666,
00198 siArray,
00199 siPtr,
00200 siRefArray,
00201 siVector3,
00202 siLongArray,
00203 siFloatArray,
00204 siVector2f=800,
00205 siVector3f,
00206 siVector4f,
00207 siQuaternionf,
00208 siRotationf,
00209 siMatrix3f,
00210 siMatrix4f,
00211 siColor4f,
00212 siShape,
00213 siBlob
00214 };
00215
00243 union ValueField
00244 {
00245 short sval;
00246 LONG lval;
00247 float fval;
00248 double dval;
00249 bool bval;
00250 wchar_t* pwval;
00251 siPtrType pval;
00252 signed char cval;
00253 unsigned char ucval;
00254 CValueArray* paval;
00255 CLongArray* plaval;
00256 CFloatArray* pfaval;
00257 unsigned short usval;
00258 ULONG ulval;
00259 MATH::CVector2f* pv2f;
00260 MATH::CVector3f* pv3f;
00261 MATH::CVector4f* pv4f;
00262 MATH::CQuaternionf* pqf;
00263 MATH::CRotationf* prf;
00264 MATH::CMatrix3f* pm3f;
00265 MATH::CMatrix4f* pm4f;
00266 MATH::CColor4f* pc4f;
00267 MATH::CShape* pshp;
00268 LLONG llval;
00269 ULLONG ullval;
00270 siBlobType* pblobval;
00271 }m_u;
00272 DataType m_t;
00273
00275 CValue();
00276
00278 virtual ~CValue();
00279
00283 CValue(const CValue& valSrc);
00284
00288 CValue(short valSrc);
00289
00293 CValue(unsigned short valSrc);
00294
00298 CValue(LONG valSrc);
00299
00300 #if !defined(linux) || !defined(__x86_64)
00301
00304 CValue(int valSrc);
00305 #endif
00306
00310 CValue(ULONG valSrc);
00311
00316 CValue(LLONG valSrc);
00317
00322 CValue(ULLONG valSrc);
00323
00327 CValue(float valSrc);
00328
00332 CValue(double valSrc);
00333
00337 CValue(bool valSrc);
00338
00342 CValue(const CString& valSrc);
00343
00347 CValue(const CRef& valSrc);
00348
00353 CValue(const CRefArray& valSrc);
00354
00358 CValue(unsigned char valSrc);
00359
00363 CValue(signed char valSrc);
00364
00368 CValue(const CValueArray& valSrc);
00369
00374 CValue(const CLongArray& valSrc);
00375
00380 CValue(const CFloatArray& valSrc);
00381
00386 CValue(const MATH::CVector3& valSrc);
00387
00392 CValue(const MATH::CVector2f& valSrc);
00393
00398 CValue(const MATH::CVector3f& valSrc);
00399
00404 CValue(const MATH::CVector4f& val);
00405
00410 CValue(const MATH::CQuaternionf& val);
00411
00416 CValue(const MATH::CRotationf& val);
00417
00422 CValue(const MATH::CMatrix3f& val);
00423
00428 CValue(const MATH::CMatrix4f& val);
00429
00434 CValue(const MATH::CColor4f& val);
00435
00440 CValue(const MATH::CShape& val);
00441
00445 CValue(siPtrType valSrc);
00446
00450 CValue(const siBlobType& valSrc);
00451
00455 CValue(const wchar_t* valSrc);
00456
00460 CValue(const char* valSrc);
00461
00465 CValue& operator=(const CValue& valSrc);
00466
00470 CValue& operator=(short valSrc);
00471
00475 CValue& operator=(unsigned short valSrc);
00476
00480 CValue& operator=(LONG valSrc);
00481
00482 #if !defined(linux) || !defined(__x86_64)
00483
00486 CValue& operator=(int valSrc);
00487 #endif
00488
00492 CValue& operator=(ULONG valSrc);
00493
00498 CValue& operator=(LLONG valSrc);
00499
00504 CValue& operator=(ULLONG valSrc);
00505
00509 CValue& operator=(float valSrc);
00510
00514 CValue& operator=(double valSrc);
00515
00519 CValue& operator=(bool valSrc);
00520
00524 CValue& operator=(const CString& valSrc);
00525
00529 CValue& operator=(const wchar_t * valSrc );
00530
00534 CValue& operator=(const char* valSrc );
00535
00539 CValue& operator=(const CRef& valSrc);
00540
00545 CValue& operator=(const CRefArray& valSrc);
00546
00551 CValue& operator=(const MATH::CVector3& valSrc);
00552
00557 CValue& operator=(const MATH::CVector2f& valSrc);
00558
00563 CValue& operator=(const MATH::CVector3f& valSrc);
00564
00569 CValue& operator=(const MATH::CVector4f& valSrc);
00570
00575 CValue& operator=(const MATH::CMatrix3f& valSrc);
00576
00581 CValue& operator=(const MATH::CMatrix4f& valSrc);
00582
00587 CValue& operator=(const MATH::CRotationf& valSrc);
00588
00593 CValue& operator=(const MATH::CQuaternionf& valSrc);
00594
00599 CValue& operator=(const MATH::CColor4f& valSrc);
00600
00605 CValue& operator=(const MATH::CShape& valSrc);
00606
00610 CValue& operator=(unsigned char valSrc);
00611
00615 CValue& operator=(signed char valSrc);
00616
00620 CValue& operator=(const CValueArray& valSrc);
00621
00625 CValue& operator=(const CLongArray& valSrc);
00626
00630 CValue& operator=(const CFloatArray& valSrc);
00631
00635 CValue& operator=(siPtrType valSrc);
00636
00640 CValue& operator=(const siBlobType& valSrc );
00641
00643 operator short () const;
00645 operator unsigned short () const;
00647 operator LONG () const;
00648
00649 #if !defined(linux) || !defined(__x86_64)
00650
00653 operator int () const;
00654 #endif
00655
00659 operator ULONG () const;
00660
00664 operator LLONG () const;
00665
00669 operator ULLONG () const;
00670
00672 operator float () const;
00674 operator double () const;
00676 operator bool () const;
00678 operator CString () const;
00680 operator CRef () const;
00685 operator CRefArray () const;
00687 operator unsigned char () const;
00689 operator signed char () const;
00691 operator CValueArray& () const;
00692
00696 operator CLongArray& () const;
00697
00701 operator CFloatArray& () const;
00702
00706 operator MATH::CVector3 () const;
00707
00711 operator MATH::CVector2f() const;
00712
00716 operator MATH::CVector3f() const;
00717
00721 operator MATH::CVector4f() const;
00722
00726 operator MATH::CMatrix3f() const;
00727
00731 operator MATH::CMatrix4f() const;
00732
00736 operator MATH::CRotationf() const;
00737
00741 operator MATH::CQuaternionf() const;
00742
00746 operator MATH::CColor4f() const;
00747
00751 operator MATH::CShape() const;
00752
00776 operator siPtrType () const;
00777
00781 operator siBlobType&() const;
00782
00786 bool operator==(const CValue& valSrc) const;
00787
00789 inline bool operator== (short) const;
00791 inline bool operator== (unsigned short) const;
00793 inline bool operator== (LONG) const;
00794 #if !defined(linux) || !defined(__x86_64)
00795
00796 inline bool operator== (int) const;
00797 #endif
00798
00799 inline bool operator== (ULONG) const;
00800
00804 inline bool operator== (LLONG) const;
00805
00809 inline bool operator== (ULLONG) const;
00810
00812 inline bool operator== (float) const;
00814 inline bool operator== (double) const;
00816 inline bool operator== (bool) const;
00818 inline bool operator== (const CString&) const;
00820 inline bool operator== (const wchar_t*) const;
00822 inline bool operator== (const char*) const;
00824 inline bool operator== (const CRef&) const;
00828 inline bool operator== (const CRefArray&) const;
00830 inline bool operator== (unsigned char) const;
00832 inline bool operator== (signed char) const;
00834 bool operator== (const CValueArray&) const;
00835
00839 bool operator== (const CLongArray&) const;
00840
00844 bool operator== (const CFloatArray&) const;
00845
00847 inline bool operator== (const siPtrType) const;
00848
00850 inline bool operator == (const siBlobType&) const;
00851
00855 inline bool operator== (const MATH::CVector3&) const;
00856
00860 inline bool operator== (const MATH::CVector2f&) const;
00861
00865 inline bool operator== (const MATH::CVector3f&) const;
00866
00870 inline bool operator== (const MATH::CVector4f&) const;
00871
00875 inline bool operator== (const MATH::CMatrix3f&) const;
00876
00880 inline bool operator== (const MATH::CMatrix4f&) const;
00881
00885 inline bool operator== (const MATH::CRotationf&) const;
00886
00890 inline bool operator== (const MATH::CQuaternionf&) const;
00891
00895 inline bool operator== (const MATH::CColor4f&) const;
00896
00900 inline bool operator== (const MATH::CShape&) const;
00901
00905 bool operator!=(const CValue& valSrc) const;
00906
00924 bool operator > (const CValue& val ) const;
00925
00943 bool operator < (const CValue& val ) const;
00944
00949 bool operator >= (const CValue& val ) const;
00950
00955 bool operator <= (const CValue& val ) const;
00956
00957
00958
01002 void ChangeType( CValue::DataType in_type, const CValue* in_pSrc = NULL );
01003
01005 void Clear();
01006
01011 void Attach( CValue& in_valSrc);
01012
01017 CValue Detach();
01018
01022 CString GetAsText() const;
01023
01027 inline bool IsEmpty() const;
01028 };
01029
01030 inline bool CValue::operator== (short val) const
01031 {
01032 return *this == CValue(val);
01033 }
01034
01035 inline bool CValue::operator== (unsigned short val) const
01036 {
01037 return *this == CValue(val);
01038 }
01039
01040 inline bool CValue::operator== (LONG val) const
01041 {
01042 return *this == CValue(val);
01043 }
01044
01045 #if !defined(linux) || !defined(__x86_64)
01046 inline bool CValue::operator== (int val) const
01047 {
01048 return *this == CValue(val);
01049 }
01050 #endif
01051
01052 inline bool CValue::operator== (ULONG val) const
01053 {
01054 return *this == CValue(val);
01055 }
01056
01057 inline bool CValue::operator== (LLONG val) const
01058 {
01059 return *this == CValue(val);
01060 }
01061
01062 inline bool CValue::operator== (ULLONG val) const
01063 {
01064 return *this == CValue(val);
01065 }
01066
01067 inline bool CValue::operator== (float val) const
01068 {
01069 return *this == CValue(val);
01070 }
01071
01072 inline bool CValue::operator== (double val) const
01073 {
01074 return *this == CValue(val);
01075 }
01076
01077 inline bool CValue::operator== (bool val) const
01078 {
01079 return *this == CValue(val);
01080 }
01081
01082 inline bool CValue::operator== (const CString& val) const
01083 {
01084 return *this == CValue(val);
01085 }
01086
01087 inline bool CValue::operator== (const wchar_t* val) const
01088 {
01089 return *this == CValue(val);
01090 }
01091
01092 inline bool CValue::operator== (const char* val) const
01093 {
01094 return *this == CValue(val);
01095 }
01096
01097 inline bool CValue::operator== (const CRef& val) const
01098 {
01099 return *this == CValue(val);
01100 }
01101
01102 inline bool CValue::operator== (const CRefArray& val) const
01103 {
01104 return *this == CValue(val);
01105 }
01106
01107 inline bool CValue::operator== (unsigned char val) const
01108 {
01109 return *this == CValue(val);
01110 }
01111
01112 inline bool CValue::operator== (signed char val) const
01113 {
01114 return *this == CValue(val);
01115 }
01116
01117 inline bool CValue::operator== (const siPtrType val) const
01118 {
01119 return *this == CValue(val);
01120 }
01121
01122 inline bool CValue::operator== (const siBlobType& val) const
01123 {
01124 return *this == CValue(val);
01125 }
01126
01127 inline bool CValue::operator== (const MATH::CVector3& val) const
01128 {
01129 return *this == CValue(val);
01130 }
01131
01132 inline bool CValue::operator== (const MATH::CVector2f& val) const
01133 {
01134 return *this == CValue(val);
01135 }
01136 inline bool CValue::operator== (const MATH::CVector3f& val) const
01137 {
01138 return *this == CValue(val);
01139 }
01140 inline bool CValue::operator== (const MATH::CVector4f& val) const
01141 {
01142 return *this == CValue(val);
01143 }
01144 inline bool CValue::operator== (const MATH::CQuaternionf& val) const
01145 {
01146 return *this == CValue(val);
01147 }
01148 inline bool CValue::operator== (const MATH::CRotationf& val) const
01149 {
01150 return *this == CValue(val);
01151 }
01152 inline bool CValue::operator== (const MATH::CMatrix3f& val) const
01153 {
01154 return *this == CValue(val);
01155 }
01156 inline bool CValue::operator== (const MATH::CMatrix4f& val) const
01157 {
01158 return *this == CValue(val);
01159 }
01160 inline bool CValue::operator== (const MATH::CColor4f& val) const
01161 {
01162 return *this == CValue(val);
01163 }
01164
01165 inline bool CValue::operator== (const MATH::CShape& val) const
01166 {
01167 return *this == CValue(val);
01168 }
01169
01170 inline bool CValue::IsEmpty() const
01171 {
01172 return m_t == siEmpty;
01173 }
01174
01175
01184
01185 class SICPPSDKDECL CValueArray
01186 {
01187 public:
01191 CValueArray(LONG in_size=0);
01192
01196 CValueArray(const CValueArray& in_array);
01197
01199 ~CValueArray();
01200
01205 CValueArray& operator=( const CValueArray& in_array );
01206
01210 LONG GetCount() const;
01211
01216 CStatus Add( const CValue& in_item );
01217
01221 CStatus Clear();
01222
01229 CStatus Resize( LONG in_size);
01230
01237 const CValue& operator[]( LONG in_index ) const;
01238
01244 CValue& operator[]( LONG in_index );
01245
01251 bool operator==(const CValueArray& in_array) const;
01252
01258 bool operator!=(const CValueArray& in_array) const;
01259
01260
01261 private:
01262
01263 void* m_ptr;
01264 };
01265
01266
01267 };
01268
01269 #endif // __XSIVALUE_H__