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_CIMCLASS_HPP_INCLUDE_GUARD_ 00037 #define OWBI1_CIMCLASS_HPP_INCLUDE_GUARD_ 00038 #include "OWBI1_config.h" 00039 #include "OWBI1_COWIntrusiveReference.hpp" 00040 #include "OWBI1_CIMElement.hpp" 00041 #include "OWBI1_CIMFwd.hpp" 00042 #include "OWBI1_CIMNULL.hpp" 00043 #include "OWBI1_WBEMFlags.hpp" 00044 #include "OWBI1_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work 00045 #include "OWBI1_CIMPropertyList.hpp" 00046 00047 namespace OWBI1 00048 { 00049 00057 class OWBI1_OWBI1PROVIFC_API CIMClass : public CIMElement 00058 { 00059 public: 00065 enum { SERIALIZATION_VERSION = 2 }; 00069 CIMClass(); 00074 explicit CIMClass(CIMNULL_t); 00079 explicit CIMClass(const CIMName& name); 00085 explicit CIMClass(const char* name); 00086 CIMClass(const CIMClass& x); 00087 00088 explicit CIMClass(const detail::CIMClassRepRef& rep); 00089 00094 ~CIMClass(); 00095 CIMClass& operator=(const CIMClass& x); 00100 virtual void setNull(); 00105 CIMName getSuperClass() const; 00110 CIMName getKeyClass() const; 00116 CIMClass& setSuperClass(const CIMName& pname); 00120 bool isKeyed() const; 00126 CIMClass& setIsAssociation(bool isAssocFlag); 00132 CIMClass& setIsKeyed(bool isKeyedParm=true); 00137 CIMPropertyArray getKeys() const; 00144 CIMQualifier getQualifier(const CIMName& name) const; 00154 CIMProperty getProperty(const CIMName& name) const; 00162 CIMProperty getProperty(const CIMName& name, 00163 const CIMName& originClass) const; 00174 CIMMethod getMethod(const CIMName& name) const; 00184 CIMMethod getMethod(const CIMName& name, 00185 const CIMName& originClass) const; 00189 bool isAssociation() const; 00193 CIMQualifierArray getQualifiers() const; 00197 CIMPropertyArray getAllProperties() const; 00201 CIMPropertyArray getProperties() const; 00205 CIMMethodArray getAllMethods() const; 00209 CIMMethodArray getMethods() const; 00215 CIMClass& addProperty(const CIMProperty& prop); 00219 int numberOfProperties() const; 00226 CIMClass& setProperties(const CIMPropertyArray& props); 00233 CIMClass& setProperty(const CIMProperty& prop); 00239 CIMClass& addQualifier(const CIMQualifier& qual); 00245 bool hasQualifier(const CIMQualifier& qual) const; 00249 int numberOfQualifiers() const; 00255 bool removeQualifier(const CIMQualifier& qual); 00261 bool removeQualifier(const CIMName& name); 00267 bool removeProperty(const CIMName& name); 00274 CIMClass& setQualifiers(const CIMQualifierArray& quals); 00281 CIMClass& setQualifier(const CIMQualifier& qual); 00287 CIMClass& addMethod(const CIMMethod& meth); 00294 CIMClass& setMethods(const CIMMethodArray& meths); 00300 CIMClass& setMethod(const CIMMethod& meth); 00306 CIMInstance newInstance() const; 00307 00309 // CIMElement implementation 00311 00316 virtual CIMName getName() const; 00321 virtual void setName(const CIMName& name); 00326 virtual void readObject(std::istream &istrm); 00331 virtual void writeObject(std::ostream &ostrm) const; 00336 virtual String toMOF() const; 00341 virtual String toString() const; 00342 00343 typedef detail::CIMClassRepRef CIMClass::*safe_bool; 00344 00348 operator safe_bool () const; 00349 bool operator!() const; 00350 00351 detail::CIMClassRepRef getRep() const; 00352 00353 private: 00354 00355 #ifdef OWBI1_WIN32 00356 #pragma warning (push) 00357 #pragma warning (disable: 4251) 00358 #endif 00359 00360 detail::CIMClassRepRef m_rep; 00361 00362 #ifdef OWBI1_WIN32 00363 #pragma warning (pop) 00364 #endif 00365 00366 }; 00367 00368 OWBI1_OWBI1PROVIFC_API bool operator<(const CIMClass& x, const CIMClass& y); 00369 OWBI1_OWBI1PROVIFC_API bool operator==(const CIMClass& x, const CIMClass& y); 00370 OWBI1_OWBI1PROVIFC_API bool operator<=(const CIMClass& x, const CIMClass& y); 00371 OWBI1_OWBI1PROVIFC_API bool operator>(const CIMClass& x, const CIMClass& y); 00372 OWBI1_OWBI1PROVIFC_API bool operator>=(const CIMClass& x, const CIMClass& y); 00373 OWBI1_OWBI1PROVIFC_API bool operator!=(const CIMClass& x, const CIMClass& y); 00374 00375 } // end namespace OWBI1 00376 00377 #endif