OWBI1_CIMDataType.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2001-2004 Vintela, Inc. All rights reserved.
00003 *
00004 * Redistribution and use in source and binary forms, with or without
00005 * modification, are permitted provided that the following conditions are met:
00006 *
00007 *  - Redistributions of source code must retain the above copyright notice,
00008 *    this list of conditions and the following disclaimer.
00009 *
00010 *  - Redistributions in binary form must reproduce the above copyright notice,
00011 *    this list of conditions and the following disclaimer in the documentation
00012 *    and/or other materials provided with the distribution.
00013 *
00014 *  - Neither the name of Vintela, Inc. nor the names of its
00015 *    contributors may be used to endorse or promote products derived from this
00016 *    software without specific prior written permission.
00017 *
00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00022 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028 * POSSIBILITY OF SUCH DAMAGE.
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,      // non-array types
00061       SIZE_UNLIMITED,   // indicates array type unlimited
00062       SIZE_LIMITED      // array but limited size (NOTSUN)
00063    };
00064    enum Type
00065    {
00066       CIMNULL        = 0,     // Null type
00067       UINT8          = 1,     // Unsigned 8-bit integer              (SUPPORTED)
00068       SINT8          = 2,     // Signed 8-bit integer                (SUPPORTED)
00069       UINT16         = 3,     // Unsigned 16-bit integer             (SUPPORTED)
00070       SINT16         = 4,     // Signed 16-bit integer               (SUPPORTED)
00071       UINT32         = 5,     // Unsigned 32-bit integer             (SUPPORTED)
00072       SINT32         = 6,     // Signed 32-bit integer               (SUPPORTED)
00073       UINT64         = 7,     // Unsigned 64-bit integer             (SUPPORTED)
00074       SINT64         = 8,     // Signed 64-bit integer               (SUPPORTED)
00075       STRING         = 9,     // Unicode string                      (SUPPORTED)
00076       BOOLEAN        = 10,    // boolean                             (SUPPORTED)
00077       REAL32         = 11,    // IEEE 4-byte floating-point          (SUPPORTED)
00078       REAL64         = 12,    // IEEE 8-byte floating-point          (SUPPORTED)
00079       DATETIME       = 13,    // date-time as a string               (SUPPORTED)
00080       CHAR16         = 14,    // 16-bit UCS-2 character              (SUPPORTED)
00081       REFERENCE      = 15,    // Reference type                      (SUPPORTED)
00082       EMBEDDEDCLASS  = 16,    // Embedded Class          (SUPPORTED)
00083       EMBEDDEDINSTANCE  = 17,    // Embedded Instance          (SUPPORTED)
00084       MAXDATATYPE    = 18,    // Marker for valid checks
00085       INVALID        = 99     // Invalid type
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 } // end namespace OWBI1
00261 
00262 #endif

Generated on Thu Feb 9 08:48:25 2006 for openwbem by  doxygen 1.4.6