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
00030
00036 #include "OWBI1_config.h"
00037 #include "OWBI1_CIMDataType.hpp"
00038 #include "OWBI1_CIMDataTypeRep.hpp"
00039 #include "OWBI1_CIMValue.hpp"
00040 #include "OWBI1_CIMValueRep.hpp"
00041 #include "OWBI1_CIMName.hpp"
00042 #include "OWBI1_CIMNameRep.hpp"
00043
00044 namespace OWBI1
00045 {
00046 using namespace detail;
00047 using std::istream;
00048 using std::ostream;
00049
00051 CIMDataType::CIMDataType() :
00052 CIMBase(), m_rep(new CIMDataTypeRep(OpenWBEM::CIMDataType()))
00053 {
00054 }
00056 CIMDataType::CIMDataType(CIMNULL_t) :
00057 CIMBase(), m_rep(new CIMDataTypeRep(OpenWBEM::CIMDataType(OpenWBEM::CIMNULL)))
00058 {
00059 }
00061 CIMDataType::CIMDataType(CIMDataType::Type type) :
00062 CIMBase(), m_rep(new CIMDataTypeRep(OpenWBEM::CIMDataType(OpenWBEM::CIMDataType::Type(type))))
00063 {
00064 }
00066 CIMDataType::CIMDataType(CIMDataType::Type type, Int32 size) :
00067 CIMBase(), m_rep(new CIMDataTypeRep(OpenWBEM::CIMDataType(OpenWBEM::CIMDataType::Type(type), size)))
00068 {
00069 }
00071 CIMDataType::CIMDataType(const CIMDataType& arg) :
00072 CIMBase(), m_rep(arg.m_rep) {}
00073
00075 CIMDataType::CIMDataType(const CIMDataTypeRepRef& rep)
00076 : m_rep(rep)
00077 {
00078 }
00079
00081 CIMDataType::~CIMDataType()
00082 {
00083 }
00085 void
00086 CIMDataType::setNull()
00087 {
00088 m_rep->datatype.setNull();
00089 }
00091 CIMDataType&
00092 CIMDataType::operator = (const CIMDataType& arg)
00093 {
00094 m_rep = arg.m_rep;
00095 return *this;
00096 }
00098 bool
00099 CIMDataType::isArrayType() const
00100 {
00101 return m_rep->datatype.isArrayType();
00102 }
00104 bool
00105 CIMDataType::isNumericType() const
00106 {
00107 return m_rep->datatype.isNumericType();
00108 }
00110
00111 bool
00112 CIMDataType::isNumericType(CIMDataType::Type type)
00113 {
00114 return OpenWBEM::CIMDataType::isNumericType(OpenWBEM::CIMDataType::Type(type));
00115 }
00117 bool
00118 CIMDataType::isReferenceType() const
00119 {
00120 return m_rep->datatype.isReferenceType();
00121 }
00123 CIMDataType::Type
00124 CIMDataType::getType() const
00125 {
00126 return CIMDataType::Type(m_rep->datatype.getType());
00127 }
00129 Int32
00130 CIMDataType::getSize() const
00131 {
00132 return m_rep->datatype.getSize();
00133 }
00135 String
00136 CIMDataType::getRefClassName() const
00137 {
00138 return m_rep->datatype.getRefClassName().c_str();
00139 }
00141 CIMDataType::operator CIMDataType::safe_bool () const
00142 {
00143 return m_rep->datatype ? &CIMDataType::m_rep : 0;
00144 }
00146 bool
00147 CIMDataType::operator!() const
00148 {
00149 return !m_rep->datatype;
00150 }
00152 bool
00153 CIMDataType::setToArrayType(Int32 size)
00154 {
00155 return m_rep->datatype.setToArrayType(size);
00156 }
00158 bool
00159 CIMDataType::syncWithValue(const CIMValue& value)
00160 {
00161 return m_rep->datatype.syncWithValue(value.getRep()->value);
00162 }
00164 CIMDataType::CIMDataType(const CIMName& refClassName)
00165 : m_rep(new CIMDataTypeRep(OpenWBEM::CIMDataType(refClassName.getRep()->name)))
00166 {
00167 }
00169 bool
00170 CIMDataType::equals(const CIMDataType& arg) const
00171 {
00172 return m_rep->datatype.equals(arg.m_rep->datatype);
00173 }
00175 void
00176 CIMDataType::readObject(istream &istrm)
00177 {
00178 m_rep->datatype.readObject(istrm);
00179 }
00181 void
00182 CIMDataType::writeObject(ostream &ostrm) const
00183 {
00184 m_rep->datatype.writeObject(ostrm);
00185 }
00187 String
00188 CIMDataType::toString() const
00189 {
00190 return m_rep->datatype.toString().c_str();
00191 }
00193 String
00194 CIMDataType::toMOF() const
00195 {
00196 return m_rep->datatype.toMOF().c_str();
00197 }
00198
00200 String
00201 CIMDataType::getArrayMOF() const
00202 {
00203 return m_rep->datatype.getArrayMOF().c_str();
00204 }
00206
00207 CIMDataType::Type
00208 CIMDataType::strToSimpleType(const String& strType)
00209 {
00210 return CIMDataType::Type(OpenWBEM::CIMDataType::strToSimpleType(strType.c_str()));
00211 }
00213
00214 CIMDataType
00215 CIMDataType::getDataType(const String& strType)
00216 {
00217 return CIMDataType(new CIMDataTypeRep(OpenWBEM::CIMDataType::getDataType(strType.c_str())));
00218 }
00219
00221 CIMDataTypeRepRef
00222 CIMDataType::getRep() const
00223 {
00224 return m_rep;
00225 }
00226
00228 bool operator<(const CIMDataType& x, const CIMDataType& y)
00229 {
00230 return *x.m_rep < *y.m_rep;
00231 }
00232
00234 bool operator==(const CIMDataType& x, const CIMDataType& y)
00235 {
00236 return *x.m_rep == *y.m_rep;
00237 }
00238
00240 bool operator<=(const CIMDataType& x, const CIMDataType& y)
00241 {
00242 return !(y < x);
00243 }
00244
00246 bool operator>(const CIMDataType& x, const CIMDataType& y)
00247 {
00248 return y < x;
00249 }
00250
00252 bool operator>=(const CIMDataType& x, const CIMDataType& y)
00253 {
00254 return !(x < y);
00255 }
00256
00258 bool operator!=(const CIMDataType& x, const CIMDataType& y)
00259 {
00260 return !(x == y);
00261 }
00262
00263 }
00264