OW_CIMObjectPath.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_CIMOBJECTPATH_HPP_INCLUDE_GUARD_
00037 #define OW_CIMOBJECTPATH_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_COWIntrusiveReference.hpp"
00040 #include "OW_CIMBase.hpp"
00041 #include "OW_CIMFwd.hpp"
00042 #include "OW_CIMNULL.hpp"
00043 #include "OW_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work
00044 
00045 namespace OW_NAMESPACE
00046 {
00047 
00053 class OW_COMMON_API CIMObjectPath : public CIMBase
00054 {
00055 private:
00056    struct OPData;
00057    friend bool operator<(const CIMObjectPath::OPData& x, 
00058          const CIMObjectPath::OPData& y);
00059 public:
00065    static String escape(const String& inString);
00071    static String unEscape(const String& inString);
00075    CIMObjectPath();
00079    explicit CIMObjectPath(CIMNULL_t);
00084    explicit CIMObjectPath(const CIMName& className);
00090    explicit CIMObjectPath(const char* className);
00098    CIMObjectPath(const CIMName& className, const String& nspace);
00105    CIMObjectPath(const CIMName& className,
00106       const CIMPropertyArray& keys);
00112    CIMObjectPath(const String& ns,
00113       const CIMInstance& inst);
00118    CIMObjectPath(const CIMObjectPath& arg);
00122    ~CIMObjectPath();
00126    virtual void setNull();
00132    CIMObjectPath& operator= (const CIMObjectPath& arg);
00138    CIMObjectPath& addKey(const CIMName& keyname, const CIMValue& value) OW_DEPRECATED; // in 3.0.0
00144    CIMObjectPath& addKey(const CIMProperty& key) OW_DEPRECATED; // in 3.0.0
00149    CIMPropertyArray getKeys() const;
00156    CIMProperty getKey(const CIMName& keyName) const;
00164    CIMProperty getKeyT(const CIMName& keyName) const;
00171    CIMValue getKeyValue(const CIMName& name) const;
00177    bool keyHasValue(const CIMName& name) const;
00184    CIMObjectPath& setKeys(const CIMPropertyArray& newKeys);
00190    CIMObjectPath& setKeys(const CIMInstance& instance);
00198    CIMObjectPath& setKeyValue(const CIMName& name, const CIMValue& value);
00202    String getNameSpace() const;
00206    CIMUrl getNameSpaceUrl() const;
00210    String getHost() const;
00215    String getObjectName() const OW_DEPRECATED; // in 3.0.0
00219    String getClassName() const;
00226    static CIMObjectPath parse(const String& instanceName);
00232    CIMObjectPath& setHost(const String& host);
00238    CIMObjectPath& setNameSpace(const String& ns);
00245    CIMObjectPath& setObjectName(const CIMName& className) OW_DEPRECATED; // in 3.0.0
00251    CIMObjectPath& setClassName(const CIMName& className);
00257    bool equals(const CIMObjectPath& op) const;
00258 
00259    typedef COWIntrusiveReference<OPData> CIMObjectPath::*safe_bool;
00263    operator safe_bool () const
00264       {  return m_pdata ? &CIMObjectPath::m_pdata : 0; }
00265    bool operator!() const
00266       {  return !m_pdata; }
00272    bool operator== (const CIMObjectPath& op) const
00273    {
00274       return equals(op);
00275    }
00276 
00282    bool operator!= (const CIMObjectPath& op) const
00283    {
00284       return !equals(op);
00285    }
00289    CIMNameSpace getFullNameSpace() const;
00293    bool isClassPath() const;
00297    bool isInstancePath() const;
00301    virtual String toString() const;
00306    virtual String modelPath() const;
00311    virtual String toMOF() const;
00316    virtual void readObject(std::istream& istrm);
00321    virtual void writeObject(std::ostream& ostrm) const;
00322 
00331    CIMObjectPath& syncWithClass(const CIMClass& theClass);
00332 
00333 private:
00334 
00335 #ifdef OW_WIN32
00336 #pragma warning (push)
00337 #pragma warning (disable: 4251)
00338 #endif
00339 
00340    COWIntrusiveReference<OPData> m_pdata;
00341 
00342 #ifdef OW_WIN32
00343 #pragma warning (pop)
00344 #endif
00345 
00346    friend OW_COMMON_API bool operator<(const CIMObjectPath& lhs, const CIMObjectPath& rhs);
00347 };
00348 
00349 } // end namespace OW_NAMESPACE
00350 
00351 #endif

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