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_CIMVALUE_HPP_INCLUDE_GUARD_ 00037 #define OWBI1_CIMVALUE_HPP_INCLUDE_GUARD_ 00038 #include "OWBI1_config.h" 00039 #include "OWBI1_CIMBase.hpp" 00040 #include "OWBI1_COWIntrusiveReference.hpp" 00041 #include "OWBI1_CIMFwd.hpp" 00042 #include "OWBI1_Array.hpp" 00043 #include "OWBI1_CIMDataType.hpp" 00044 #include "OWBI1_CIMNULL.hpp" 00045 00046 namespace OWBI1 00047 { 00048 00053 class OWBI1_OWBI1PROVIFC_API CIMValue : public CIMBase 00054 { 00055 public: 00064 static CIMValue createSimpleValue(const String& cimtype, 00065 const String& value); 00069 explicit CIMValue(CIMNULL_t); 00074 CIMValue(const CIMValue& x); 00079 explicit CIMValue(Bool x); 00084 explicit CIMValue(bool x); 00089 explicit CIMValue(UInt8 x); 00094 explicit CIMValue(Int8 x); 00099 explicit CIMValue(UInt16 x); 00104 explicit CIMValue(Int16 x); 00109 explicit CIMValue(UInt32 x); 00114 explicit CIMValue(Int32 x); 00119 explicit CIMValue(UInt64 x); 00124 explicit CIMValue(Int64 x); 00129 explicit CIMValue(Real32 x); 00134 explicit CIMValue(Real64 x); 00139 explicit CIMValue(const Char16& x); 00144 explicit CIMValue(const String& x); 00149 explicit CIMValue(const char* x); 00154 explicit CIMValue(const CIMDateTime& x); 00159 explicit CIMValue(const CIMObjectPath& x); 00164 explicit CIMValue(const CIMClass& x); 00169 explicit CIMValue(const CIMInstance& x); 00174 explicit CIMValue(const BoolArray& x); 00179 explicit CIMValue(const Char16Array& x); 00184 explicit CIMValue(const UInt8Array& x); 00189 explicit CIMValue(const Int8Array& x); 00194 explicit CIMValue(const UInt16Array& x); 00199 explicit CIMValue(const Int16Array& x); 00204 explicit CIMValue(const UInt32Array& x); 00209 explicit CIMValue(const Int32Array& x); 00214 explicit CIMValue(const UInt64Array& x); 00219 explicit CIMValue(const Int64Array& x); 00224 explicit CIMValue(const Real64Array& x); 00229 explicit CIMValue(const Real32Array& x); 00234 explicit CIMValue(const StringArray& x); 00239 explicit CIMValue(const CIMDateTimeArray& x); 00244 explicit CIMValue(const CIMObjectPathArray& x); 00249 explicit CIMValue(const CIMClassArray& x); 00254 explicit CIMValue(const CIMInstanceArray& x); 00255 00256 explicit CIMValue(const detail::CIMValueRepRef& rep); 00257 private: 00258 // These are private/unimplemented to help prevent unintended errors of 00259 // passing a pointer to the constructor. 00260 explicit CIMValue(const void*); 00261 explicit CIMValue(void*); 00262 explicit CIMValue(volatile const void*); 00263 explicit CIMValue(volatile void*); 00264 public: 00268 ~CIMValue(); 00273 UInt32 getArraySize() const; 00277 void get(Bool& x) const; 00281 void get(Char16& x) const; 00285 void get(UInt8& x) const; 00289 void get(Int8& x) const; 00293 void get(UInt16& x) const; 00297 void get(Int16& x) const; 00301 void get(UInt32& x) const; 00305 void get(Int32& x) const; 00309 void get(UInt64& x) const; 00313 void get(Int64& x) const; 00317 void get(Real32& x) const; 00321 void get(Real64& x) const; 00325 void get(String& x) const; 00329 void get(CIMDateTime& x) const; 00333 void get(CIMObjectPath& x) const; 00337 void get(CIMClass& x) const; 00341 void get(CIMInstance& x) const; 00345 void get(CIMObjectPathArray& x) const; 00349 void get(Char16Array& x) const; 00353 void get(UInt8Array& x) const; 00357 void get(Int8Array& x) const; 00361 void get(UInt16Array& x) const; 00365 void get(Int16Array& x) const; 00369 void get(UInt32Array& x) const; 00373 void get(Int32Array& x) const; 00377 void get(UInt64Array& x) const; 00381 void get(Int64Array& x) const; 00385 void get(Real64Array& x) const; 00389 void get(Real32Array& x) const; 00393 void get(StringArray& x) const; 00397 void get(BoolArray& x) const; 00401 void get(CIMDateTimeArray& x) const; 00405 void get(CIMClassArray& x) const; 00409 void get(CIMInstanceArray& x) const; 00410 Bool toBool() const; 00411 Char16 toChar16() const; 00412 UInt8 toUInt8() const; 00413 Int8 toInt8() const; 00414 UInt16 toUInt16() const; 00415 Int16 toInt16() const; 00416 UInt32 toUInt32() const; 00417 Int32 toInt32() const; 00418 UInt64 toUInt64() const; 00419 Int64 toInt64() const; 00420 Real32 toReal32() const; 00421 Real64 toReal64() const; 00422 CIMDateTime toCIMDateTime() const; 00423 CIMObjectPath toCIMObjectPath() const; 00424 CIMClass toCIMClass() const; 00425 CIMInstance toCIMInstance() const; 00426 CIMObjectPathArray toCIMObjectPathArray() const; 00427 Char16Array toChar16Array() const; 00428 UInt8Array toUInt8Array() const; 00429 Int8Array toInt8Array() const; 00430 UInt16Array toUInt16Array() const; 00431 Int16Array toInt16Array() const; 00432 UInt32Array toUInt32Array() const; 00433 Int32Array toInt32Array() const; 00434 UInt64Array toUInt64Array() const; 00435 Int64Array toInt64Array() const; 00436 Real64Array toReal64Array() const; 00437 Real32Array toReal32Array() const; 00438 StringArray toStringArray() const; 00439 BoolArray toBoolArray() const; 00440 CIMDateTimeArray toCIMDateTimeArray() const; 00441 CIMClassArray toCIMClassArray() const; 00442 CIMInstanceArray toCIMInstanceArray() const; 00443 00447 virtual void setNull(); 00448 00449 typedef detail::CIMValueRepRef CIMValue::*safe_bool; 00450 operator safe_bool () const; 00451 bool operator!() const; 00457 CIMValue& operator= (const CIMValue& x); 00463 bool equal(const CIMValue& x) const; 00470 bool operator== (const CIMValue& x) const; 00477 bool operator!= (const CIMValue& x) const; 00484 bool operator<= (const CIMValue& x) const; 00491 bool operator>= (const CIMValue& x) const; 00498 bool operator< (const CIMValue& x) const; 00505 bool operator> (const CIMValue& x) const; 00510 CIMDataType::Type getType() const; 00515 CIMDataType getCIMDataType() const; 00521 bool sameType(const CIMValue& x) const; 00525 bool isArray() const; 00530 virtual void readObject(std::istream &istrm); 00535 virtual void writeObject(std::ostream &ostrm) const; 00539 virtual String toString() const; 00543 virtual String toMOF() const; 00547 bool isNumericType() const; 00548 00549 detail::CIMValueRepRef getRep() const; 00550 private: 00551 00552 #ifdef OWBI1_WIN32 00553 #pragma warning (push) 00554 #pragma warning (disable: 4251) 00555 #endif 00556 00557 detail::CIMValueRepRef m_rep; 00558 00559 #ifdef OWBI1_WIN32 00560 #pragma warning (pop) 00561 #endif 00562 00563 }; 00564 00565 } // end namespace OWBI1 00566 00567 #endif