00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00035 #ifndef OW_CIMSCOPE_HPP_
00036 #define OW_CIMSCOPE_HPP_
00037 #include "OW_config.h"
00038 #include "OW_CIMBase.hpp"
00039 
00040 #if defined(BAD)
00041 #undef BAD
00042 #endif
00043 
00044 namespace OW_NAMESPACE
00045 {
00046 
00051 class OW_COMMON_API CIMScope : public CIMBase
00052 {
00053 public:
00054    
00055    enum Scope
00056    {
00057       BAD         = 0,  
00058       SCHEMA      = 1,  
00059       CLASS    = 2,  
00060       ASSOCIATION = 3,  
00061       INDICATION  = 4,  
00062       PROPERTY = 5,  
00063       REFERENCE   = 6,  
00064       METHOD      = 7,  
00065       PARAMETER   = 8,  
00066       QUALIFIER   = 9,     
00067       ANY         = 11, 
00068       MAXSCOPE = 12
00069    };
00073    CIMScope() : CIMBase(), m_val(BAD) {}
00078    CIMScope(Scope scopeVal) : CIMBase(), m_val(scopeVal)
00079    {
00080       if (!validScope(scopeVal))
00081          m_val = BAD;
00082    }
00087    CIMScope(const CIMScope& arg) :
00088       CIMBase(), m_val(arg.m_val) {}
00092    virtual void setNull();
00098    CIMScope& operator= (const CIMScope& arg)
00099    {
00100       m_val = arg.m_val;
00101       return *this;
00102    }
00106    Scope getScope() const {  return m_val; }
00112    bool equals(const CIMScope& arg) const
00113    {
00114       return (m_val == arg.m_val);
00115    }
00121    bool operator == (const CIMScope& arg) const
00122    {
00123       return equals(arg);
00124    }
00130    bool operator != (const CIMScope& arg) const
00131    {
00132       return !equals(arg);
00133    }
00134 
00135    typedef Scope CIMScope::*safe_bool;
00139    operator safe_bool () const
00140       {  return (validScope(m_val) == true) ? &CIMScope::m_val : 0; }
00141    bool operator!() const
00142       {  return !validScope(m_val); }
00146    virtual String toString() const;
00150    virtual String toMOF() const;
00155    virtual void readObject(std::istream &istrm);
00160    virtual void writeObject(std::ostream &ostrm) const;
00161 private:
00162    static bool validScope(Scope val)
00163    {
00164       return (val > BAD && val < MAXSCOPE);
00165    }
00166    Scope m_val;
00167    friend bool operator<(const CIMScope& x, const CIMScope& y)
00168    {
00169       return x.m_val < y.m_val;
00170    }
00171 };
00172 
00173 } 
00174 
00175 #endif