version 1.7, 2001/04/29 18:57:33
|
version 1.13, 2001/05/23 21:57:14
|
|
|
{ | { |
Uint32 pos = findQualifier(CIMQualifierNames::ASSOCIATION); | Uint32 pos = findQualifier(CIMQualifierNames::ASSOCIATION); |
| |
if (pos == Uint32(-1)) |
if (pos == PEG_NOT_FOUND) |
return false; | return false; |
| |
Boolean flag; | Boolean flag; |
|
|
{ | { |
Uint32 pos = findQualifier(CIMQualifierNames::ABSTRACT); | Uint32 pos = findQualifier(CIMQualifierNames::ABSTRACT); |
| |
if (pos == Uint32(-1)) |
if (pos == PEG_NOT_FOUND) |
return false; | return false; |
| |
Boolean flag; | Boolean flag; |
|
|
| |
// Reject addition of duplicate property name: | // Reject addition of duplicate property name: |
| |
if (findProperty(x.getName()) != Uint32(-1)) |
if (findProperty(x.getName()) != PEG_NOT_FOUND) |
throw AlreadyExists(); | throw AlreadyExists(); |
| |
// Reject addition of references to non-associations: | // Reject addition of references to non-associations: |
|
|
_properties.append(x); | _properties.append(x); |
} | } |
| |
void CIMClassRep::removeProperty(Uint32 pos) |
|
{ |
|
if (pos >= _properties.size()) |
|
throw OutOfBounds(); |
|
} |
|
| |
Uint32 CIMClassRep::findProperty(const String& name) | Uint32 CIMClassRep::findProperty(const String& name) |
{ | { |
|
|
return i; | return i; |
} | } |
| |
return Uint32(-1); |
return PEG_NOT_FOUND; |
|
} |
|
|
|
Boolean CIMClassRep::existsProperty(const String& name) |
|
{ |
|
return (findProperty(name) != PEG_NOT_FOUND) ? |
|
true : false; |
} | } |
| |
CIMProperty CIMClassRep::getProperty(Uint32 pos) | CIMProperty CIMClassRep::getProperty(Uint32 pos) |
|
|
return _properties[pos]; | return _properties[pos]; |
} | } |
| |
|
void CIMClassRep::removeProperty(Uint32 pos) |
|
{ |
|
if (pos >= _properties.size()) |
|
throw OutOfBounds(); |
|
|
|
_properties.remove(pos); |
|
} |
|
|
|
|
Uint32 CIMClassRep::getPropertyCount() const | Uint32 CIMClassRep::getPropertyCount() const |
{ | { |
return _properties.size(); | return _properties.size(); |
|
|
| |
// Reject duplicate method names: | // Reject duplicate method names: |
| |
if (findMethod(x.getName()) != Uint32(-1)) |
if (findMethod(x.getName()) != PEG_NOT_FOUND) |
throw AlreadyExists(); | throw AlreadyExists(); |
| |
// Add the method: | // Add the method: |
|
|
return i; | return i; |
} | } |
| |
return Uint32(-1); |
return PEG_NOT_FOUND; |
} | } |
| |
|
Boolean CIMClassRep::existsMethod(const String& name) |
|
{ |
|
return(findMethod(name) != PEG_NOT_FOUND) ? |
|
true : false; |
|
} |
CIMMethod CIMClassRep::getMethod(Uint32 pos) | CIMMethod CIMClassRep::getMethod(Uint32 pos) |
{ | { |
if (pos >= _methods.size()) | if (pos >= _methods.size()) |
|
|
{ | { |
return _methods.size(); | return _methods.size(); |
} | } |
|
//ATTN: Ks 18 May |
|
void CIMClassRep::removeMethod(Uint32 pos) |
|
{ |
|
if (pos >= _methods.size()) |
|
throw OutOfBounds(); |
|
|
|
_methods.remove(pos); |
|
} |
| |
void CIMClassRep::resolve( | void CIMClassRep::resolve( |
DeclContext* context, | DeclContext* context, |
|
|
= context->lookupClass(nameSpace, _superClassName); | = context->lookupClass(nameSpace, _superClassName); |
| |
if (!superClass) | if (!superClass) |
throw NoSuchSuperClass(_superClassName); |
throw PEGASUS_CIM_EXCEPTION(INVALID_SUPERCLASS, _superClassName); |
| |
#if 0 | #if 0 |
if (!superClass._rep->_resolved) | if (!superClass._rep->_resolved) |
|
|
CIMProperty& property = _properties[i]; | CIMProperty& property = _properties[i]; |
Uint32 pos = superClass.findProperty(property.getName()); | Uint32 pos = superClass.findProperty(property.getName()); |
| |
if (pos == Uint32(-1)) |
if (pos == PEG_NOT_FOUND) |
{ | { |
property.resolve(context, nameSpace, false); | property.resolve(context, nameSpace, false); |
} | } |
else | else |
{ | { |
CIMConstProperty superClassProperty = superClass.getProperty(pos); |
CIMConstProperty superClassProperty = |
|
superClass.getProperty(pos); |
property.resolve(context, nameSpace, false, superClassProperty); | property.resolve(context, nameSpace, false, superClassProperty); |
} | } |
} | } |
|
|
// insert it (setting the propagated flag). Otherwise, change | // insert it (setting the propagated flag). Otherwise, change |
// the class-origin and propagated flag accordingly. | // the class-origin and propagated flag accordingly. |
| |
Uint32 pos = Uint32(-1); |
Uint32 pos = PEG_NOT_FOUND; |
| |
for (Uint32 j = m, n = _properties.size(); j < n; j++) | for (Uint32 j = m, n = _properties.size(); j < n; j++) |
{ | { |
|
|
// clone and insert it. Otherwise, the properties class | // clone and insert it. Otherwise, the properties class |
// origin was set above. | // origin was set above. |
| |
if (pos == Uint32(-1)) |
if (pos == PEG_NOT_FOUND) |
{ | { |
CIMProperty property = superClassProperty.clone(); | CIMProperty property = superClassProperty.clone(); |
property.setPropagated(true); | property.setPropagated(true); |
|
|
CIMMethod& method = _methods[i]; | CIMMethod& method = _methods[i]; |
Uint32 pos = superClass.findMethod(method.getName()); | Uint32 pos = superClass.findMethod(method.getName()); |
| |
if (pos == Uint32(-1)) |
if (pos == PEG_NOT_FOUND) |
{ | { |
method.resolve(context, nameSpace); | method.resolve(context, nameSpace); |
} | } |
|
|
// insert it (setting the propagated flag). Otherwise, change | // insert it (setting the propagated flag). Otherwise, change |
// the class-origin and propagated flag accordingly. | // the class-origin and propagated flag accordingly. |
| |
Uint32 pos = Uint32(-1); |
Uint32 pos = PEG_NOT_FOUND; |
| |
for (Uint32 j = m, n = _methods.size(); j < n; j++) | for (Uint32 j = m, n = _methods.size(); j < n; j++) |
{ | { |
|
|
// clone and insert it. Otherwise, the method's class origin | // clone and insert it. Otherwise, the method's class origin |
// has already been set above. | // has already been set above. |
| |
if (pos == Uint32(-1)) |
if (pos == PEG_NOT_FOUND) |
{ | { |
CIMMethod method = superClassMethod.clone(); | CIMMethod method = superClassMethod.clone(); |
method.setPropagated(true); | method.setPropagated(true); |
|
|
out << "</CLASS>\n"; | out << "</CLASS>\n"; |
} | } |
| |
void CIMClassRep::print(std::ostream &os) const |
void CIMClassRep::print(PEGASUS_STD(ostream) &os) const |
{ | { |
Array<Sint8> tmp; | Array<Sint8> tmp; |
toXml(tmp); | toXml(tmp); |
|
|
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
|
|