00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00036 #ifndef OW_CIMDATATYPE_HPP_INCLUDE_GUARD_
00037 #define OW_CIMDATATYPE_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_CIMFwd.hpp"
00040 #include "OW_COWIntrusiveReference.hpp"
00041 #include "OW_CIMBase.hpp"
00042 #include "OW_CIMNULL.hpp"
00043 #include "OW_Types.hpp"
00044 #include "OW_CIMName.hpp"
00045
00046 #include <iosfwd>
00047
00048 namespace OW_NAMESPACE
00049 {
00050
00055 class OW_COMMON_API CIMDataType : public CIMBase
00056 {
00057 public:
00058 struct DTData;
00059 enum
00060 {
00061 SIZE_SINGLE,
00062 SIZE_UNLIMITED,
00063 SIZE_LIMITED
00064 };
00065 enum Type
00066 {
00067 CIMNULL = 0,
00068 UINT8 = 1,
00069 SINT8 = 2,
00070 UINT16 = 3,
00071 SINT16 = 4,
00072 UINT32 = 5,
00073 SINT32 = 6,
00074 UINT64 = 7,
00075 SINT64 = 8,
00076 STRING = 9,
00077 BOOLEAN = 10,
00078 REAL32 = 11,
00079 REAL64 = 12,
00080 DATETIME = 13,
00081 CHAR16 = 14,
00082 REFERENCE = 15,
00083 EMBEDDEDCLASS = 16,
00084 EMBEDDEDINSTANCE = 17,
00085 MAXDATATYPE = 18,
00086 INVALID = 99
00087 };
00091 CIMDataType();
00096 explicit CIMDataType(CIMNULL_t);
00102 CIMDataType(Type type);
00110 CIMDataType(Type type, Int32 size);
00115 explicit CIMDataType(const CIMName& refClassName);
00120 CIMDataType(const CIMDataType& arg);
00121
00125 ~CIMDataType();
00129 virtual void setNull();
00135 CIMDataType& operator = (const CIMDataType& arg);
00143 bool syncWithValue(const CIMValue& value);
00150 bool setToArrayType(Int32 size);
00154 bool isArrayType() const;
00158 bool isNumericType() const;
00162 bool isReferenceType() const;
00166 bool isEmbeddedObjectType() const;
00170 Type getType() const;
00174 Int32 getSize() const;
00178 String getRefClassName() const;
00179
00180 typedef COWIntrusiveReference<DTData> CIMDataType::*safe_bool;
00184 operator safe_bool () const;
00185 bool operator!() const;
00192 static CIMDataType getDataType(const String& strType);
00200 static Type strToSimpleType(const String& strType);
00206 bool equals(const CIMDataType& arg) const;
00211 virtual void readObject(std::istream &istrm);
00216 virtual void writeObject(std::ostream &ostrm) const;
00220 virtual String toString() const;
00224 virtual String toMOF() const;
00232 String getArrayMOF() const;
00238 static bool isNumericType(Type type);
00239 private:
00240
00241 #ifdef OW_WIN32
00242 #pragma warning (push)
00243 #pragma warning (disable: 4251)
00244 #endif
00245
00246 COWIntrusiveReference<DTData> m_pdata;
00247
00248 #ifdef OW_WIN32
00249 #pragma warning (pop)
00250 #endif
00251
00252 friend bool operator<(const CIMDataType& x, const CIMDataType& y);
00253 friend bool operator==(const CIMDataType& x, const CIMDataType& y);
00254 };
00255
00256 bool operator<=(const CIMDataType& x, const CIMDataType& y);
00257 bool operator>(const CIMDataType& x, const CIMDataType& y);
00258 bool operator>=(const CIMDataType& x, const CIMDataType& y);
00259 bool operator!=(const CIMDataType& x, const CIMDataType& y);
00260
00261 }
00262
00263 #endif