OW_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 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,      // non-array types
00062       SIZE_UNLIMITED,   // indicates array type unlimited
00063       SIZE_LIMITED      // array but limited size (NOTSUN)
00064    };
00065    enum Type
00066    {
00067       CIMNULL        = 0,     // Null type
00068       UINT8          = 1,     // Unsigned 8-bit integer              (SUPPORTED)
00069       SINT8          = 2,     // Signed 8-bit integer                (SUPPORTED)
00070       UINT16         = 3,     // Unsigned 16-bit integer             (SUPPORTED)
00071       SINT16         = 4,     // Signed 16-bit integer               (SUPPORTED)
00072       UINT32         = 5,     // Unsigned 32-bit integer             (SUPPORTED)
00073       SINT32         = 6,     // Signed 32-bit integer               (SUPPORTED)
00074       UINT64         = 7,     // Unsigned 64-bit integer             (SUPPORTED)
00075       SINT64         = 8,     // Signed 64-bit integer               (SUPPORTED)
00076       STRING         = 9,     // Unicode string                      (SUPPORTED)
00077       BOOLEAN        = 10,    // boolean                             (SUPPORTED)
00078       REAL32         = 11,    // IEEE 4-byte floating-point          (SUPPORTED)
00079       REAL64         = 12,    // IEEE 8-byte floating-point          (SUPPORTED)
00080       DATETIME       = 13,    // date-time as a string               (SUPPORTED)
00081       CHAR16         = 14,    // 16-bit UCS-2 character              (SUPPORTED)
00082       REFERENCE      = 15,    // Reference type                      (SUPPORTED)
00083       EMBEDDEDCLASS  = 16,    // Embedded Class          (SUPPORTED)
00084       EMBEDDEDINSTANCE  = 17,    // Embedded Instance          (SUPPORTED)
00085       MAXDATATYPE    = 18,    // Marker for valid checks
00086       INVALID        = 99     // Invalid type
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 } // end namespace OW_NAMESPACE
00262 
00263 #endif

Generated on Thu Feb 9 08:47:53 2006 for openwbem by  doxygen 1.4.6