1 mike 1.23 //%/////////////////////////////////////////////////////////////////////////////
2 //
|
3 kumpf 1.47 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
|
5 mike 1.23 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 chip 1.26 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10 mike 1.23 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
|
12 kumpf 1.47 //
|
13 chip 1.26 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 mike 1.23 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
16 chip 1.26 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19 mike 1.23 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Mike Brasher (mbrasher@bmc.com)
25 //
|
26 kumpf 1.37 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
27 karl 1.42 // Karl Schopmeyer, (k.schopmeyer@opengroup.org)
|
28 kumpf 1.45 // Carol Ann Krug Graves, Hewlett-Packard Company
29 // (carolann_graves@hp.com)
|
30 mike 1.23 //
31 //%/////////////////////////////////////////////////////////////////////////////
32
|
33 mike 1.25 #ifndef Pegasus_Instance_h
34 #define Pegasus_Instance_h
|
35 mike 1.23
36 #include <Pegasus/Common/Config.h>
|
37 kumpf 1.52 #include <Pegasus/Common/Linkage.h>
38 #include <Pegasus/Common/CIMName.h>
|
39 mike 1.25 #include <Pegasus/Common/CIMObject.h>
|
40 mike 1.23
41 PEGASUS_NAMESPACE_BEGIN
42
43 ////////////////////////////////////////////////////////////////////////////////
44 //
45 // CIMInstance
46 //
47 ////////////////////////////////////////////////////////////////////////////////
48
49 class CIMConstInstance;
|
50 kumpf 1.36 class CIMInstanceRep;
|
51 kumpf 1.50 class Resolver;
|
52 mike 1.23
|
53 chip 1.35 /** This class represents the instance of a CIM class. It is used manipulate
|
54 mike 1.27 instances and their parts.
|
55 mike 1.23 */
56 class PEGASUS_COMMON_LINKAGE CIMInstance
57 {
58 public:
59
60 /** Constructor - Create a CIM Instance object.
61 @return Instance created
62 */
|
63 kumpf 1.36 CIMInstance();
|
64 mike 1.23
65 /** Constructor - Create a CIMInstance object from another Instance.
66 @param Instance object from which the new instance is created.
67 @return New instance
68 */
|
69 kumpf 1.36 CIMInstance(const CIMInstance& x);
|
70 mike 1.23
|
71 kumpf 1.38 PEGASUS_EXPLICIT CIMInstance(const CIMObject& x) throw(DynamicCastFailed);
|
72 mike 1.25
|
73 mike 1.23 /** Constructor - Creates an Instance object with the classname
74 from the input parameters
|
75 kumpf 1.52 @param - CIMName className to be used with new instance object
|
76 mike 1.23 @return The new instance object
77 */
|
78 kumpf 1.52 CIMInstance(const CIMName& className);
|
79 kumpf 1.36
80 /** Constructor. */
81 CIMInstance& operator=(const CIMInstance& x);
|
82 mike 1.23
83 /** Destructor. */
|
84 kumpf 1.36 virtual ~CIMInstance();
|
85 mike 1.23
86 /** getClassName - Returns the class name of the instance
|
87 kumpf 1.52 @return CIMName with the class name.
|
88 mike 1.23 */
|
89 kumpf 1.52 const CIMName& getClassName() const;
|
90 mike 1.23
|
91 kumpf 1.43 const CIMObjectPath& getPath() const;
|
92 kumpf 1.45
93 /**
94 Sets the object path for the instance
95 @param path CIMObjectPath containing the object path
96 */
97 void setPath (const CIMObjectPath & path);
|
98 chip 1.26
|
99 mike 1.23 /** addQualifier - Adds the CIMQualifier object to the instance.
100 Thows an exception of the CIMQualifier already exists in the instance
101 @param CIMQualifier object to add to instance
|
102 kumpf 1.48 @return the resulting CIMInstance
|
103 mike 1.23 @exception Throws AlreadyExists.
104 */
|
105 kumpf 1.36 CIMInstance& addQualifier(const CIMQualifier& qualifier);
|
106 mike 1.23
107 /** findQualifier - Searches the instance for the qualifier object
108 defined by the input parameter.
|
109 kumpf 1.52 @param CIMName defining the qualifier object to be found.
|
110 mike 1.23 @return - Position of the qualifier to be used in subsequent
111 operations or PEG_NOT_FOUND if the qualifier is not found.
112 */
|
113 kumpf 1.52 Uint32 findQualifier(const CIMName& name) const;
|
114 mike 1.24
|
115 mike 1.23 /** getQualifier - Retrieves the qualifier object defined by the
116 index input parameter. @ index for the qualifier object.
117 The index to qualifier objects is zero-origin and continuous
118 so that incrementing loops can be used to get all qualifier
119 objects in a CIMInstnace.
120 @return: Returns qualifier object defined by index.
121 @exception Throws the OutOfBounds exception if the index
122 is out of bounds
123 */
|
124 kumpf 1.36 CIMQualifier getQualifier(Uint32 pos);
|
125 mike 1.23
126 /** getQualifier - Retrieves the qualifier object defined by the
127 index input parameter. @ index for the qualifier object.
128 The index to qualifier objects is zero-origin and continuous
129 so that incrementing loops can be used to get all qualifier
130 objects in a CIMInstnace.
131 @return: Returns qualifier object defined by index.
132 @exception Throws the OutOfBounds exception if the index
133 is out of bounds
134 */
|
135 kumpf 1.36 CIMConstQualifier getQualifier(Uint32 pos) const;
|
136 mike 1.23
137 /** getQualifierCount - Gets the numbercount of CIMQualifierobjects
138 defined for this CIMInstance.
139 @return Count of the number of CIMQalifier objects in the
140 CIMInstance.
141 @exception Throws the OutOfBounds exception if the index
142 is out of bounds
143 */
|
144 kumpf 1.36 Uint32 getQualifierCount() const;
|
145 mike 1.23
146 /** addProperty - Adds a property object defined by the input
147 parameter to the CIMInstance
148 @param Property Object to be added. See the CIM Property
149 class for definition of the property object
|
150 kumpf 1.48 @return the resulting CIMInstance.
|
151 mike 1.23 @exception Throws the exception AlreadyExists if the property
152 already exists.
153 */
|
154 kumpf 1.36 CIMInstance& addProperty(const CIMProperty& x);
|
155 mike 1.23
156 /** findProperty - Searches the CIMProperty objects installed in the
157 CIMInstance for property objects with the name defined by the
158 input.
|
159 kumpf 1.52 @param CIMName with the name of the property object to be found
|
160 mike 1.23 @return Position in the CIM Instance to the property object if found or
161 PEG_NOT_FOUND if no property object found with the name defined by the
162 input.
163 */
|
164 kumpf 1.52 Uint32 findProperty(const CIMName& name) const;
|
165 mike 1.23
166 /** getProperty - Gets the CIMproperty object in the CIMInstance defined
167 by the input index parameter.
168 @param Index to the property object in the CIMInstance.
169 The index to qualifier objects is zero-origin and continuous
170 so that incrementing loops can be used to get all qualifier
171 objects in a CIMInstnace.
172 @return CIMProperty object corresponding to the index.
173 @exception Throws the OutOfBounds exception if the index
174 is out of bounds
175 */
|
176 karl 1.42 CIMProperty getProperty(Uint32 pos) throw(OutOfBounds);
|
177 mike 1.23
178 /** getProperty - Gets the CIMproperty object in the CIMInstance defined
179 by the input index parameter.
180 @param Index to the property object in the CIMInstance.
181 The index to qualifier objects is zero-origin and continuous
182 so that incrementing loops can be used to get all qualifier
183 objects in a CIMInstnace.
184 @return CIMProperty object corresponding to the index.
185 @exception Throws the OutOfBounds exception if the index
186 is out of bounds
187 */
|
188 karl 1.42 CIMConstProperty getProperty(Uint32 pos) const throw(OutOfBounds);
|
189 mike 1.23
190 /** removeProperty - Removes the property represented
191 by the position input parameter from the instance.
192 @param pos Index to the property to be removed from the
193 instance. Normally this is obtained by getProperty();
194 @exception Throws OutofBounds if index is not a property object
195 */
|
196 karl 1.42 void removeProperty(Uint32 pos) throw(OutOfBounds);
|
197 mike 1.23
198 /** getPropertyCount - Gets the numbercount of CIMProperty
199 objects defined for this CIMInstance.
200 @return Count of the number of CIMProperty objects in the
201 CIMInstance. Zero indicates that no CIMProperty objects
202 are contained in the CIMInstance
203 @exception Throws the OutOfBounds exception if the index
204 is out of bounds
205
206 */
|
207 kumpf 1.36 Uint32 getPropertyCount() const;
|
208 mike 1.23
|
209 kumpf 1.36 /** getInstanceName - Get the instance name of this instance. The class
210 argument is used to determine which fields are keys. The instance
211 name has this from:
|
212 mike 1.23
|
213 kumpf 1.36 <PRE>
214 ClassName.key1=value1,...,keyN=valueN
215 </PRE>
|
216 mike 1.23
|
217 kumpf 1.36 The instance name is in standard form (the class name and key name
218 is all lowercase; the keys-value pairs appear in sorted order by
219 key name).
|
220 mike 1.23 */
|
221 kumpf 1.43 CIMObjectPath getInstanceName(const CIMConstClass& cimClass) const;
|
222 mike 1.23
|
223 kumpf 1.36 /** CIMMethod
|
224 mike 1.23
|
225 karl 1.29 */
|
226 kumpf 1.36 CIMInstance clone() const;
227
|
228 mike 1.23 /** identical - Compares the CIMInstance with another CIMInstance
229 defined by the input parameter for equality of all components.
230 @param CIMInstance to be compared
231 @return Boolean true if they are identical
232 */
233 Boolean identical(const CIMConstInstance& x) const;
234
|
235 kumpf 1.36 #ifdef PEGASUS_INTERNALONLY
|
236 kumpf 1.48 /** isNull() */
|
237 kumpf 1.39 Boolean isNull() const;
|
238 kumpf 1.36
239 String toString() const;
240 #endif
|
241 sage 1.28
|
242 mike 1.23 private:
243
|
244 kumpf 1.36 CIMInstanceRep* _rep;
245
246 CIMInstance(CIMInstanceRep* rep);
247
248 void _checkRep() const;
|
249 mike 1.23
250 friend class CIMConstInstance;
251 friend class CIMObject;
|
252 mike 1.25 friend class CIMConstObject;
|
253 kumpf 1.50 friend class Resolver;
|
254 kumpf 1.40 friend class XmlWriter;
|
255 kumpf 1.41 friend class MofWriter;
|
256 mike 1.23 };
257
258 ////////////////////////////////////////////////////////////////////////////////
259 //
260 // CIMConstInstance
261 //
262 ////////////////////////////////////////////////////////////////////////////////
263
264 class PEGASUS_COMMON_LINKAGE CIMConstInstance
265 {
266 public:
267
|
268 kumpf 1.36 CIMConstInstance();
|
269 mike 1.23
|
270 kumpf 1.36 CIMConstInstance(const CIMConstInstance& x);
|
271 mike 1.23
|
272 kumpf 1.36 CIMConstInstance(const CIMInstance& x);
|
273 mike 1.23
|
274 kumpf 1.38 PEGASUS_EXPLICIT CIMConstInstance(const CIMObject& x)
275 throw(DynamicCastFailed);
|
276 mike 1.25
|
277 kumpf 1.38 PEGASUS_EXPLICIT CIMConstInstance(const CIMConstObject& x)
278 throw(DynamicCastFailed);
|
279 mike 1.25
|
280 kumpf 1.52 CIMConstInstance(const CIMName& className);
|
281 kumpf 1.36
282 CIMConstInstance& operator=(const CIMConstInstance& x);
283
284 CIMConstInstance& operator=(const CIMInstance& x);
285
286 ~CIMConstInstance();
287
|
288 kumpf 1.52 const CIMName& getClassName() const;
|
289 kumpf 1.36
|
290 kumpf 1.43 const CIMObjectPath& getPath() const;
|
291 kumpf 1.36
|
292 kumpf 1.52 Uint32 findQualifier(const CIMName& name) const;
|
293 kumpf 1.36
294 CIMConstQualifier getQualifier(Uint32 pos) const;
295
296 Uint32 getQualifierCount() const;
297
|
298 kumpf 1.52 Uint32 findProperty(const CIMName& name) const;
|
299 kumpf 1.36
300 CIMConstProperty getProperty(Uint32 pos) const;
|
301 mike 1.23
|
302 kumpf 1.36 Uint32 getPropertyCount() const;
303
|
304 kumpf 1.43 CIMObjectPath getInstanceName(const CIMConstClass& cimClass) const;
|
305 kumpf 1.36
306 CIMInstance clone() const;
307
308 Boolean identical(const CIMConstInstance& x) const;
309
310 #ifdef PEGASUS_INTERNALONLY
|
311 kumpf 1.39 Boolean isNull() const;
|
312 kumpf 1.36
313 String toString() const;
314 #endif
|
315 mike 1.23
316 private:
317
|
318 kumpf 1.36 CIMInstanceRep* _rep;
319
320 void _checkRep() const;
|
321 mike 1.23
322 friend class CIMInstance;
|
323 mike 1.25 friend class CIMObject;
324 friend class CIMConstObject;
|
325 kumpf 1.40 friend class XmlWriter;
|
326 kumpf 1.41 friend class MofWriter;
|
327 mike 1.23 };
|
328 kumpf 1.39
329 PEGASUS_COMMON_LINKAGE Boolean operator==(
330 const CIMInstance& x,
331 const CIMInstance& y);
|
332 mike 1.23
333 #define PEGASUS_ARRAY_T CIMInstance
|
334 kumpf 1.46 # include <Pegasus/Common/ArrayInter.h>
|
335 mike 1.23 #undef PEGASUS_ARRAY_T
336
337 PEGASUS_NAMESPACE_END
338
|
339 mike 1.25 #endif /* Pegasus_Instance_h */
|