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 OW_CIMINSTANCE_HPP_INCLUDE_GUARD_
00037 #define OW_CIMINSTANCE_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_COWIntrusiveReference.hpp"
00040 #include "OW_CIMElement.hpp"
00041 #include "OW_CIMFwd.hpp"
00042 #include "OW_CIMDataType.hpp"
00043 #include "OW_WBEMFlags.hpp"
00044 #include "OW_CIMName.hpp"
00045 #include "OW_String.hpp"
00046 #include "OW_Array.hpp"
00047
00048 namespace OW_NAMESPACE
00049 {
00050
00082 class OW_COMMON_API CIMInstance : public CIMElement
00083 {
00084 public:
00085 struct INSTData;
00086
00087 enum { SERIALIZATION_VERSION = 2 };
00088
00089 enum EErrorCodes
00090 {
00091 E_INSTANCE_HAS_NO_SUCH_PROPERTY
00092 };
00093
00097 CIMInstance();
00102 explicit CIMInstance(CIMNULL_t);
00107 CIMInstance(const CIMInstance& arg);
00112 explicit CIMInstance(const CIMName& name);
00117 explicit CIMInstance(const char* name);
00121 ~CIMInstance();
00126 virtual void setNull();
00132 CIMInstance& operator= (const CIMInstance& arg);
00136 String getClassName() const;
00141 CIMInstance& setKeys(const CIMPropertyArray& keys);
00147 CIMInstance& setClassName(const CIMName& name);
00151 String getLanguage() const;
00157 CIMInstance& setLanguage(const String& language);
00161 CIMQualifierArray getQualifiers() const;
00168 CIMQualifier getQualifier(const CIMName& qualName) const;
00174 CIMInstance& removeQualifier(const CIMName& qualName);
00181 CIMInstance& setQualifiers(const CIMQualifierArray& quals);
00187 CIMInstance& setQualifier(const CIMQualifier& qual);
00197 CIMPropertyArray getProperties(
00198 Int32 valueDataType = CIMDataType::INVALID) const;
00209 CIMInstance& setProperties(const CIMPropertyArray& props);
00217 CIMProperty getProperty(const CIMName& name,
00218 const CIMName& originClass) const;
00225 CIMProperty getProperty(const CIMName& name) const;
00232 CIMProperty getPropertyT(const CIMName& name) const;
00239 CIMValue getPropertyValue(const CIMName& name) const;
00245 bool propertyHasValue(const CIMName& name) const;
00250 CIMPropertyArray getKeyValuePairs() const;
00258 CIMInstance& updatePropertyValues(const CIMPropertyArray& props);
00265 CIMInstance& updatePropertyValue(const CIMProperty& prop);
00272 CIMInstance& updatePropertyValue(const CIMName& name, const CIMValue& cv);
00282 CIMInstance& setProperty(const CIMName& name, const CIMValue& cv);
00292 CIMInstance& setProperty(const CIMProperty& prop);
00298 CIMInstance& removeProperty(const CIMName& propName);
00316 CIMInstance filterProperties(const StringArray& propertyList,
00317 WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00318 bool ignorePropertyList=false) const;
00334 CIMInstance clone(WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00335 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00336 const StringArray& propertyList=StringArray(),
00337 bool noProps=false) const;
00354 CIMInstance clone(WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00355 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList) const;
00378 CIMInstance clone(WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EDeepFlag deep, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00379 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00380 const CIMClass& requestedClass, const CIMClass& cimClass) const;
00391 CIMInstance& syncWithClass(const CIMClass& cc,
00392 WBEMFlags::EIncludeQualifiersFlag includeQualifiers = WBEMFlags::E_INCLUDE_QUALIFIERS);
00415 CIMInstance createModifiedInstance(
00416 const CIMInstance& previousInstance,
00417 WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00418 const StringArray* propertyList,
00419 const CIMClass& theClass) const;
00423 virtual String getName() const;
00429 virtual void setName(const CIMName& name);
00439 CIMInstance& setNameSpace(const String& ns);
00446 String getNameSpace() const;
00451 virtual void readObject(std::istream &istrm);
00456 virtual void writeObject(std::ostream &ostrm) const;
00460 virtual String toMOF() const;
00464 virtual String toString() const;
00472 bool propertiesAreEqualTo(const CIMInstance& other) const;
00473
00474 typedef COWIntrusiveReference<INSTData> CIMInstance::*safe_bool;
00475 operator safe_bool () const
00476 { return m_pdata ? &CIMInstance::m_pdata : 0; }
00477 bool operator!() const
00478 { return !m_pdata; }
00479
00480 protected:
00481 void _buildKeys();
00482
00483 #ifdef OW_WIN32
00484 #pragma warning (push)
00485 #pragma warning (disable: 4251)
00486 #endif
00487
00488 COWIntrusiveReference<INSTData> m_pdata;
00489
00490 #ifdef OW_WIN32
00491 #pragma warning (pop)
00492 #endif
00493
00494 friend OW_COMMON_API bool operator<(const CIMInstance& x, const CIMInstance& y);
00495 };
00496
00497 }
00498
00499 #endif