version 1.4, 2001/04/29 18:57:33
|
version 1.21, 2005/02/05 22:59:23
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// |
|
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
|
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// copy of this software and associated documentation files (the "Software"), |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// to deal in the Software without restriction, including without limitation |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// IBM Corp.; EMC Corporation, The Open Group. |
// and/or sell copies of the Software, and to permit persons to whom the |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// Software is furnished to do so, subject to the following conditions: |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
// |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
// of this software and associated documentation files (the "Software"), to |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
// deal in the Software without restriction, including without limitation the |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// DEALINGS IN THE SOFTWARE. |
// sell copies of the Software, and to permit persons to whom the Software is |
|
// furnished to do so, subject to the following conditions: |
|
// |
|
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
|
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
|
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
|
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|
// 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. |
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: |
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <cstring> | #include <cstring> |
|
#include <Pegasus/Common/InternalException.h> |
#include "CIMScope.h" | #include "CIMScope.h" |
#include "XmlWriter.h" |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
namespace CIMScope |
const CIMScope CIMScope::NONE = 0; |
|
const CIMScope CIMScope::CLASS = 1; |
|
const CIMScope CIMScope::ASSOCIATION = 2; |
|
const CIMScope CIMScope::INDICATION = 4; |
|
const CIMScope CIMScope::PROPERTY = 8; |
|
const CIMScope CIMScope::REFERENCE = 16; |
|
const CIMScope CIMScope::METHOD = 32; |
|
const CIMScope CIMScope::PARAMETER = 64; |
|
const CIMScope CIMScope::ANY = CIMScope::CLASS + CIMScope::ASSOCIATION + |
|
CIMScope::INDICATION + CIMScope::PROPERTY + |
|
CIMScope::REFERENCE + CIMScope::METHOD + |
|
CIMScope::PARAMETER; |
|
|
|
CIMScope::CIMScope () |
|
: cimScope (CIMScope::NONE.cimScope) |
{ | { |
const Uint32 NONE = 0; |
|
const Uint32 CLASS = 1; |
|
const Uint32 ASSOCIATION = 2; |
|
const Uint32 INDICATION = 4; |
|
const Uint32 PROPERTY = 8; |
|
const Uint32 REFERENCE = 16; |
|
const Uint32 METHOD = 32; |
|
const Uint32 PARAMETER = 64; |
|
const Uint32 ANY = (1 | 2 | 4 | 8 | 16 | 32 | 64 ); |
|
} | } |
| |
String ScopeToString(Uint32 scope) |
CIMScope::CIMScope (const CIMScope & scope) |
|
: cimScope (scope.cimScope) |
{ | { |
String tmp; |
} |
|
|
if (scope & CIMScope::CLASS) |
|
tmp += "CLASS "; |
|
|
|
if (scope & CIMScope::ASSOCIATION) |
|
tmp += "ASSOCIATION "; |
|
|
|
if (scope & CIMScope::INDICATION) |
|
tmp += "INDICATION "; |
|
|
|
if (scope & CIMScope::PROPERTY) |
|
tmp += "PROPERTY "; |
|
| |
if (scope & CIMScope::REFERENCE) |
CIMScope::CIMScope (const Uint32 scope) |
tmp += "REFERENCE "; |
: cimScope (scope) |
|
{ |
|
PEGASUS_ASSERT (scope < 128); |
|
} |
| |
if (scope & CIMScope::METHOD) |
CIMScope & CIMScope::operator= (const CIMScope & scope) |
tmp += "METHOD "; |
{ |
|
this->cimScope = scope.cimScope; |
|
return *this; |
|
} |
| |
if (scope & CIMScope::PARAMETER) |
void CIMScope::addScope (const CIMScope & scope) |
tmp += "PARAMETER "; |
{ |
|
this->cimScope |= scope.cimScope; |
|
} |
| |
if (tmp.size()) |
Boolean CIMScope::hasScope (const CIMScope & scope) const |
tmp.remove(tmp.size() - 1); |
{ |
|
return ((this->cimScope & scope.cimScope) == scope.cimScope); |
|
} |
| |
return tmp; |
Boolean CIMScope::equal (const CIMScope & scope) const |
|
{ |
|
return (this->cimScope == scope.cimScope); |
} | } |
| |
void ScopeToXml(Array<Sint8>& out, Uint32 scope) |
CIMScope CIMScope::operator+ (const CIMScope & scope) const |
{ | { |
if (scope) |
return CIMScope(this->cimScope | scope.cimScope); |
|
} |
|
|
|
String CIMScope::toString () const |
{ | { |
out << "<SCOPE"; |
String tmp; |
| |
if (scope & CIMScope::CLASS) |
if (this->hasScope (CIMScope::CLASS)) |
out << " CLASS=\"true\""; |
tmp.append("CLASS "); |
| |
if (scope & CIMScope::ASSOCIATION) |
if (this->hasScope (CIMScope::ASSOCIATION)) |
out << " ASSOCIATION=\"true\""; |
tmp.append("ASSOCIATION "); |
| |
if (scope & CIMScope::REFERENCE) |
if (this->hasScope (CIMScope::INDICATION)) |
out << " REFERENCE=\"true\""; |
tmp.append("INDICATION "); |
| |
if (scope & CIMScope::PROPERTY) |
if (this->hasScope (CIMScope::PROPERTY)) |
out << " PROPERTY=\"true\""; |
tmp.append("PROPERTY "); |
| |
if (scope & CIMScope::METHOD) |
if (this->hasScope (CIMScope::REFERENCE)) |
out << " METHOD=\"true\""; |
tmp.append("REFERENCE "); |
| |
if (scope & CIMScope::PARAMETER) |
if (this->hasScope (CIMScope::METHOD)) |
out << " PARAMETER=\"true\""; |
tmp.append("METHOD "); |
| |
if (scope & CIMScope::INDICATION) |
if (this->hasScope (CIMScope::PARAMETER)) |
out << " INDICATION=\"true\""; |
tmp.append("PARAMETER "); |
| |
out << "/>"; |
if (tmp.size()) |
} |
tmp.remove(tmp.size() - 1); |
|
|
|
return tmp; |
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |