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.56 PEGASUS_EXPLICIT CIMInstance(const CIMObject& x) throw(DynamicCastFailedException);
|
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 kumpf 1.56 @exception AlreadyExistsException.
|
104 mike 1.23 */
|
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 kumpf 1.56 @exception Throws the IndexOutOfBoundsException exception if the index
|
122 mike 1.23 is out of bounds
123 */
|
124 kumpf 1.57 CIMQualifier getQualifier(Uint32 index);
|
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 kumpf 1.56 @exception Throws the IndexOutOfBoundsException exception if the index
|
133 mike 1.23 is out of bounds
134 */
|
135 kumpf 1.57 CIMConstQualifier getQualifier(Uint32 index) 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 kumpf 1.56 @exception Throws the IndexOutOfBoundsException exception if the index
|
142 mike 1.23 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 kumpf 1.56 @exception AlreadyExistsException if the property already exists.
|
152 mike 1.23 */
|
153 kumpf 1.36 CIMInstance& addProperty(const CIMProperty& x);
|
154 mike 1.23
155 /** findProperty - Searches the CIMProperty objects installed in the
156 CIMInstance for property objects with the name defined by the
157 input.
|
158 kumpf 1.52 @param CIMName with the name of the property object to be found
|
159 mike 1.23 @return Position in the CIM Instance to the property object if found or
160 PEG_NOT_FOUND if no property object found with the name defined by the
161 input.
162 */
|
163 kumpf 1.52 Uint32 findProperty(const CIMName& name) const;
|
164 mike 1.23
165 /** getProperty - Gets the CIMproperty object in the CIMInstance defined
166 by the input index parameter.
167 @param Index to the property object in the CIMInstance.
168 The index to qualifier objects is zero-origin and continuous
169 so that incrementing loops can be used to get all qualifier
170 objects in a CIMInstnace.
171 @return CIMProperty object corresponding to the index.
|
172 kumpf 1.56 @exception Throws the IndexOutOfBoundsException exception if the index
|
173 mike 1.23 is out of bounds
174 */
|
175 kumpf 1.57 CIMProperty getProperty(Uint32 index) throw(IndexOutOfBoundsException);
|
176 mike 1.23
177 /** getProperty - Gets the CIMproperty object in the CIMInstance defined
178 by the input index parameter.
179 @param Index to the property object in the CIMInstance.
180 The index to qualifier objects is zero-origin and continuous
181 so that incrementing loops can be used to get all qualifier
182 objects in a CIMInstnace.
183 @return CIMProperty object corresponding to the index.
|
184 kumpf 1.56 @exception Throws the IndexOutOfBoundsException exception if the index
|
185 mike 1.23 is out of bounds
186 */
|
187 kumpf 1.57 CIMConstProperty getProperty(Uint32 index) const throw(IndexOutOfBoundsException);
|
188 mike 1.23
189 /** removeProperty - Removes the property represented
|
190 kumpf 1.57 by the index input parameter from the instance.
191 @param index Index to the property to be removed from the
|
192 mike 1.23 instance. Normally this is obtained by getProperty();
|
193 kumpf 1.57 @exception IndexOutOfBoundsException if index is outside the range of
194 properties in this instance
|
195 mike 1.23 */
|
196 kumpf 1.57 void removeProperty(Uint32 index) throw(IndexOutOfBoundsException);
|
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 kumpf 1.56 @exception Throws the IndexOutOfBoundsException exception if the index
|
204 mike 1.23 is out of bounds
205
206 */
|
207 kumpf 1.36 Uint32 getPropertyCount() const;
|
208 mike 1.23
|
209 kumpf 1.55 /** buildPath - Build the CIM object path for this instance. The class
|
210 kumpf 1.36 argument is used to determine which fields are keys. The instance
|
211 kumpf 1.55 name has this form:
|
212 mike 1.23
|
213 kumpf 1.36 <PRE>
214 ClassName.key1=value1,...,keyN=valueN
215 </PRE>
|
216 mike 1.23
|
217 kumpf 1.55 The object path is in standard form (the class name and key name
|
218 kumpf 1.36 is all lowercase; the keys-value pairs appear in sorted order by
219 key name).
|
220 kumpf 1.55
221 Note that the path attribute of the CIMInstanceRep object is not
222 modified.
|
223 mike 1.23 */
|
224 kumpf 1.55 CIMObjectPath buildPath(const CIMConstClass& cimClass) const;
|
225 mike 1.23
|
226 kumpf 1.36 /** CIMMethod
|
227 mike 1.23
|
228 karl 1.29 */
|
229 kumpf 1.36 CIMInstance clone() const;
230
|
231 mike 1.23 /** identical - Compares the CIMInstance with another CIMInstance
232 defined by the input parameter for equality of all components.
233 @param CIMInstance to be compared
234 @return Boolean true if they are identical
235 */
236 Boolean identical(const CIMConstInstance& x) const;
237
|
238 kumpf 1.54 /**
239 Determines if the object has not been initialized.
240
241 @return True if the object has not been initialized,
242 False otherwise
243 */
244 Boolean isUninitialized() const;
245
|
246 kumpf 1.36 #ifdef PEGASUS_INTERNALONLY
247 String toString() const;
248 #endif
|
249 sage 1.28
|
250 mike 1.23 private:
251
|
252 kumpf 1.36 CIMInstanceRep* _rep;
253
254 CIMInstance(CIMInstanceRep* rep);
255
256 void _checkRep() const;
|
257 mike 1.23
258 friend class CIMConstInstance;
259 friend class CIMObject;
|
260 mike 1.25 friend class CIMConstObject;
|
261 kumpf 1.50 friend class Resolver;
|
262 kumpf 1.40 friend class XmlWriter;
|
263 kumpf 1.41 friend class MofWriter;
|
264 mike 1.23 };
265
266 ////////////////////////////////////////////////////////////////////////////////
267 //
268 // CIMConstInstance
269 //
270 ////////////////////////////////////////////////////////////////////////////////
271
272 class PEGASUS_COMMON_LINKAGE CIMConstInstance
273 {
274 public:
275
|
276 kumpf 1.36 CIMConstInstance();
|
277 mike 1.23
|
278 kumpf 1.36 CIMConstInstance(const CIMConstInstance& x);
|
279 mike 1.23
|
280 kumpf 1.36 CIMConstInstance(const CIMInstance& x);
|
281 mike 1.23
|
282 kumpf 1.38 PEGASUS_EXPLICIT CIMConstInstance(const CIMObject& x)
|
283 kumpf 1.56 throw(DynamicCastFailedException);
|
284 mike 1.25
|
285 kumpf 1.38 PEGASUS_EXPLICIT CIMConstInstance(const CIMConstObject& x)
|
286 kumpf 1.56 throw(DynamicCastFailedException);
|
287 mike 1.25
|
288 kumpf 1.52 CIMConstInstance(const CIMName& className);
|
289 kumpf 1.36
290 CIMConstInstance& operator=(const CIMConstInstance& x);
291
292 CIMConstInstance& operator=(const CIMInstance& x);
293
294 ~CIMConstInstance();
295
|
296 kumpf 1.52 const CIMName& getClassName() const;
|
297 kumpf 1.36
|
298 kumpf 1.43 const CIMObjectPath& getPath() const;
|
299 kumpf 1.36
|
300 kumpf 1.52 Uint32 findQualifier(const CIMName& name) const;
|
301 kumpf 1.36
|
302 kumpf 1.57 CIMConstQualifier getQualifier(Uint32 index) const;
|
303 kumpf 1.36
304 Uint32 getQualifierCount() const;
305
|
306 kumpf 1.52 Uint32 findProperty(const CIMName& name) const;
|
307 kumpf 1.36
|
308 kumpf 1.57 CIMConstProperty getProperty(Uint32 index) const;
|
309 mike 1.23
|
310 kumpf 1.36 Uint32 getPropertyCount() const;
311
|
312 kumpf 1.55 CIMObjectPath buildPath(const CIMConstClass& cimClass) const;
|
313 kumpf 1.36
314 CIMInstance clone() const;
315
316 Boolean identical(const CIMConstInstance& x) const;
317
|
318 kumpf 1.54 Boolean isUninitialized() const;
319
|
320 kumpf 1.36 #ifdef PEGASUS_INTERNALONLY
321 String toString() const;
322 #endif
|
323 mike 1.23
324 private:
325
|
326 kumpf 1.36 CIMInstanceRep* _rep;
327
328 void _checkRep() const;
|
329 mike 1.23
330 friend class CIMInstance;
|
331 mike 1.25 friend class CIMObject;
332 friend class CIMConstObject;
|
333 kumpf 1.40 friend class XmlWriter;
|
334 kumpf 1.41 friend class MofWriter;
|
335 mike 1.23 };
336
337 #define PEGASUS_ARRAY_T CIMInstance
|
338 kumpf 1.46 # include <Pegasus/Common/ArrayInter.h>
|
339 mike 1.23 #undef PEGASUS_ARRAY_T
340
341 PEGASUS_NAMESPACE_END
342
|
343 mike 1.25 #endif /* Pegasus_Instance_h */
|