version 1.26, 2002/08/05 16:14:41
|
version 1.40, 2008/03/05 21:31:45
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// 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. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec 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 |
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifndef Pegasus_QualifierList_h | #ifndef Pegasus_QualifierList_h |
|
|
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
|
#include <Pegasus/Common/Constants.h> |
#include <Pegasus/Common/CIMName.h> | #include <Pegasus/Common/CIMName.h> |
#include <Pegasus/Common/CIMQualifier.h> | #include <Pegasus/Common/CIMQualifier.h> |
#include <Pegasus/Common/CIMScope.h> | #include <Pegasus/Common/CIMScope.h> |
#include <Pegasus/Common/Array.h> | #include <Pegasus/Common/Array.h> |
#include <Pegasus/Common/Pair.h> | #include <Pegasus/Common/Pair.h> |
|
#include <Pegasus/Common/Buffer.h> |
|
#include <Pegasus/Common/OrderedSet.h> |
| |
| |
/* ATTN: P2 KS 25 Mar 2002 - The function names are a mismash of local and taken |
/* ATTN: P2 KS 25 Mar 2002 - The function names are a mismash of local and |
from the class and instance functions. Thus, we have getCount but getQualifier |
taken from the class and instance functions. Thus, we have getCount but |
This causes confusion with the functions in class and instance which are specifically |
getQualifier. This causes confusion with the functions in class and |
getQualifier. We should clean up so the names here remove the Qualifier portion. |
instance which are specifically getQualifier. We should clean up so the |
|
names here remove the Qualifier portion. |
*/ | */ |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
class DeclContext; | class DeclContext; |
| |
|
/* ATTN: KS P3 DEFER 1 May 2002. |
/* ATTN: KS P3 DEFER 1 May 2002. We have list processors (really array processors) for |
We have list processors (really array processors) for |
qualifiers, properties, methods(???) but they are all slightly different. | qualifiers, properties, methods(???) but they are all slightly different. |
Should we create a common base?? | Should we create a common base?? |
*/ | */ |
|
|
return _qualifiers.size(); | return _qualifiers.size(); |
} | } |
| |
/** getQualifer - Gets the qaulifier defined at the position provided |
/** getQualifer - Gets the qaulifier defined at the index provided |
in the Qualifier list. | in the Qualifier list. |
@param pos - The position in the qualifierlist containing the |
@param index - The position in the qualifierlist containing the |
qualifier. | qualifier. |
@return CIMQualifier object. | @return CIMQualifier object. |
@exception - Throws OutofBounds exception of pso not within the | @exception - Throws OutofBounds exception of pso not within the |
qualifier list. | qualifier list. |
ATTN: P0 KS Mar 2002 Add the outofbounds exception. | ATTN: P0 KS Mar 2002 Add the outofbounds exception. |
*/ | */ |
CIMQualifier& getQualifier(Uint32 pos); |
CIMQualifier& getQualifier(Uint32 index); |
| |
const CIMQualifier& getQualifier(Uint32 pos) const |
const CIMQualifier& getQualifier(Uint32 index) const |
{ | { |
return _qualifiers[pos]; |
return _qualifiers[index]; |
} | } |
| |
/** removeQualifier - Removes the Qualifier defined by | /** removeQualifier - Removes the Qualifier defined by |
the pos parameter |
the index parameter |
@exception Throws "OutOfBounds" if pos not within |
@exception IndexOutOfBoundsException if index not within |
range of current qualifiers. | range of current qualifiers. |
*/ | */ |
void removeQualifier(Uint32 pos); |
void removeQualifier(Uint32 index); |
|
|
|
/** |
|
Removes all the qualifiers from the list. |
|
*/ |
|
void clear(); |
| |
/** find - Searches for a qualifier with the specified ` | /** find - Searches for a qualifier with the specified ` |
input name if it exists in the class | input name if it exists in the class |
|
|
| |
Boolean exists(const CIMName& name) const | Boolean exists(const CIMName& name) const |
{ | { |
return (((find(name)) == PEG_NOT_FOUND)? false : true); |
return (find(name) != PEG_NOT_FOUND); |
} | } |
| |
/** isTrue - Determines if the qualifier defined by | /** isTrue - Determines if the qualifier defined by |
|
|
*/ | */ |
Boolean isTrue(const CIMName& name) const; | Boolean isTrue(const CIMName& name) const; |
| |
/// findReverse - See find |
/** resolve - Resolves the qualifierList based on the information provided. |
Uint32 findReverse(const CIMName& name) const; |
The resolved qualifiers are the result of validating and testing the |
|
qualifiers against the inherited qualifiers and qualifier declarations. |
|
The qualifier list contains the set of resolved qualifiers when the |
|
function is complete. |
| |
/** resolve - Resolves the qualifierList based on the information provided. The resolved |
|
qualifiers are the result of validating and testing the qualifiers against the |
|
inherited qualifiers and qualifier declarations. The qualifier list contains |
|
the set of resolved qualifiers when the function is complete. |
|
Resolution includes: | Resolution includes: |
1. Determining if the qualifier is declared (obtainable form declContext). |
1. Determining if the qualifier is declared (obtainable form |
|
declContext). |
2. Qualifier is same type as declaration | 2. Qualifier is same type as declaration |
3. Valid for the scope provided (Qualifier scope contains the provided scope). |
3. Valid for the scope provided (Qualifier scope contains the provided |
|
scope). |
4. Whether qualifier can be overridden. | 4. Whether qualifier can be overridden. |
5. Whether it should be propagated to subclass | 5. Whether it should be propagated to subclass |
If a qualifier can be overridden it is put into the qualifiers array. | If a qualifier can be overridden it is put into the qualifiers array. |
@param declContext Declaration context for this resolution (ex repository, simple) |
|
|
@param declContext Declaration context for this resolution (ex |
|
repository, simple) |
@param nameSpace Namespace in which to find the declaration. | @param nameSpace Namespace in which to find the declaration. |
@param scope - Scope of the entity doing the resolution (ex. Class, association, etc.) |
@param scope - Scope of the entity doing the resolution (ex. Class, |
|
association, etc.) |
@param isInstancePart - TBD | @param isInstancePart - TBD |
@param inheritedQualifiers - CimQualifierList defining List of inherited qualifiers |
@param inheritedQualifiers - CimQualifierList defining List of |
@param propagateQualifiers Boolean indicator whether to propagate qualifiers. |
inherited qualifiers |
@return |
@param propagateQualifiers Boolean indicator whether to propagate |
|
qualifiers. |
@exception - There are a number of different | @exception - There are a number of different |
*/ | */ |
void resolve( | void resolve( |
DeclContext* declContext, | DeclContext* declContext, |
const String& nameSpace, |
const CIMNamespaceName & nameSpace, |
CIMScope scope, | CIMScope scope, |
Boolean isInstancePart, | Boolean isInstancePart, |
CIMQualifierList& inheritedQualifiers, | CIMQualifierList& inheritedQualifiers, |
Boolean propagateQualifiers); | Boolean propagateQualifiers); |
| |
/// | /// |
void toXml(Array<Sint8>& out) const; |
|
|
|
/// |
|
void toMof(Array<Sint8>& out) const; |
|
|
|
/// |
|
void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const; | void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const; |
| |
/// | /// |
|
|
/// | /// |
void cloneTo(CIMQualifierList& x) const; | void cloneTo(CIMQualifierList& x) const; |
| |
|
Boolean isKey() const; |
|
|
private: | private: |
| |
Array<CIMQualifier> _qualifiers; |
typedef OrderedSet<CIMQualifier, |
|
CIMQualifierRep, |
|
PEGASUS_QUALIFIER_ORDEREDSET_HASHSIZE> QualifierSet; |
|
QualifierSet _qualifiers; |
|
|
|
/** Index of key qualifier or the meaning is as follows: |
|
PEGASUS_ORDEREDSET_INDEX_NOTFOUND -- |
|
there is no key qualifier in the list. |
|
PEGASUS_ORDEREDSET_INDEX_UNKNOWN -- |
|
the index is unresolved. |
|
*/ |
|
Uint32 _keyIndex; |
|
|
|
friend class CIMPropertyInternal; |
}; | }; |
| |
|
/** |
|
Applies a specified qualifier list to a specified object, using an |
|
addQualifier method which is expected to exist for the object type. |
|
@param qualifierList The CIMQualifierList to apply to the object. |
|
@param object The object to which to apply the qualifierList. |
|
*/ |
|
template <class T> |
|
void applyQualifierList(CIMQualifierList& qualifierList, T& object) |
|
{ |
|
for (Uint32 i = 0; i < qualifierList.getCount(); i++) |
|
{ |
|
object.addQualifier(qualifierList.getQualifier(i)); |
|
} |
|
qualifierList.clear(); |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
#endif /* Pegasus_QualifierList_h */ | #endif /* Pegasus_QualifierList_h */ |