1 karl 1.17 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.8 //
|
3 karl 1.15 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.14 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.15 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.16 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.17 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.8 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.9 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 mike 1.8 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
|
21 kumpf 1.9 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.8 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 kumpf 1.9 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 mike 1.8 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Author: Bob Blair (bblair@bmc.com)
33 //
34 // Modified By:
35 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38
39 //
40 // class to encapsulate a qualifier list construct in the MOF grammer
41 // Since qualifier lists can appear before a lot of different metaelements,
42 // we have to collect them before we know where they go; then apply
43 // them to the metaelement one at a time.
|
44 karl 1.13 // NOTE: KS. Sept 2003. Most of this could be replaced by CIMQualifierList.
45 // The one function that is unique is the applyQualifierList template.
|
46 mike 1.8
47 #ifndef _QUALIFIERLIST_H_
48 #define _QUALIFIERLIST_H_
49
50 #include <Pegasus/Common/CIMQualifier.h>
|
51 kumpf 1.11 #include <Pegasus/Common/ArrayInternal.h>
|
52 kumpf 1.10 #include <Pegasus/Compiler/Linkage.h>
|
53 mike 1.8 #include "memobjs.h"
54
55 PEGASUS_USING_PEGASUS;
56 PEGASUS_USING_STD;
57
58 typedef Array<CIMQualifier *> qplist;
59
|
60 karl 1.13 /** Class to create and add to a qualifierList
61 */
|
62 mike 1.8 class PEGASUS_COMPILER_LINKAGE qualifierList {
63 public:
64 qplist *_pv;
65 unsigned int _initsize;
66 public:
|
67 karl 1.13 /** constructor - creates instance of list with size
68 @param - optional parameter to set size
69 */
70 qualifierList(unsigned int vsize = 10) : _pv(0), _initsize(vsize)
71 {init(vsize);}
72
73 ~qualifierList();
74 /** init function sets list size
75 @param size to set. Default is zero
76 */
77 void init(int size = 0);
78 /** add a qualifier to the list
79 @param - pointer to CIMQualifer object to add to list.
80 */
81 void add(CIMQualifier *q);
|
82 mike 1.8 };
83
|
84 karl 1.13 /** applyQualifierList applies the qualifier list in the
85 first parameter to the object defined in the second
86 parameter. Applies each qualifier in the list to the
87 object with an addQualifier function.
88 @param - pointer to qualifierList object that containes
89 the qualifier list to be applied
90 @param - pointer to object to which it is to be applied.
91 This is a template.
92 The efficacy of this template depends on each metaelement
93 (class, instance, method, etc., supporting an addQualifier()
94 method.
95 */
|
96 mike 1.8 template <class T>
|
97 karl 1.13 void applyQualifierList(qualifierList* that, T *c)
|
98 mike 1.8 {
99 if (that->_pv) {
|
100 kumpf 1.12 for (Uint32 i = 0;
101 i < that->_pv->size(); // && (*that->_pv)[i] ?
102 i++) {
103 CIMQualifier** qpp = &((*that->_pv)[i]);
104 c->addQualifier( **qpp );
105 delete *qpp;
106 *qpp = 0;
|
107 mike 1.8 }
108 that->init(that->_initsize);
109 }
110 }
111
112 #endif
|