version 1.31, 2002/07/31 22:05:08
|
version 1.45, 2005/05/17 14:55:08
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company | // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
// (carolann_graves@hp.com) | // (carolann_graves@hp.com) |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include "CIMScope.h" | #include "CIMScope.h" |
#include "XmlWriter.h" | #include "XmlWriter.h" |
#include "MofWriter.h" | #include "MofWriter.h" |
|
#include <Pegasus/Common/MessageLoader.h> //l10n |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
CIMMethodRep::CIMMethodRep() |
|
{ |
|
} |
|
|
|
CIMMethodRep::CIMMethodRep(const CIMMethodRep& x) : |
|
Sharable(), |
|
_name(x._name), |
|
_type(x._type), |
|
_classOrigin(x._classOrigin), |
|
_propagated(x._propagated) |
|
{ |
|
// ensure name is not null |
|
if(name.isNull()) |
|
{ |
|
throw UninitializedObjectException(); |
|
} |
|
|
|
x._qualifiers.cloneTo(_qualifiers); |
|
|
|
_parameters.reserveCapacity(x._parameters.size()); |
|
|
|
for (Uint32 i = 0, n = x._parameters.size(); i < n; i++) |
|
{ |
|
_parameters.append(x._parameters[i].clone()); |
|
} |
|
} |
|
|
CIMMethodRep::CIMMethodRep( | CIMMethodRep::CIMMethodRep( |
const CIMName& name, | const CIMName& name, |
CIMType type, | CIMType type, |
|
|
: _name(name), _type(type), | : _name(name), _type(type), |
_classOrigin(classOrigin), _propagated(propagated) | _classOrigin(classOrigin), _propagated(propagated) |
{ | { |
if (type == CIMTYPE_NONE) |
// ensure name is not null |
throw NullType(); |
if(name.isNull()) |
|
{ |
|
throw UninitializedObjectException(); |
|
} |
} | } |
| |
CIMMethodRep::~CIMMethodRep() | CIMMethodRep::~CIMMethodRep() |
{ | { |
|
|
} | } |
| |
void CIMMethodRep::setName(const CIMName& name) | void CIMMethodRep::setName(const CIMName& name) |
{ | { |
|
// ensure name is not null |
|
if(name.isNull()) |
|
{ |
|
throw UninitializedObjectException(); |
|
} |
|
|
_name = name; | _name = name; |
} | } |
| |
|
|
void CIMMethodRep::addParameter(const CIMParameter& x) | void CIMMethodRep::addParameter(const CIMParameter& x) |
{ | { |
if (x.isUninitialized()) | if (x.isUninitialized()) |
throw UninitializedObject(); |
throw UninitializedObjectException(); |
| |
if (findParameter(x.getName()) != PEG_NOT_FOUND) |
if (findParameter(x.getName()) != PEG_NOT_FOUND){ |
throw AlreadyExists(); |
//l10n |
|
//throw AlreadyExistsException |
|
//("parameter \"" + x.getName().getString () + "\""); |
|
MessageLoaderParms parms("Common.CIMMethodRep.PARAMETER", |
|
"parameter \"$0\"", |
|
x.getName().getString()); |
|
throw AlreadyExistsException(parms); |
|
} |
| |
_parameters.append(x); | _parameters.append(x); |
} | } |
|
|
return PEG_NOT_FOUND; | return PEG_NOT_FOUND; |
} | } |
| |
CIMParameter CIMMethodRep::getParameter(Uint32 pos) |
CIMParameter CIMMethodRep::getParameter(Uint32 index) |
|
{ |
|
if (index >= _parameters.size()) |
|
throw IndexOutOfBoundsException(); |
|
|
|
return _parameters[index]; |
|
} |
|
|
|
void CIMMethodRep::removeParameter(Uint32 index) |
{ | { |
if (pos >= _parameters.size()) |
if (index >= _parameters.size()) |
throw OutOfBounds(); |
throw IndexOutOfBoundsException(); |
| |
return _parameters[pos]; |
_parameters.remove (index); |
} | } |
| |
Uint32 CIMMethodRep::getParameterCount() const | Uint32 CIMMethodRep::getParameterCount() const |
|
|
| |
// Validate each of the parameters: | // Validate each of the parameters: |
| |
for (size_t i = 0; i < _parameters.size(); i++) |
for (Uint32 i = 0; i < _parameters.size(); i++) |
Resolver::resolveParameter (_parameters[i], declContext, nameSpace); | Resolver::resolveParameter (_parameters[i], 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.size(); i++) |
for (Uint32 i = 0; i < _parameters.size(); i++) |
Resolver::resolveParameter (_parameters[i], declContext, nameSpace); | Resolver::resolveParameter (_parameters[i], declContext, nameSpace); |
} | } |
| |
|
|
return x ? "true" : "false"; | return x ? "true" : "false"; |
} | } |
| |
void CIMMethodRep::toXml(Array<Sint8>& out) const |
void CIMMethodRep::toXml(Array<char>& out) const |
{ | { |
out << "<METHOD"; | out << "<METHOD"; |
| |
|
|
Format with qualifiers on one line and declaration on another. Start | Format with qualifiers on one line and declaration on another. Start |
with newline but none at the end. | with newline but none at the end. |
*/ | */ |
void CIMMethodRep::toMof(Array<Sint8>& out) const //ATTNKS: |
void CIMMethodRep::toMof(Array<char>& out) const //ATTNKS: |
{ | { |
// Output the qualifier list starting on new line | // Output the qualifier list starting on new line |
if (_qualifiers.getCount()) | if (_qualifiers.getCount()) |
|
|
} | } |
| |
| |
CIMMethodRep::CIMMethodRep() |
|
{ |
|
|
|
} |
|
|
|
CIMMethodRep::CIMMethodRep(const CIMMethodRep& x) : |
|
Sharable(), |
|
_name(x._name), |
|
_type(x._type), |
|
_classOrigin(x._classOrigin), |
|
_propagated(x._propagated) |
|
{ |
|
x._qualifiers.cloneTo(_qualifiers); |
|
|
|
_parameters.reserveCapacity(x._parameters.size()); |
|
|
|
for (Uint32 i = 0, n = x._parameters.size(); i < n; i++) |
|
_parameters.append(x._parameters[i].clone()); |
|
} |
|
|
|
Boolean CIMMethodRep::identical(const CIMMethodRep* x) const | Boolean CIMMethodRep::identical(const CIMMethodRep* x) const |
{ | { |
if (_name != x->_name) |
if (!_name.equal (x->_name)) |
return false; | return false; |
| |
if (_type != x->_type) | if (_type != x->_type) |
|
|
void CIMMethodRep::setType(CIMType type) | void CIMMethodRep::setType(CIMType type) |
{ | { |
_type = type; | _type = type; |
|
|
if (type == CIMTYPE_NONE) |
|
throw NullType(); |
|
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |