OW_CIMClass.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_CIMCLASS_HPP_INCLUDE_GUARD_
00037 #define OW_CIMCLASS_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_String.hpp"
00043 #include "OW_Array.hpp"
00044 #include "OW_CIMNULL.hpp"
00045 #include "OW_WBEMFlags.hpp"
00046 #include "OW_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work
00047 
00048 namespace OW_NAMESPACE
00049 {
00050 
00058 class OW_COMMON_API CIMClass : public CIMElement
00059 {
00060 public:
00061    struct CLSData;
00063    static const char* const NAMESPACECLASS OW_DEPRECATED; // in 3.1.0
00064 
00070    enum { SERIALIZATION_VERSION = 2 };
00074    CIMClass();
00079    explicit CIMClass(CIMNULL_t);
00084    explicit CIMClass(const CIMName& name);
00090    explicit CIMClass(const char* name);
00091    CIMClass(const CIMClass& x);
00092    
00097    ~CIMClass();
00098    CIMClass& operator=(const CIMClass& x);
00103    virtual void setNull();
00108    String getSuperClass() const;
00113    String getKeyClass() const;
00119    CIMClass& setSuperClass(const CIMName& pname);
00123    bool isKeyed() const;
00129    CIMClass& setIsAssociation(bool isAssocFlag);
00135    CIMClass& setIsKeyed(bool isKeyedParm=true);
00140    CIMPropertyArray getKeys() const;
00147    CIMQualifier getQualifier(const CIMName& name) const;
00157    CIMProperty getProperty(const CIMName& name) const;
00165    CIMProperty getProperty(const CIMName& name,
00166       const CIMName& originClass) const;
00177    CIMMethod getMethod(const CIMName& name) const;
00187    CIMMethod getMethod(const CIMName& name,
00188       const CIMName& originClass) const;
00192    bool isAssociation() const;
00196    CIMQualifierArray getQualifiers() const;
00200    CIMPropertyArray getAllProperties() const;
00204    CIMPropertyArray getProperties() const;
00208    CIMMethodArray getAllMethods() const;
00212    CIMMethodArray getMethods() const;
00218    CIMClass& addProperty(const CIMProperty& prop);
00222    int numberOfProperties() const;
00229    CIMClass& setProperties(const CIMPropertyArray& props);
00236    CIMClass& setProperty(const CIMProperty& prop);
00242    CIMClass& addQualifier(const CIMQualifier& qual);
00248    bool hasQualifier(const CIMQualifier& qual) const;
00252    int numberOfQualifiers() const;
00258    bool removeQualifier(const CIMQualifier& qual);
00264    bool removeQualifier(const CIMName& name);
00270    bool removeProperty(const CIMName& name);
00277    CIMClass& setQualifiers(const CIMQualifierArray& quals);
00284    CIMClass& setQualifier(const CIMQualifier& qual);
00290    CIMClass& addMethod(const CIMMethod& meth);
00297    CIMClass& setMethods(const CIMMethodArray& meths);
00303    CIMClass& setMethod(const CIMMethod& meth);
00309    CIMInstance newInstance() const;
00322    CIMClass clone(
00323       WBEMFlags::ELocalOnlyFlag localOnly = WBEMFlags::E_NOT_LOCAL_ONLY,
00324       WBEMFlags::EIncludeQualifiersFlag includeQualifiers = WBEMFlags::E_INCLUDE_QUALIFIERS,
00325       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin = WBEMFlags::E_INCLUDE_CLASS_ORIGIN,
00326       const StringArray& propertyList=StringArray(),
00327       bool noProps=false) const;
00338    CIMClass filterProperties(const StringArray& propertyList,
00339       WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin) const;
00352    StringArray getCloneProps(
00353       WBEMFlags::ELocalOnlyFlag localOnly,
00354       WBEMFlags::EDeepFlag deep,
00355       const StringArray* propertyList,
00356       const CIMClass& requestedClass) const;
00357    
00368    StringArray getCloneProps(WBEMFlags::ELocalOnlyFlag localOnly,
00369       const StringArray* propertyList) const;
00371    // CIMElement implementation
00373 
00378    virtual String getName() const;
00383    virtual void setName(const CIMName& name);
00388    virtual void readObject(std::istream &istrm);
00393    virtual void writeObject(std::ostream &ostrm) const;
00398    virtual String toMOF() const;
00403    virtual String toString() const;
00404 
00405    typedef COWIntrusiveReference<CLSData> CIMClass::*safe_bool;
00409    operator safe_bool () const
00410    {
00411       return m_pdata ? &CIMClass::m_pdata : 0;
00412    }
00413    bool operator!() const
00414    {
00415       return !this->m_pdata;
00416    }
00417 private:
00418 
00419 #ifdef OW_WIN32
00420 #pragma warning (push)
00421 #pragma warning (disable: 4251)
00422 #endif
00423 
00424    COWIntrusiveReference<CLSData> m_pdata;
00425 
00426 #ifdef OW_WIN32
00427 #pragma warning (pop)
00428 #endif
00429 
00430    friend OW_COMMON_API bool operator<(const CIMClass& x, const CIMClass& y);
00431    friend OW_COMMON_API bool operator==(const CIMClass& x, const CIMClass& y);
00432 };
00433 
00434 OW_COMMON_API bool operator<=(const CIMClass& x, const CIMClass& y);
00435 OW_COMMON_API bool operator>(const CIMClass& x, const CIMClass& y);
00436 OW_COMMON_API bool operator>=(const CIMClass& x, const CIMClass& y);
00437 OW_COMMON_API bool operator!=(const CIMClass& x, const CIMClass& y);
00438 
00439 } // end namespace OW_NAMESPACE
00440 
00441 #endif

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