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_CIMMETHOD_HPP_INCLUDE_GUARD_ 00037 #define OW_CIMMETHOD_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_CIMNULL.hpp" 00043 #include "OW_WBEMFlags.hpp" 00044 #include "OW_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work 00045 00046 namespace OW_NAMESPACE 00047 { 00048 00065 class OW_COMMON_API CIMMethod : public CIMElement 00066 { 00067 public: 00068 struct METHData; 00072 CIMMethod(); 00076 explicit CIMMethod(CIMNULL_t); 00081 explicit CIMMethod(const CIMName& name); 00086 explicit CIMMethod(const char* name); 00091 CIMMethod(const CIMMethod& arg); 00095 ~CIMMethod(); 00100 virtual void setNull(); 00107 CIMMethod& operator= (const CIMMethod& arg); 00114 CIMMethod& setQualifiers(const CIMQualifierArray& quals); 00120 CIMMethod& addQualifier(const CIMQualifier& qual); 00126 CIMQualifierArray getQualifiers() const; 00133 CIMQualifier getQualifier(const CIMName& name) const; 00138 String getOriginClass() const; 00144 CIMMethod& setOriginClass(const CIMName& originCls); 00145 00151 CIMMethod& addParameter(const CIMParameter& param); 00158 CIMMethod& setParameters(const CIMParameterArray& inParms); 00164 CIMParameterArray getParameters() const; 00170 CIMParameterArray getINParameters() const; 00176 CIMParameterArray getOUTParameters() const; 00182 CIMMethod& setReturnType(const CIMDataType& type); 00186 CIMDataType getReturnType() const; 00190 Int32 getReturnDataSize() const; 00196 CIMMethod& setOverridingMethod(const CIMName& omname); 00200 String getOverridingMethod() const; 00206 CIMMethod& setPropagated(bool propagated=true); 00211 bool getPropagated() const; 00224 CIMMethod clone( 00225 WBEMFlags::EIncludeQualifiersFlag includeQualifiers = WBEMFlags::E_INCLUDE_QUALIFIERS, 00226 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin = WBEMFlags::E_INCLUDE_CLASS_ORIGIN) const; 00230 virtual String getName() const; 00235 virtual void setName(const CIMName& name); 00240 virtual void readObject(std::istream &istrm); 00245 virtual void writeObject(std::ostream &ostrm) const; 00249 virtual String toMOF() const; 00253 virtual String toString() const; 00254 00255 typedef COWIntrusiveReference<METHData> CIMMethod::*safe_bool; 00256 operator safe_bool () const 00257 { return m_pdata ? &CIMMethod::m_pdata : 0; } 00258 bool operator!() const 00259 { return !m_pdata; } 00260 protected: 00261 00262 #ifdef OW_WIN32 00263 #pragma warning (push) 00264 #pragma warning (disable: 4251) 00265 #endif 00266 00267 COWIntrusiveReference<METHData> m_pdata; 00268 00269 #ifdef OW_WIN32 00270 #pragma warning (pop) 00271 #endif 00272 00273 friend OW_COMMON_API bool operator<(const CIMMethod& x, const CIMMethod& y); 00274 }; 00275 00276 } // end namespace OW_NAMESPACE 00277 00278 #endif