version 1.14, 2002/02/18 14:35:07
|
version 1.15, 2002/02/20 23:14:18
|
|
|
inline void _toXml(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); } | inline void _toXml(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); } |
inline void _toMof(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); } | inline void _toMof(Array<Sint8>& out, const CIMDateTime& x) { _toString(out, x); } |
| |
|
inline void _toString(Array<Sint8>& out, const CIMReference& x) |
|
{ |
|
out << x.toString(); |
|
} |
|
inline void _toXml(Array<Sint8>& out, const CIMReference& x) |
|
{ |
|
x.toXml(out); |
|
} |
|
// ATTN-RK-P2-20020220: What does toMof look like for an array of references? |
|
|
template<class T> | template<class T> |
void _toString(Array<Sint8>& out, const T* p, Uint32 size) | void _toString(Array<Sint8>& out, const T* p, Uint32 size) |
{ | { |
|
|
case CIMType::DATETIME: | case CIMType::DATETIME: |
_Inc(_u._dateTimeArray = x._u._dateTimeArray); | _Inc(_u._dateTimeArray = x._u._dateTimeArray); |
break; | break; |
|
|
|
case CIMType::REFERENCE: |
|
_Inc(_u._referenceArray = x._u._referenceArray); |
|
break; |
default: | default: |
throw CIMValueInvalidType(); | throw CIMValueInvalidType(); |
} | } |
|
|
break; | break; |
| |
case CIMType::REFERENCE: | case CIMType::REFERENCE: |
return 0; |
return _u._referenceArray->size; |
|
break; |
|
|
default: | default: |
throw CIMValueInvalidType(); | throw CIMValueInvalidType(); |
} | } |
|
|
case CIMType::DATETIME: | case CIMType::DATETIME: |
_Dec(_u._dateTimeArray); | _Dec(_u._dateTimeArray); |
break; | break; |
|
|
|
case CIMType::REFERENCE: |
|
_Dec(_u._referenceArray); |
|
break; |
|
|
//default: | //default: |
//throw CIMValueInvalidType(); | //throw CIMValueInvalidType(); |
} | } |
|
|
{ | { |
// If the CIMValue is Null, no element is returned. | // If the CIMValue is Null, no element is returned. |
//ATTNCH: Feb 12 added the isNull test KS | //ATTNCH: Feb 12 added the isNull test KS |
// Note that I ouptut absolutly nothing |
// Note that I output absolutely nothing |
| |
if (_isNull) | if (_isNull) |
{ | { |
// out << "\n"; | // out << "\n"; |
return; | return; |
} | } |
|
if (_type == CIMType::REFERENCE) |
|
{ |
if (_isArray) | if (_isArray) |
{ | { |
|
out << "<VALUE.REFARRAY>\n"; |
|
_toXml(out, _u._referenceArray->data(), _u._referenceArray->size); |
|
out << "</VALUE.REFARRAY>\n"; |
|
} |
|
else |
|
{ |
|
_u._referenceValue->toXml(out); |
|
} |
|
} |
|
else if (_isArray) |
|
{ |
out << "<VALUE.ARRAY>\n"; | out << "<VALUE.ARRAY>\n"; |
| |
switch (_type) | switch (_type) |
|
|
| |
out << "</VALUE.ARRAY>\n"; | out << "</VALUE.ARRAY>\n"; |
} | } |
else if (_type == CIMType::REFERENCE) |
|
{ |
|
_u._referenceValue->toXml(out); |
|
} |
|
else | else |
{ | { |
out << "<VALUE>"; | out << "<VALUE>"; |
|
|
if (_isNull) | if (_isNull) |
return; | return; |
| |
|
if (_type == CIMType::REFERENCE) |
|
{ |
if (_isArray) | if (_isArray) |
{ | { |
|
// ATTN-RK-P2-20020220: How to output an array of references in MOF? |
|
} |
|
else |
|
{ |
|
_u._referenceValue->toMof(out); |
|
} |
|
} |
|
else if (_isArray) |
|
{ |
switch (_type) | switch (_type) |
{ | { |
case CIMType::BOOLEAN: | case CIMType::BOOLEAN: |
|
|
throw CIMValueInvalidType(); | throw CIMValueInvalidType(); |
} | } |
} | } |
else if (_type == CIMType::REFERENCE) |
|
{ |
|
_u._referenceValue->toMof(out); |
|
} |
|
else | else |
{ | { |
switch (_type) | switch (_type) |
|
|
_isNull = false; | _isNull = false; |
} | } |
| |
|
void CIMValue::set(const Array<CIMReference>& x) |
|
{ |
|
clear(); |
|
_Inc(_u._referenceArray = x._rep); |
|
_type = CIMType::REFERENCE; |
|
_isArray = true; |
|
_isNull = false; |
|
} |
|
|
void CIMValue::get(Boolean& x) const | void CIMValue::get(Boolean& x) const |
{ | { |
if (_type != CIMType::BOOLEAN || _isArray) | if (_type != CIMType::BOOLEAN || _isArray) |
|
|
x.set(_u._dateTimeArray); | x.set(_u._dateTimeArray); |
} | } |
| |
|
void CIMValue::get(Array<CIMReference>& x) const |
|
{ |
|
if (_type != CIMType::REFERENCE || !_isArray) |
|
throw TypeMismatch(); |
|
|
|
x.set(_u._referenceArray); |
|
} |
|
|
void CIMValue::_init() | void CIMValue::_init() |
{ | { |
_type = CIMType::NONE; | _type = CIMType::NONE; |
|
|
case CIMType::DATETIME: | case CIMType::DATETIME: |
return Array<CIMDateTime>(x._u._dateTimeArray) == | return Array<CIMDateTime>(x._u._dateTimeArray) == |
Array<CIMDateTime>(y._u._dateTimeArray); | Array<CIMDateTime>(y._u._dateTimeArray); |
|
|
|
case CIMType::REFERENCE: |
|
return Array<CIMReference>(x._u._referenceArray) == |
|
Array<CIMReference>(y._u._referenceArray); |
default: | default: |
throw CIMValueInvalidType(); | throw CIMValueInvalidType(); |
} | } |
|
|
case CIMType::DATETIME: | case CIMType::DATETIME: |
set(Array<CIMDateTime>(arraySize)); | set(Array<CIMDateTime>(arraySize)); |
break; | break; |
|
|
|
case CIMType::REFERENCE: |
|
set(Array<CIMReference>(arraySize)); |
|
break; |
default: | default: |
throw CIMValueInvalidType(); | throw CIMValueInvalidType(); |
} | } |
|
|
case CIMType::DATETIME: | case CIMType::DATETIME: |
_toString(out, _u._dateTimeArray->data(), _u._dateTimeArray->size); | _toString(out, _u._dateTimeArray->data(), _u._dateTimeArray->size); |
break; | break; |
|
|
|
case CIMType::REFERENCE: |
|
_toString(out, _u._referenceArray->data(), _u._referenceArray->size); |
|
break; |
|
|
default: | default: |
throw CIMValueInvalidType(); | throw CIMValueInvalidType(); |
} | } |
} | } |
else if (_type == CIMType::REFERENCE) |
|
{ |
|
return _u._referenceValue->toString(); |
|
} |
|
else | else |
{ | { |
switch (_type) | switch (_type) |
|
|
case CIMType::DATETIME: | case CIMType::DATETIME: |
_toString(out, *_u._dateTimeValue); | _toString(out, *_u._dateTimeValue); |
break; | break; |
|
|
|
case CIMType::REFERENCE: |
|
_toString(out, *_u._referenceValue); |
|
break; |
|
|
default: | default: |
throw CIMValueInvalidType(); | throw CIMValueInvalidType(); |
} | } |