OW_CIMInstance.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_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" // for OW_CIMDataType::INVALID
00043 #include "OW_WBEMFlags.hpp"
00044 #include "OW_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work
00045 #include "OW_String.hpp" // for default parameter StringArray()
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 };          // Version # for serialization
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 } // end namespace OW_NAMESPACE
00498 
00499 #endif

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