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_CIMPROPERTY_HPP_INCLUDE_GUARD_ 00037 #define OW_CIMPROPERTY_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_CIMNULL.hpp" 00044 #include "OW_WBEMFlags.hpp" 00045 #include "OW_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work 00046 00047 namespace OW_NAMESPACE 00048 { 00049 00054 class OW_COMMON_API CIMProperty : public CIMElement 00055 { 00056 public: 00057 struct PROPData; 00058 static const char* const NAME_PROPERTY; 00062 CIMProperty(); 00066 explicit CIMProperty(CIMNULL_t); 00071 explicit CIMProperty(const CIMName& name); 00077 explicit CIMProperty(const char* name); 00083 CIMProperty(const CIMName& name, const CIMValue& value); 00089 CIMProperty(const CIMName& name, const CIMDataType& dt); 00094 CIMProperty(const CIMProperty& arg); 00098 ~CIMProperty(); 00102 virtual void setNull(); 00108 CIMProperty& operator= (const CIMProperty& arg); 00109 00110 typedef COWIntrusiveReference<PROPData> CIMProperty::*safe_bool; 00114 operator safe_bool () const 00115 { return m_pdata ? &CIMProperty::m_pdata : 0; } 00116 bool operator!() const 00117 { return !m_pdata; } 00121 CIMProperty clone() const { return clone(WBEMFlags::E_INCLUDE_QUALIFIERS, WBEMFlags::E_INCLUDE_CLASS_ORIGIN); } 00128 CIMProperty clone(WBEMFlags::EIncludeQualifiersFlag includeQualifiers, 00129 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin) const; 00134 CIMQualifierArray getQualifiers() const; 00141 CIMProperty& setQualifiers(const CIMQualifierArray& quals); 00146 String getOriginClass() const; 00152 CIMProperty& setOriginClass(const CIMName& originCls); 00158 CIMProperty& setValue(const CIMValue& val); 00162 CIMValue getValue() const; 00167 CIMValue getValueT() const; 00173 CIMProperty& setDataType(const CIMDataType& type); 00179 CIMProperty& setDataType(const CIMDataType::Type& type); 00183 CIMDataType getDataType() const; 00187 Int32 getSize() const; 00193 CIMProperty& setDataSize(Int32 size); 00199 CIMProperty& setOverridingProperty(const CIMName& opname); 00203 String getOverridingProperty() const; 00207 bool isReference() const; 00214 CIMQualifier getQualifier(const CIMName& name) const; 00221 CIMQualifier getQualifierT(const CIMName& name) const; 00227 CIMProperty& setQualifier(const CIMQualifier& qual); 00233 CIMProperty& addQualifier(const CIMQualifier& qual); 00239 bool removeQualifier(const CIMName& name); 00243 bool isKey() const; 00252 CIMProperty filter(WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers) const; 00258 CIMProperty& setPropagated(bool propagated=true); 00263 bool getPropagated() const; 00268 CIMProperty& clearQualifiers(); 00273 CIMProperty& clearNonKeyQualifiers(); 00277 virtual String getName() const; 00282 virtual void setName(const CIMName& name); 00287 virtual void writeObject(std::ostream &ostrm) const; 00294 virtual void writeObject(std::ostream &ostrm, 00295 WBEMFlags::EIncludeQualifiersFlag includeQualifiers) const; 00296 00301 virtual void readObject(std::istream &istrm); 00305 virtual String toString() const; 00306 00311 virtual String toMOF() const; 00312 00319 bool hasTrueQualifier(const CIMName& name) const; 00320 private: 00321 00322 #ifdef OW_WIN32 00323 #pragma warning (push) 00324 #pragma warning (disable: 4251) 00325 #endif 00326 00327 COWIntrusiveReference<PROPData> m_pdata; 00328 00329 #ifdef OW_WIN32 00330 #pragma warning (pop) 00331 #endif 00332 00333 friend OW_COMMON_API bool operator<(const CIMProperty& x, const CIMProperty& y); 00334 }; 00335 00336 } // end namespace OW_NAMESPACE 00337 00338 #endif