version 1.5, 2001/04/25 22:20:54
|
version 1.11, 2001/06/16 23:09:59
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// copy of this software and associated documentation files (the "Software"), |
// of this software and associated documentation files (the "Software"), to |
// to deal in the Software without restriction, including without limitation |
// deal in the Software without restriction, including without limitation the |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// and/or sell copies of the Software, and to permit persons to whom the |
// sell copies of the Software, and to permit persons to whom the Software is |
// Software is furnished to do so, subject to the following conditions: |
// furnished to do so, subject to the following conditions: |
// |
// |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// DEALINGS IN THE SOFTWARE. |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//============================================================================== | //============================================================================== |
// | // |
|
|
if (!CIMName::legal(name)) | if (!CIMName::legal(name)) |
throw IllegalName(); | throw IllegalName(); |
| |
if (classOrigin.getLength() && !CIMName::legal(classOrigin)) |
if (classOrigin.size() && !CIMName::legal(classOrigin)) |
throw IllegalName(); | throw IllegalName(); |
| |
if (type == CIMType::NONE) | if (type == CIMType::NONE) |
|
|
if (!x) | if (!x) |
throw UnitializedHandle(); | throw UnitializedHandle(); |
| |
if (findParameter(x.getName()) != Uint32(-1)) |
if (findParameter(x.getName()) != PEG_NOT_FOUND) |
throw AlreadyExists(); | throw AlreadyExists(); |
| |
_parameters.append(x); | _parameters.append(x); |
|
|
| |
Uint32 CIMMethodRep::findParameter(const String& name) | Uint32 CIMMethodRep::findParameter(const String& name) |
{ | { |
for (Uint32 i = 0, n = _parameters.getSize(); i < n; i++) |
for (Uint32 i = 0, n = _parameters.size(); i < n; i++) |
{ | { |
if (CIMName::equal(_parameters[i].getName(), name)) | if (CIMName::equal(_parameters[i].getName(), name)) |
return i; | return i; |
} | } |
| |
return Uint32(-1); |
return PEG_NOT_FOUND; |
} | } |
| |
CIMParameter CIMMethodRep::getParameter(Uint32 pos) | CIMParameter CIMMethodRep::getParameter(Uint32 pos) |
{ | { |
if (pos >= _parameters.getSize()) |
if (pos >= _parameters.size()) |
throw OutOfBounds(); | throw OutOfBounds(); |
| |
return _parameters[pos]; | return _parameters[pos]; |
|
|
| |
Uint32 CIMMethodRep::getParameterCount() const | Uint32 CIMMethodRep::getParameterCount() const |
{ | { |
return _parameters.getSize(); |
return _parameters.size(); |
} | } |
| |
void CIMMethodRep::resolve( | void CIMMethodRep::resolve( |
|
|
| |
// Validate each of the parameters: | // Validate each of the parameters: |
| |
for (size_t i = 0; i < _parameters.getSize(); i++) |
for (size_t i = 0; i < _parameters.size(); i++) |
_parameters[i].resolve(declContext, nameSpace); | _parameters[i].resolve(declContext, nameSpace); |
| |
_classOrigin = inheritedMethod.getClassOrigin(); | _classOrigin = inheritedMethod.getClassOrigin(); |
|
|
| |
// Validate each of the parameters: | // Validate each of the parameters: |
| |
for (size_t i = 0; i < _parameters.getSize(); i++) |
for (size_t i = 0; i < _parameters.size(); i++) |
_parameters[i].resolve(declContext, nameSpace); | _parameters[i].resolve(declContext, nameSpace); |
} | } |
| |
|
|
| |
out << " TYPE=\"" << TypeToString(_type) << "\""; | out << " TYPE=\"" << TypeToString(_type) << "\""; |
| |
if (_classOrigin.getLength()) |
if (_classOrigin.size()) |
out << " CLASSORIGIN=\"" << _classOrigin << "\""; | out << " CLASSORIGIN=\"" << _classOrigin << "\""; |
| |
if (_propagated != false) | if (_propagated != false) |
|
|
| |
_qualifiers.toXml(out); | _qualifiers.toXml(out); |
| |
for (Uint32 i = 0, n = _parameters.getSize(); i < n; i++) |
for (Uint32 i = 0, n = _parameters.size(); i < n; i++) |
_parameters[i].toXml(out); | _parameters[i].toXml(out); |
| |
out << "</METHOD>\n"; | out << "</METHOD>\n"; |
} | } |
| |
void CIMMethodRep::print(std::ostream &os) const |
void CIMMethodRep::print(PEGASUS_STD(ostream) &os) const |
{ | { |
Array<Sint8> tmp; | Array<Sint8> tmp; |
toXml(tmp); | toXml(tmp); |
tmp.append('\0'); | tmp.append('\0'); |
os << tmp.getData() << std::endl; |
os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
CIMMethodRep::CIMMethodRep() | CIMMethodRep::CIMMethodRep() |
|
|
{ | { |
x._qualifiers.cloneTo(_qualifiers); | x._qualifiers.cloneTo(_qualifiers); |
| |
_parameters.reserve(x._parameters.getSize()); |
_parameters.reserve(x._parameters.size()); |
| |
for (Uint32 i = 0, n = x._parameters.getSize(); i < n; i++) |
for (Uint32 i = 0, n = x._parameters.size(); i < n; i++) |
_parameters.append(x._parameters[i].clone()); | _parameters.append(x._parameters[i].clone()); |
} | } |
| |
|
|
if (!_qualifiers.identical(x->_qualifiers)) | if (!_qualifiers.identical(x->_qualifiers)) |
return false; | return false; |
| |
if (_parameters.getSize() != x->_parameters.getSize()) |
if (_parameters.size() != x->_parameters.size()) |
return false; | return false; |
| |
for (Uint32 i = 0, n = _parameters.getSize(); i < n; i++) |
for (Uint32 i = 0, n = _parameters.size(); i < n; i++) |
{ | { |
if (!_parameters[i].identical(x->_parameters[i])) | if (!_parameters[i].identical(x->_parameters[i])) |
return false; | return false; |
|
|
return true; | return true; |
} | } |
| |
|
void CIMMethodRep::setType(CIMType type) |
|
{ |
|
_type = type; |
|
|
|
if (type == CIMType::NONE) |
|
throw NullType(); |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |