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 OWBI1_CIMDATATYPE_HPP_INCLUDE_GUARD_
00037 #define OWBI1_CIMDATATYPE_HPP_INCLUDE_GUARD_
00038 #include "OWBI1_config.h"
00039 #include "OWBI1_CIMFwd.hpp"
00040 #include "OWBI1_COWIntrusiveReference.hpp"
00041 #include "OWBI1_CIMBase.hpp"
00042 #include "OWBI1_CIMNULL.hpp"
00043 #include "OWBI1_Types.hpp"
00044 #include "OWBI1_CIMName.hpp"
00045
00046 #include <iosfwd>
00047
00048 namespace OWBI1
00049 {
00050
00055 class OWBI1_OWBI1PROVIFC_API CIMDataType : public CIMBase
00056 {
00057 public:
00058 enum
00059 {
00060 SIZE_SINGLE,
00061 SIZE_UNLIMITED,
00062 SIZE_LIMITED
00063 };
00064 enum Type
00065 {
00066 CIMNULL = 0,
00067 UINT8 = 1,
00068 SINT8 = 2,
00069 UINT16 = 3,
00070 SINT16 = 4,
00071 UINT32 = 5,
00072 SINT32 = 6,
00073 UINT64 = 7,
00074 SINT64 = 8,
00075 STRING = 9,
00076 BOOLEAN = 10,
00077 REAL32 = 11,
00078 REAL64 = 12,
00079 DATETIME = 13,
00080 CHAR16 = 14,
00081 REFERENCE = 15,
00082 EMBEDDEDCLASS = 16,
00083 EMBEDDEDINSTANCE = 17,
00084 MAXDATATYPE = 18,
00085 INVALID = 99
00086 };
00090 CIMDataType();
00095 explicit CIMDataType(CIMNULL_t);
00101 CIMDataType(Type type);
00109 CIMDataType(Type type, Int32 size);
00114 explicit CIMDataType(const CIMName& refClassName);
00119 CIMDataType(const CIMDataType& arg);
00120
00121 explicit CIMDataType(const detail::CIMDataTypeRepRef& rep);
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 Type getType() const;
00170 Int32 getSize() const;
00174 String getRefClassName() const;
00175
00176 typedef detail::CIMDataTypeRepRef CIMDataType::*safe_bool;
00180 operator safe_bool () const;
00181 bool operator!() const;
00188 static CIMDataType getDataType(const String& strType);
00196 static Type strToSimpleType(const String& strType);
00202 bool equals(const CIMDataType& arg) const;
00207 virtual void readObject(std::istream &istrm);
00212 virtual void writeObject(std::ostream &ostrm) const;
00216 virtual String toString() const;
00220 virtual String toMOF() const;
00228 String getArrayMOF() const;
00234 static bool isNumericType(Type type);
00235
00236 detail::CIMDataTypeRepRef getRep() const;
00237
00238 private:
00239
00240 #ifdef OWBI1_WIN32
00241 #pragma warning (push)
00242 #pragma warning (disable: 4251)
00243 #endif
00244
00245 detail::CIMDataTypeRepRef m_rep;
00246
00247 #ifdef OWBI1_WIN32
00248 #pragma warning (pop)
00249 #endif
00250
00251 friend bool operator<(const CIMDataType& x, const CIMDataType& y);
00252 friend bool operator==(const CIMDataType& x, const CIMDataType& y);
00253 };
00254
00255 bool operator<=(const CIMDataType& x, const CIMDataType& y);
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
00260 }
00261
00262 #endif