version 1.27, 2002/03/28 02:57:54
|
version 1.33, 2002/05/15 10:34:30
|
|
|
#include "CIMName.h" | #include "CIMName.h" |
#include "Indentor.h" | #include "Indentor.h" |
#include "XmlWriter.h" | #include "XmlWriter.h" |
|
#include <Pegasus/Common/Tracer.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
| |
CIMQualifierList& CIMQualifierList::add(const CIMQualifier& qualifier) | CIMQualifierList& CIMQualifierList::add(const CIMQualifier& qualifier) |
{ | { |
if (!qualifier) |
if (qualifier.isNull()) |
throw UnitializedHandle(); |
throw UninitializedHandle(); |
| |
if (find(qualifier.getName()) != PEG_NOT_FOUND) | if (find(qualifier.getName()) != PEG_NOT_FOUND) |
throw AlreadyExists(); | throw AlreadyExists(); |
|
|
| |
return PEG_NOT_FOUND; | return PEG_NOT_FOUND; |
} | } |
|
Boolean CIMQualifierList::isTrue(const String& name) const |
|
{ |
|
Uint32 pos = find(name); |
|
|
|
if (pos == PEG_NOT_FOUND) |
|
return false; |
|
|
|
Boolean flag; |
|
const CIMValue& value = getQualifier(pos).getValue(); |
|
|
|
if (value.getType() != CIMType::BOOLEAN) |
|
return false; |
|
|
|
value.get(flag); |
|
return flag; |
|
} |
| |
Uint32 CIMQualifierList::findReverse(const String& name) const | Uint32 CIMQualifierList::findReverse(const String& name) const |
{ | { |
|
|
CIMQualifierList& inheritedQualifiers, | CIMQualifierList& inheritedQualifiers, |
Boolean propagateQualifiers) // Apparently not used ks 24 mar 2002 | Boolean propagateQualifiers) // Apparently not used ks 24 mar 2002 |
{ | { |
|
PEG_METHOD_ENTER(TRC_OBJECTRESOLUTION, "CIMQualifierList::resolve()"); |
// For each qualifier in the qualifiers array, the following | // For each qualifier in the qualifiers array, the following |
// is checked: | // is checked: |
// | // |
|
|
CIMQualifierDecl qd = declContext->lookupQualifierDecl( | CIMQualifierDecl qd = declContext->lookupQualifierDecl( |
nameSpace, q.getName()); | nameSpace, q.getName()); |
| |
if (!qd) |
if (qd.isNull()) |
throw UndeclaredQualifier(q.getName()); | throw UndeclaredQualifier(q.getName()); |
| |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
|
|
// against the declaration. If the flavor is disableoverride and tosubclass | // against the declaration. If the flavor is disableoverride and tosubclass |
// the resolved qualifier value must be identical to the original | // the resolved qualifier value must be identical to the original |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
|
|
|
|
// Test for Qualifier found in SuperClass. If found and qualifier | // Test for Qualifier found in SuperClass. If found and qualifier |
// is not overridable. | // is not overridable. |
// Abstract (not Overridable and restricted) can be found in subclasses | // Abstract (not Overridable and restricted) can be found in subclasses |
|
|
// characteristics (value, type, flavor, etc.) This also leaves the question | // characteristics (value, type, flavor, etc.) This also leaves the question |
// of NULL or no values. The implication is that we must move the value | // of NULL or no values. The implication is that we must move the value |
// from the superclass or declaration. | // from the superclass or declaration. |
// |
|
|
|
| |
Uint32 pos = inheritedQualifiers.find(q.getName()); | Uint32 pos = inheritedQualifiers.find(q.getName()); |
| |
|
|
<< " decl flavor " << qd.getFlavor() << " Flavor " << q.getFlavor() | << " decl flavor " << qd.getFlavor() << " Flavor " << q.getFlavor() |
<< " Not override " << !qd.isFlavor(CIMFlavor::OVERRIDABLE) | << " Not override " << !qd.isFlavor(CIMFlavor::OVERRIDABLE) |
<< " tosubclass " << qd.isFlavor(CIMFlavor::TOSUBCLASS) << endl; | << " tosubclass " << qd.isFlavor(CIMFlavor::TOSUBCLASS) << endl; |
qd.print(); q.print(); |
XmlWriter::printQualifierDeclElement(qd); |
|
XmlWriter::printQualifierElement(q); |
//throw BadQualifierOverride(q.getName()); | //throw BadQualifierOverride(q.getName()); |
} | } |
//cout << qd.getFlavor() << endl;*/ | //cout << qd.getFlavor() << endl;*/ |
|
|
<< " decl flavor " << qd.getFlavor() << " Flavor " << q.getFlavor() | << " decl flavor " << qd.getFlavor() << " Flavor " << q.getFlavor() |
<< " Not override " << !qd.isFlavor(CIMFlavor::OVERRIDABLE) | << " Not override " << !qd.isFlavor(CIMFlavor::OVERRIDABLE) |
<< " tosubclass " << qd.isFlavor(CIMFlavor::TOSUBCLASS) << endl; | << " tosubclass " << qd.isFlavor(CIMFlavor::TOSUBCLASS) << endl; |
qd.print(); q.print(); */ |
XmlWriter::printQualifierDeclElement(qd); |
|
XmlWriter::printQualifierElement(q); */ |
} | } |
else // qualifier exists in superclass | else // qualifier exists in superclass |
{ ////// Make Const again | { ////// Make Const again |
|
|
<< " Superclass flavor " << iq.getFlavor() | << " Superclass flavor " << iq.getFlavor() |
<< " Flavor " << q.getFlavor() | << " Flavor " << q.getFlavor() |
<< endl; | << endl; |
iq.print(); q.print();*/ |
XmlWriter::printQualifierElement(iq); |
|
XmlWriter::printQualifierElement(q); */ |
// test if values the same. | // test if values the same. |
CIMValue qv = q.getValue(); | CIMValue qv = q.getValue(); |
CIMValue iqv = iq.getValue(); | CIMValue iqv = iq.getValue(); |
|
|
// Propagate qualifiers to subclass or to instance that do not have | // Propagate qualifiers to subclass or to instance that do not have |
// already have those qualifiers: | // already have those qualifiers: |
//-------------------------------------------------------------------------- | //-------------------------------------------------------------------------- |
//cout << "KSTEST. Loop of inherited qualifiers. Number = " |
//cout << "KSTEST. Inherited qualifiers ct = " << inheritedQualifiers.getCount() << endl; |
// << inheritedQualifiers.getCount() << endl; |
|
| |
for (Uint32 i = 0, n = inheritedQualifiers.getCount(); i < n; i++) | for (Uint32 i = 0, n = inheritedQualifiers.getCount(); i < n; i++) |
{ | { |
|
|
//cout << "KSTEST inherited qualifier propagate loop " << iq.getName() | //cout << "KSTEST inherited qualifier propagate loop " << iq.getName() |
//<< " flavor " << iq.getFlavor << " count " << i << endl; | //<< " flavor " << iq.getFlavor << " count " << i << endl; |
| |
// ATTN-DE-P1-This next test is incorrect. It is a temporary, hard-coded |
|
// HACK to avoid propagating the "Abstract" Qualifier to subclasses |
|
//if (CIMName::equal(iq.getName(), "Abstract")) |
|
// continue; |
|
//<< " flavor= " << iq.getFlavor() |
|
//<< " TOSUBCLASS " << (iq.getFlavor() && CIMFlavor::TOSUBCLASS) << endl; |
|
|
|
if (isInstancePart) | if (isInstancePart) |
{ | { |
if (!iq.isFlavor(CIMFlavor::TOINSTANCE)) | if (!iq.isFlavor(CIMFlavor::TOINSTANCE)) |
|
|
void CIMQualifierList::toXml(Array<Sint8>& out) const | void CIMQualifierList::toXml(Array<Sint8>& out) const |
{ | { |
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) | for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) |
_qualifiers[i].toXml(out); |
XmlWriter::appendQualifierElement(out, _qualifiers[i]); |
} | } |
| |
/** toMof - Generates MOF output for a list of CIM Qualifiers. | /** toMof - Generates MOF output for a list of CIM Qualifiers. |