(file) Return to CIMQualifierList.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 martin 1.42 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.43 //
  3 martin 1.42 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.43 //
 10 martin 1.42 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.43 //
 17 martin 1.42 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.43 //
 20 martin 1.42 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.43 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.42 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.43 //
 28 martin 1.42 //////////////////////////////////////////////////////////////////////////
 29 mike   1.15 //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #ifndef Pegasus_QualifierList_h
 33             #define Pegasus_QualifierList_h
 34             
 35             #include <Pegasus/Common/Config.h>
 36 kumpf  1.25 #include <Pegasus/Common/Linkage.h>
 37 marek  1.39 #include <Pegasus/Common/Constants.h>
 38 kumpf  1.25 #include <Pegasus/Common/CIMName.h>
 39 mike   1.15 #include <Pegasus/Common/CIMQualifier.h>
 40 kumpf  1.26 #include <Pegasus/Common/CIMScope.h>
 41 mike   1.15 #include <Pegasus/Common/Array.h>
 42             #include <Pegasus/Common/Pair.h>
 43 mike   1.34 #include <Pegasus/Common/Buffer.h>
 44 marek  1.39 #include <Pegasus/Common/OrderedSet.h>
 45 mike   1.15 
 46 karl   1.20 
 47 kumpf  1.36 /*  ATTN: P2 KS 25 Mar 2002 - The function names are a mismash of local and
 48                 taken from the class and instance functions.  Thus, we have getCount but
 49                 getQualifier.  This causes confusion with the functions in class and
 50                 instance which are specifically getQualifier.  We should clean up so the
 51                 names here remove the Qualifier portion.
 52 karl   1.20 */
 53 mike   1.15 PEGASUS_NAMESPACE_BEGIN
 54             
 55             class DeclContext;
 56             
 57 kumpf  1.36 /* ATTN: KS P3 DEFER 1 May 2002.
 58                 We have list processors (really array processors) for
 59 karl   1.22     qualifiers, properties, methods(???) but they are all slightly different.
 60                 Should we create a common base??
 61             */
 62             /** This class is for representing Qualifier lists in the CIM interface.
 63             
 64                 Members are provided for accessing elements of the the internal property
 65                 list. There are none for modifying elements (the entire array must be
 66                 formed and passed to the constructor or replaced by calling set()).
 67             */
 68             
 69 mike   1.15 class PEGASUS_COMMON_LINKAGE CIMQualifierList
 70             {
 71             public:
 72             
 73 karl   1.22     /// constructor - Constructs a NULL qualifier list.
 74 mike   1.15     CIMQualifierList();
 75             
 76 karl   1.17     ///
 77 mike   1.15     ~CIMQualifierList();
 78             
 79 karl   1.22     /** add adds a single CIMQualifier to a CIMQualifierList
 80                 */
 81 mike   1.15     CIMQualifierList& add(const CIMQualifier& qualifier);
 82             
 83 kumpf  1.36     /** getCount - Returns the count of qualifiers in the list
 84                     @return Zero origin count of qualifiers in the qualifier list.
 85 karl   1.20     */
 86 mike   1.15     Uint32 getCount() const
 87                 {
 88 kumpf  1.36         return _qualifiers.size();
 89 mike   1.15     }
 90             
 91 kumpf  1.28     /** getQualifer - Gets the qaulifier defined at the index provided
 92 kumpf  1.36         in the Qualifier list.
 93                     @param index - The position in the qualifierlist containing the
 94                     qualifier.
 95                     @return CIMQualifier object.
 96                     @exception - Throws OutofBounds exception of pso not within the
 97                     qualifier list.
 98                     ATTN: P0 KS Mar 2002 Add the outofbounds exception.
 99 karl   1.20     */
100 kumpf  1.28     CIMQualifier& getQualifier(Uint32 index);
101 mike   1.15 
102 kumpf  1.28     const CIMQualifier& getQualifier(Uint32 index) const
103 mike   1.15     {
104 kumpf  1.36         return _qualifiers[index];
105 mike   1.15     }
106 karl   1.20 
107 mike   1.15     /** removeQualifier - Removes the Qualifier defined by
108 kumpf  1.36         the index parameter
109                     @exception IndexOutOfBoundsException if index not within
110                     range of current qualifiers.
111 mike   1.15     */
112 kumpf  1.28     void removeQualifier(Uint32 index);
113 kumpf  1.36 
114 kumpf  1.38     /**
115                     Removes all the qualifiers from the list.
116                 */
117                 void clear();
118             
119 kumpf  1.36     /** find - Searches for a qualifier with the specified `
120 karl   1.20         input name if it exists in the class
121 kumpf  1.36         @param name CIMName of the qualifier
122                     to be found @return Position of the qualifier in the Class.
123                     @return Returns index of the qualifier found or PEG_NOT_FOUND
124                     if not found.
125 karl   1.20     */
126 kumpf  1.25     Uint32 find(const CIMName& name) const;
127 mike   1.15 
128 karl   1.20     /** exists - Returns true if the qualifier with the
129 kumpf  1.36         specified name exists in the class
130                     @param name CIMName name of the qualifier object being tested.
131                     @return True if the qualifier exits in the list.  Otherwise
132                     false is returned.
133 karl   1.20     */
134             
135 kumpf  1.25     Boolean exists(const CIMName& name) const
136 karl   1.20     {
137 kumpf  1.37         return (find(name) != PEG_NOT_FOUND);
138 karl   1.20     }
139             
140                 /** isTrue - Determines if the qualifier defined by
141 kumpf  1.36         the input parameter exists for the class, is Boolean, and
142                     has a value of true.
143                     This function is useful to quickly determine the state of a
144                     qualifier.
145                     @param CIMName containing the qualifier  name.
146                     @return Boolean True if the qualifier exists,
147 karl   1.20     */
148 kumpf  1.25     Boolean isTrue(const CIMName& name) const;
149 karl   1.20 
150 kumpf  1.36     /** resolve - Resolves the qualifierList based on the information provided.
151                     The resolved qualifiers are the result of validating and testing the
152                     qualifiers against the inherited qualifiers and qualifier declarations.
153                     The qualifier list contains the set of resolved qualifiers when the
154                     function is complete.
155             
156                     Resolution includes:
157                     1. Determining if the qualifier is declared (obtainable form
158                        declContext).
159                     2. Qualifier is same type as declaration
160                     3. Valid for the scope provided (Qualifier scope contains the provided
161                        scope).
162                     4. Whether qualifier can be overridden.
163                     5. Whether it should be propagated to subclass
164                     If a qualifier can be overridden it is put into the qualifiers array.
165             
166                     @param declContext  Declaration context for this resolution (ex
167                     repository, simple)
168 karl   1.19         @param nameSpace Namespace in which to find the declaration.
169 kumpf  1.36         @param scope - Scope of the entity doing the resolution (ex. Class,
170                     association, etc.)
171 karl   1.19         @param isInstancePart - TBD
172 kumpf  1.36         @param inheritedQualifiers - CimQualifierList defining List of
173                     inherited qualifiers
174                     @param propagateQualifiers Boolean indicator whether to propagate
175                     qualifiers.
176                     @exception - There are a number of different
177                 */
178 mike   1.15     void resolve(
179 kumpf  1.36         DeclContext* declContext,
180                     const CIMNamespaceName & nameSpace,
181                     CIMScope scope,
182                     Boolean isInstancePart,
183                     CIMQualifierList& inheritedQualifiers,
184                     Boolean propagateQualifiers);
185 mike   1.15 
186 karl   1.17     ///
187 mike   1.15     void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const;
188             
189 karl   1.17     ///
190 mike   1.15     Boolean identical(const CIMQualifierList& x) const;
191             
192 karl   1.17     ///
193 mike   1.15     void cloneTo(CIMQualifierList& x) const;
194             
195 marek  1.39     Boolean isKey() const;
196             
197 mike   1.41     /// Add qualifier without checking whether it already exists.
198                 CIMQualifierList& addUnchecked(const CIMQualifier& qualifier);
199             
200 mike   1.15 private:
201             
202 marek  1.39     typedef OrderedSet<CIMQualifier,
203                                    CIMQualifierRep,
204                                    PEGASUS_QUALIFIER_ORDEREDSET_HASHSIZE> QualifierSet;
205                 QualifierSet _qualifiers;
206             
207                 /** Index of key qualifier or the meaning is as follows:
208 kumpf  1.44            PEGASUS_ORDEREDSET_INDEX_NOTFOUND --
209 marek  1.39                there is no key qualifier in the list.
210                        PEGASUS_ORDEREDSET_INDEX_UNKNOWN --
211                            the index is unresolved.
212                 */
213                 Uint32 _keyIndex;
214             
215                 friend class CIMPropertyInternal;
216 mike   1.15 };
217             
218 kumpf  1.38 /**
219                 Applies a specified qualifier list to a specified object, using an
220                 addQualifier method which is expected to exist for the object type.
221                 @param qualifierList The CIMQualifierList to apply to the object.
222                 @param object The object to which to apply the qualifierList.
223             */
224             template <class T>
225             void applyQualifierList(CIMQualifierList& qualifierList, T& object)
226             {
227                 for (Uint32 i = 0; i < qualifierList.getCount(); i++)
228                 {
229                     object.addQualifier(qualifierList.getQualifier(i));
230                 }
231                 qualifierList.clear();
232             }
233             
234 mike   1.15 PEGASUS_NAMESPACE_END
235             
236             #endif /* Pegasus_QualifierList_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2