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 #include "OWBI1_config.h"
00037 #include "OWBI1_CIMValue.hpp"
00038 #include "OWBI1_CIMValueRep.hpp"
00039 #include "OWBI1_Bool.hpp"
00040 #include "OWBI1_Char16.hpp"
00041 #include "OWBI1_CIMDateTime.hpp"
00042 #include "OWBI1_CIMDateTimeRep.hpp"
00043 #include "OWBI1_CIMObjectPath.hpp"
00044 #include "OWBI1_CIMObjectPathRep.hpp"
00045 #include "OWBI1_CIMClass.hpp"
00046 #include "OWBI1_CIMClassRep.hpp"
00047 #include "OWBI1_CIMInstance.hpp"
00048 #include "OWBI1_CIMInstanceRep.hpp"
00049 #include "OWBI1_CIMDetail.hpp"
00050 #include "OWBI1_ProxyProviderDetail.hpp"
00051 #include "OW_Bool.hpp"
00052 #include "OW_Char16.hpp"
00053 #include "OWBI1_CIMDataType.hpp"
00054 #include "OWBI1_CIMDataTypeRep.hpp"
00055 
00056 namespace OWBI1
00057 {
00058 
00059 using std::istream;
00060 using std::ostream;
00061 using namespace detail;
00063 
00064 CIMValue
00065 CIMValue::createSimpleValue(const String& cimtype,
00066    const String& value)
00067 {
00068    return CIMValue(new CIMValueRep(OpenWBEM::CIMValue::createSimpleValue(cimtype.c_str(), value.c_str())));
00069 }
00070 
00072 void           
00073 CIMValue::readObject(istream &istrm)
00074 {
00075    m_rep->value.readObject(istrm);
00076 }
00077 
00079 CIMValue::CIMValue(CIMNULL_t)
00080    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::CIMNULL)))
00081 {
00082 }
00083 
00085 CIMValue::CIMValue(const CIMValue& x)
00086    : CIMBase(x)
00087    , m_rep(x.m_rep) 
00088 {
00089 }
00090 
00092 CIMValue::CIMValue(Bool x)
00093    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))){}
00095 CIMValue::CIMValue(bool x)
00096    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))){}
00098 CIMValue::CIMValue(UInt8 x)
00099    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00101 CIMValue::CIMValue(Int8 x)
00102    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00104 CIMValue::CIMValue(UInt16 x)
00105    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00107 CIMValue::CIMValue(Int16 x)
00108    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00110 CIMValue::CIMValue(UInt32 x)
00111    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00113 CIMValue::CIMValue(Int32 x)
00114    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00116 CIMValue::CIMValue(UInt64 x)
00117    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00119 CIMValue::CIMValue(Int64 x)
00120    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00122 CIMValue::CIMValue(Real32 x)
00123    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00125 CIMValue::CIMValue(Real64 x)
00126    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00128 CIMValue::CIMValue(const Char16& x)
00129    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x))) {}
00131 CIMValue::CIMValue(const String& x)
00132    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x.c_str()))) {}
00134 CIMValue::CIMValue(const char* x)
00135    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::String(x)))) {}
00137 CIMValue::CIMValue(const CIMDateTime& x)
00138    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x.getRep()->datetime))) {}
00140 CIMValue::CIMValue(const CIMObjectPath& x)
00141    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x.getRep()->objectpath))) {}
00143 CIMValue::CIMValue(const CIMClass& x)
00144    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x.getRep()->cls))) {}
00146 CIMValue::CIMValue(const CIMInstance& x)
00147    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(x.getRep()->inst))) {}
00149 CIMValue::CIMValue(const CIMObjectPathArray& x)
00150    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(unwrapArray<OpenWBEM::CIMObjectPathArray>(x)))) {}
00152 CIMValue::CIMValue(const BoolArray& x)
00153    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::BoolArray(x.begin(), x.end())))) {}
00155 CIMValue::CIMValue(const Char16Array& x)
00156    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::Char16Array(x.begin(), x.end())))) {}
00158 CIMValue::CIMValue(const UInt8Array& x)
00159    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::UInt8Array(x.begin(), x.end())))) {}
00161 CIMValue::CIMValue(const Int8Array& x)
00162    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::Int8Array(x.begin(), x.end())))) {}
00164 CIMValue::CIMValue(const UInt16Array& x)
00165    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::UInt16Array(x.begin(), x.end())))) {}
00167 CIMValue::CIMValue(const Int16Array& x)
00168    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::Int16Array(x.begin(), x.end())))) {}
00170 CIMValue::CIMValue(const UInt32Array& x)
00171    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::UInt32Array(x.begin(), x.end())))) {}
00173 CIMValue::CIMValue(const Int32Array& x)
00174    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::Int32Array(x.begin(), x.end())))) {}
00176 CIMValue::CIMValue(const UInt64Array& x)
00177    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::UInt64Array(x.begin(), x.end())))) {}
00179 CIMValue::CIMValue(const Int64Array& x)
00180    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::Int64Array(x.begin(), x.end())))) {}
00182 CIMValue::CIMValue(const Real64Array& x)
00183    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::Real64Array(x.begin(), x.end())))) {}
00185 CIMValue::CIMValue(const Real32Array& x)
00186    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(OpenWBEM::Real32Array(x.begin(), x.end())))) {}
00188 CIMValue::CIMValue(const StringArray& x)
00189    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(convertStringArray(x)))) {}
00191 CIMValue::CIMValue(const CIMDateTimeArray& x)
00192    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(unwrapArray<OpenWBEM::CIMDateTimeArray>(x)))) {}
00194 CIMValue::CIMValue(const CIMClassArray& x)
00195    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(unwrapArray<OpenWBEM::CIMClassArray>(x)))) {}
00197 CIMValue::CIMValue(const CIMInstanceArray& x)
00198    : m_rep(new CIMValueRep(OpenWBEM::CIMValue(unwrapArray<OpenWBEM::CIMInstanceArray>(x)))) {}
00200 UInt32
00201 CIMValue::getArraySize() const
00202 {
00203    return m_rep->value.getArraySize();
00204 }
00206 void CIMValue::get(Bool& x) const
00207 {
00208    OpenWBEM::Bool owb;
00209    m_rep->value.get(owb);
00210    x = static_cast<bool>(owb);
00211 }
00213 void CIMValue::get(Char16& x) const
00214 {
00215    OpenWBEM::Char16 owc;
00216    m_rep->value.get(owc);
00217    x = owc.getValue();
00218 }
00220 void CIMValue::get(UInt8& x) const
00221 {
00222    m_rep->value.get(x);
00223 }
00225 void CIMValue::get(Int8& x) const
00226 {
00227    m_rep->value.get(x);
00228 }
00230 void CIMValue::get(UInt16& x) const
00231 {
00232    m_rep->value.get(x);
00233 }
00235 void CIMValue::get(Int16& x) const
00236 {
00237    m_rep->value.get(x);
00238 }
00240 void CIMValue::get(UInt32& x) const
00241 {
00242    m_rep->value.get(x);
00243 }
00245 void CIMValue::get(Int32& x) const
00246 {
00247    m_rep->value.get(x);
00248 }
00250 void CIMValue::get(UInt64& x) const
00251 {
00252    m_rep->value.get(x);
00253 }
00255 void CIMValue::get(Int64& x) const
00256 {
00257    m_rep->value.get(x);
00258 }
00260 void CIMValue::get(Real32& x) const
00261 {
00262    m_rep->value.get(x);
00263 }
00265 void CIMValue::get(Real64& x) const
00266 {
00267    m_rep->value.get(x);
00268 }
00270 void CIMValue::get(String& x) const
00271 {
00272    OpenWBEM::String ows;
00273    m_rep->value.get(ows);
00274    x = ows.c_str();
00275 }
00277 void CIMValue::get(CIMDateTime& x) const
00278 {
00279    OpenWBEM::CIMDateTime owcdt(OpenWBEM::CIMNULL);
00280    m_rep->value.get(owcdt);
00281    x = CIMDateTime(new CIMDateTimeRep(owcdt));
00282 }
00284 void CIMValue::get(CIMObjectPath& x) const
00285 {
00286    OpenWBEM::CIMObjectPath owcop(OpenWBEM::CIMNULL);
00287    m_rep->value.get(owcop);
00288    x = CIMObjectPath(new CIMObjectPathRep(owcop));
00289 }
00291 void CIMValue::get(CIMClass& x) const
00292 {
00293    OpenWBEM::CIMClass owcls(OpenWBEM::CIMNULL);
00294    m_rep->value.get(owcls);
00295    x = CIMClass(new CIMClassRep(owcls));
00296 }
00298 void CIMValue::get(CIMInstance& x) const
00299 {
00300    OpenWBEM::CIMInstance owinst(OpenWBEM::CIMNULL);
00301    m_rep->value.get(owinst);
00302    x = CIMInstance(new CIMInstanceRep(owinst));
00303 }
00305 void CIMValue::get(Char16Array& x) const
00306 {
00307    OpenWBEM::Char16Array ow;
00308    m_rep->value.get(ow);
00309    x = Char16Array(ow.begin(), ow.end());
00310 }
00312 void CIMValue::get(UInt8Array& x) const
00313 {
00314    OpenWBEM::UInt8Array ow;
00315    m_rep->value.get(ow);
00316    x = UInt8Array(ow.begin(), ow.end());
00317 }
00319 void CIMValue::get(Int8Array& x) const
00320 {
00321    OpenWBEM::Int8Array ow;
00322    m_rep->value.get(ow);
00323    x = Int8Array(ow.begin(), ow.end());
00324 }
00326 void CIMValue::get(UInt16Array& x) const
00327 {
00328    OpenWBEM::UInt16Array ow;
00329    m_rep->value.get(ow);
00330    x = UInt16Array(ow.begin(), ow.end());
00331 }
00333 void CIMValue::get(Int16Array& x) const
00334 {
00335    OpenWBEM::Int16Array ow;
00336    m_rep->value.get(ow);
00337    x = Int16Array(ow.begin(), ow.end());
00338 }
00340 void CIMValue::get(UInt32Array& x) const
00341 {
00342    OpenWBEM::UInt32Array ow;
00343    m_rep->value.get(ow);
00344    x = UInt32Array(ow.begin(), ow.end());
00345 }
00347 void CIMValue::get(Int32Array& x) const
00348 {
00349    OpenWBEM::Int32Array ow;
00350    m_rep->value.get(ow);
00351    x = Int32Array(ow.begin(), ow.end());
00352 }
00354 void CIMValue::get(UInt64Array& x) const
00355 {
00356    OpenWBEM::UInt64Array ow;
00357    m_rep->value.get(ow);
00358    x = UInt64Array(ow.begin(), ow.end());
00359 }
00361 void CIMValue::get(Int64Array& x) const
00362 {
00363    OpenWBEM::Int64Array ow;
00364    m_rep->value.get(ow);
00365    x = Int64Array(ow.begin(), ow.end());
00366 }
00368 void CIMValue::get(Real64Array& x) const
00369 {
00370    OpenWBEM::Real64Array ow;
00371    m_rep->value.get(ow);
00372    x = Real64Array(ow.begin(), ow.end());
00373 }
00375 void CIMValue::get(Real32Array& x) const
00376 {
00377    OpenWBEM::Real32Array ow;
00378    m_rep->value.get(ow);
00379    x = Real32Array(ow.begin(), ow.end());
00380 }
00382 void CIMValue::get(StringArray& x) const
00383 {
00384    OpenWBEM::StringArray ow;
00385    m_rep->value.get(ow);
00386    x = convertStringArray(ow);
00387 }
00389 void CIMValue::get(CIMObjectPathArray& x) const
00390 {
00391    OpenWBEM::CIMObjectPathArray ow;
00392    m_rep->value.get(ow);
00393    wrapArray(x, ow);
00394 }
00396 void CIMValue::get(BoolArray& x) const
00397 {
00398    OpenWBEM::BoolArray ow;
00399    m_rep->value.get(ow);
00400    x = BoolArray(ow.begin(), ow.end());
00401 }
00403 void CIMValue::get(CIMDateTimeArray& x) const
00404 {
00405    OpenWBEM::CIMDateTimeArray ow;
00406    m_rep->value.get(ow);
00407    wrapArray(x, ow);
00408 }
00410 void CIMValue::get(CIMClassArray& x) const
00411 {
00412    OpenWBEM::CIMClassArray ow;
00413    m_rep->value.get(ow);
00414    wrapArray(x, ow);
00415 }
00417 void CIMValue::get(CIMInstanceArray& x) const
00418 {
00419    OpenWBEM::CIMInstanceArray ow;
00420    m_rep->value.get(ow);
00421    wrapArray(x, ow);
00422 }
00424 Bool CIMValue::toBool() const
00425 {
00426    return static_cast<bool>(m_rep->value.toBool());
00427 }
00429 Char16 CIMValue::toChar16() const
00430 {
00431    return m_rep->value.toChar16().getValue();
00432 }
00434 UInt8 CIMValue::toUInt8() const
00435 {
00436    return m_rep->value.toUInt8();
00437 }
00439 Int8 CIMValue::toInt8() const
00440 {
00441    return m_rep->value.toInt8();
00442 }
00444 UInt16 CIMValue::toUInt16() const
00445 {
00446    return m_rep->value.toUInt16();
00447 }
00449 Int16 CIMValue::toInt16() const
00450 {
00451    return m_rep->value.toInt16();
00452 }
00454 UInt32 CIMValue::toUInt32() const
00455 {
00456    return m_rep->value.toUInt32();
00457 }
00459 Int32 CIMValue::toInt32() const
00460 {
00461    return m_rep->value.toInt32();
00462 }
00464 UInt64 CIMValue::toUInt64() const
00465 {
00466    return m_rep->value.toUInt64();
00467 }
00469 Int64 CIMValue::toInt64() const
00470 {
00471    return m_rep->value.toInt64();
00472 }
00474 Real32 CIMValue::toReal32() const
00475 {
00476    return m_rep->value.toReal32();
00477 }
00479 Real64 CIMValue::toReal64() const
00480 {
00481    return m_rep->value.toReal64();
00482 }
00484 CIMDateTime CIMValue::toCIMDateTime() const
00485 {
00486    return CIMDateTime(new CIMDateTimeRep(m_rep->value.toCIMDateTime()));
00487 }
00489 CIMObjectPath CIMValue::toCIMObjectPath() const
00490 {
00491    return CIMObjectPath(new CIMObjectPathRep(m_rep->value.toCIMObjectPath()));
00492 }
00494 CIMClass CIMValue::toCIMClass() const
00495 {
00496    return CIMClass(new CIMClassRep(m_rep->value.toCIMClass()));
00497 }
00499 CIMInstance CIMValue::toCIMInstance() const
00500 {
00501    return CIMInstance(new CIMInstanceRep(m_rep->value.toCIMInstance()));
00502 }
00504 CIMObjectPathArray CIMValue::toCIMObjectPathArray() const
00505 {
00506    return wrapArray<CIMObjectPathArray>(m_rep->value.toCIMObjectPathArray());
00507 }
00509 Char16Array CIMValue::toChar16Array() const
00510 {
00511    OpenWBEM::Char16Array ow(m_rep->value.toChar16Array());
00512    return Char16Array(ow.begin(), ow.end());
00513 }
00515 UInt8Array CIMValue::toUInt8Array() const
00516 {
00517    OpenWBEM::UInt8Array ow(m_rep->value.toUInt8Array());
00518    return UInt8Array(ow.begin(), ow.end());
00519 }
00521 Int8Array CIMValue::toInt8Array() const
00522 {
00523    OpenWBEM::Int8Array ow(m_rep->value.toInt8Array());
00524    return Int8Array(ow.begin(), ow.end());
00525 }
00527 UInt16Array CIMValue::toUInt16Array() const
00528 {
00529    OpenWBEM::UInt16Array ow(m_rep->value.toUInt16Array());
00530    return UInt16Array(ow.begin(), ow.end());
00531 }
00533 Int16Array CIMValue::toInt16Array() const
00534 {
00535    OpenWBEM::Int16Array ow(m_rep->value.toInt16Array());
00536    return Int16Array(ow.begin(), ow.end());
00537 }
00539 UInt32Array CIMValue::toUInt32Array() const
00540 {
00541    OpenWBEM::UInt32Array ow(m_rep->value.toUInt32Array());
00542    return UInt32Array(ow.begin(), ow.end());
00543 }
00545 Int32Array CIMValue::toInt32Array() const
00546 {
00547    OpenWBEM::Int32Array ow(m_rep->value.toInt32Array());
00548    return Int32Array(ow.begin(), ow.end());
00549 }
00551 UInt64Array CIMValue::toUInt64Array() const
00552 {
00553    OpenWBEM::UInt64Array ow(m_rep->value.toUInt64Array());
00554    return UInt64Array(ow.begin(), ow.end());
00555 }
00557 Int64Array CIMValue::toInt64Array() const
00558 {
00559    OpenWBEM::Int64Array ow(m_rep->value.toInt64Array());
00560    return Int64Array(ow.begin(), ow.end());
00561 }
00563 Real64Array CIMValue::toReal64Array() const
00564 {
00565    OpenWBEM::Real64Array ow(m_rep->value.toReal64Array());
00566    return Real64Array(ow.begin(), ow.end());
00567 }
00569 Real32Array CIMValue::toReal32Array() const
00570 {
00571    OpenWBEM::Real32Array ow(m_rep->value.toReal32Array());
00572    return Real32Array(ow.begin(), ow.end());
00573 }
00575 StringArray CIMValue::toStringArray() const
00576 {
00577    return convertStringArray(m_rep->value.toStringArray());
00578 }
00580 BoolArray CIMValue::toBoolArray() const
00581 {
00582    OpenWBEM::BoolArray ow(m_rep->value.toBoolArray());
00583    return BoolArray(ow.begin(), ow.end());
00584 }
00586 CIMDateTimeArray CIMValue::toCIMDateTimeArray() const
00587 {
00588    return wrapArray<CIMDateTimeArray>(m_rep->value.toCIMDateTimeArray());
00589 }
00591 CIMClassArray CIMValue::toCIMClassArray() const
00592 {
00593    return wrapArray<CIMClassArray>(m_rep->value.toCIMClassArray());
00594 }
00596 CIMInstanceArray CIMValue::toCIMInstanceArray() const
00597 {
00598    return wrapArray<CIMInstanceArray>(m_rep->value.toCIMInstanceArray());
00599 }
00601 void CIMValue::setNull()
00602 {
00603    m_rep->value.setNull();
00604 }
00606 CIMValue& CIMValue::operator= (const CIMValue& x)
00607 {
00608    m_rep = x.m_rep;
00609    return *this;
00610 }
00612 bool CIMValue::equal(const CIMValue& x) const
00613 {
00614    return m_rep->value.equal(x.m_rep->value);
00615 }
00617 bool CIMValue::operator== (const CIMValue& x) const
00618 {
00619    return equal(x);
00620 }
00622 bool CIMValue::operator!= (const CIMValue& x) const
00623 {
00624    return !(*this == x);
00625 }
00627 bool CIMValue::operator<= (const CIMValue& x) const
00628 {
00629    return !(x < *this);
00630 }
00632 bool CIMValue::operator>= (const CIMValue& x) const
00633 {
00634    return !(*this < x);
00635 }
00637 bool CIMValue::operator< (const CIMValue& x) const
00638 {
00639    return m_rep->value < x.m_rep->value;
00640 }
00642 bool CIMValue::operator> (const CIMValue& x) const
00643 {
00644    return x < *this;
00645 }
00647 CIMDataType::Type CIMValue::getType() const 
00648 {  
00649    return CIMDataType::Type(m_rep->value.getType());
00650 }
00651 
00653 CIMDataType CIMValue::getCIMDataType() const 
00654 { 
00655    return CIMDataType(new CIMDataTypeRep(m_rep->value.getCIMDataType())); 
00656 }
00657 
00659 bool CIMValue::sameType(const CIMValue& x) const
00660 {
00661    return m_rep->value.sameType(x.m_rep->value);
00662 }
00663 
00665 bool CIMValue::isArray() const 
00666 {  
00667    return m_rep->value.isArray(); 
00668 }
00669 
00671 void CIMValue::writeObject(std::ostream &ostrm) const
00672 {
00673    m_rep->value.writeObject(ostrm);
00674 }
00676 String CIMValue::toString() const
00677 {
00678    return m_rep->value.toString().c_str();
00679 }
00681 String CIMValue::toMOF() const
00682 {
00683    return m_rep->value.toMOF().c_str();
00684 }
00685 
00687 bool
00688 CIMValue::isNumericType() const
00689 {
00690    return m_rep->value.isNumericType();
00691 }
00692 
00694 CIMValue::~CIMValue()
00695 {
00696 }
00697 
00699 CIMValue::operator safe_bool () const
00700 {  
00701    return m_rep->value ? &CIMValue::m_rep : 0; 
00702 }
00703 
00705 bool 
00706 CIMValue::operator!() const
00707 {  
00708    return !(m_rep->value); 
00709 }
00710 
00711 } 
00712