1 thilo.boehm 1.1.2.1 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // 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 //
10 // 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 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 thilo.boehm 1.1.2.1 // 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 //
28 //////////////////////////////////////////////////////////////////////////
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef _SCMOINSTANCE_H_
33 #define _SCMOINSTANCE_H_
34
35
36 #include <Pegasus/Common/Config.h>
37 #include <Pegasus/Common/Linkage.h>
38 #include <Pegasus/Common/SCMO.h>
|
39 thilo.boehm 1.1.2.2 #include <Pegasus/Common/SCMOClass.h>
|
40 r.kieninger 1.1.2.10 #include <Pegasus/Common/Union.h>
|
41 thilo.boehm 1.1.2.1
42 PEGASUS_NAMESPACE_BEGIN
43
44 #define PEGASUS_SCMB_INSTANCE_MAGIC 0xD00D1234
45
46 class PEGASUS_COMMON_LINKAGE SCMOInstance
47 {
48 public:
49
50 /**
|
51 thilo.boehm 1.1.2.19 * A SCMOInstance can only be created by a SCMOClass
52 */
53 SCMOInstance();
54
55 /**
|
56 thilo.boehm 1.1.2.1 * Creating a SCMOInstance using a SCMOClass.
57 * @param baseClass A SCMOClass.
58 */
|
59 thilo.boehm 1.1.2.32 SCMOInstance(SCMOClass& baseClass);
60
61
62 /**
63 * Creating a SCMOInstance using a CIMClass
64 * using an optional name space name,
65 * @param baseClass A SCMOClass.
66 * @param nameSpaceName An optional name space name.
67 */
68 SCMOInstance(CIMClass& theCIMClass, const char* nameSpaceName=0);
|
69 thilo.boehm 1.1.2.1
70 /**
71 * Copy constructor for the SCMO instance, used to implement refcounting.
72 * @param theSCMOClass The instance for which to create a copy
73 * @return
74 */
75 SCMOInstance(const SCMOInstance& theSCMOInstance )
76 {
77 inst.hdr = theSCMOInstance.inst.hdr;
78 Ref();
79 }
80
81 /**
|
82 thilo.boehm 1.1.2.35 * Constructs a SCMOInstance from a memory object of type SCMBInstance_Main.
83 * It incremets the referece counter of the memory object.
84 * @param hdr A memory object of type SCMBInstance_Main.
85 **/
86 SCMOInstance(SCMBInstance_Main* hdr)
87 {
88 inst.hdr = hdr;
89 Ref();
90 }
91
92
93 /**
|
94 thilo.boehm 1.1.2.33 * Assignment operator for the SCMO instance,
95 * @param theSCMOClass The right hand value
96 **/
97 SCMOInstance& operator=(const SCMOInstance& theSCMOInstance)
98 {
99 if (inst.hdr != theSCMOInstance.inst.hdr)
100 {
101 Unref();
102 inst.hdr = theSCMOInstance.inst.hdr;
103 Ref();
104 }
105 return *this;
106 }
107
108 /**
|
109 thilo.boehm 1.1.2.1 * Destructor is decrementing the refcount. If refcount is zero, the
110 * singele chunk memory object is deallocated.
111 */
112 ~SCMOInstance()
113 {
114 Unref();
115 }
116
117 /**
118 * Builds a SCMOInstance based on this SCMOClass.
119 * The method arguments determine whether qualifiers are included,
120 * the class origin attributes are included,
121 * and which properties are included in the new instance.
122 * @param baseClass The SCMOClass of this instance.
123 * @param includeQualifiers A Boolean indicating whether qualifiers in
124 * the class definition (and its properties) are to be added to the
125 * instance. The TOINSTANCE flavor is ignored.
126 * @param includeClassOrigin A Boolean indicating whether ClassOrigin
127 * attributes are to be added to the instance.
128 * @param propertyList Is an NULL terminated array of char* to property
129 * names defining the properties that are included in the created instance.
130 thilo.boehm 1.1.2.1 * If the propertyList is NULL, all properties are included to the instance.
131 * If the propertyList is empty, no properties are added.
132 *
133 * Note that this function does NOT generate an error if a property name
134 * is supplied that is NOT in the class;
135 * it simply does not add that property to the instance.
136 *
137 */
138 SCMOInstance(
|
139 thilo.boehm 1.1.2.32 SCMOClass& baseClass,
|
140 thilo.boehm 1.1.2.1 Boolean includeQualifiers,
141 Boolean includeClassOrigin,
142 const char** propertyList);
143
144 /**
145 * Builds a SCMOInstance from the given SCMOClass and copies all
146 * CIMInstance data into the new SCMOInstance.
147 * @param baseClass The SCMOClass of this instance.
148 * @param cimInstance A CIMInstace of the same class.
|
149 thilo.boehm 1.1.2.32 * @exception Exception if class name does not match.
|
150 thilo.boehm 1.1.2.4 * @exception Exception if a property is not part of class definition.
151 * @exception Exception if a property does not match the class definition.
|
152 thilo.boehm 1.1.2.1 */
|
153 thilo.boehm 1.1.2.32 SCMOInstance(SCMOClass& baseClass, const CIMInstance& cimInstance);
|
154 thilo.boehm 1.1.2.1
155 /**
|
156 thilo.boehm 1.1.2.4 * Builds a SCMOInstance from the given SCMOClass and copies all
157 * CIMObjectPath data into the new SCMOInstance.
158 * @param baseClass The SCMOClass of this instance.
159 * @param cimInstance A CIMObjectpath of the same class.
|
160 thilo.boehm 1.1.2.32 * @exception Exception if class name does not match.
161 */
162 SCMOInstance(SCMOClass& baseClass, const CIMObjectPath& cimObj);
163
164 /**
165 * Builds a SCMOInstance from the given CIMInstance copying all data.
166 * The SCMOClass is retrieved from SCMOClassCache using
167 * the class and name space of the CIMInstance.
168 * If the SCMOClass was not found, an empty SCMOInstance will be returned
169 * and the resulting SCMOInstance is compromized.
170 * If the CIMInstance does not contain a name space, the optional fall back
171 * name space is used.
172 * @param cimInstance A CIMInstace with class name and name space.
173 * @param altNameSpace An alternative name space name.
174 * @exception Exception if a property is not part of class definition.
175 * @exception Exception if a property does not match the class definition.
|
176 thilo.boehm 1.1.2.4 */
|
177 thilo.boehm 1.1.2.32 SCMOInstance(
178 const CIMInstance& cimInstance,
179 const char* altNameSpace=0,
180 Uint64 altNSLen=0);
181
182 /**
183 * Builds a SCMOInstance from the given CIMObjectPath copying all data.
184 * The SCMOClass is retrieved from SCMOClassCache using
185 * the class and name space of the CIMObjectPath.
186 * If the SCMOClass was not found, an empty SCMOInstance will be returned
187 * and the resulting SCMOInstance is compromized.
188 * If the CIMObjectPath does not contain a name space,
189 * the optional fall back name space is used.
190 * @param cimObj A CIMObjectpath with name space and name
191 * @param altNameSpace An alternative name space name.
192 * @
193 */
194 SCMOInstance(
195 const CIMObjectPath& cimObj,
196 const char* altNameSpace=0,
197 Uint64 altNSLen=0);
198 thilo.boehm 1.1.2.32
199 /**
200 * Builds a SCMOInstance from the given CIMObject copying all data.
201 * The SCMOClass is retrieved from SCMOClassCache using
202 * the class and name space of the CIMObject.
203 * If the SCMOClass was not found, an empty SCMOInstance will be returned
204 * and the resulting SCMOInstance is compromized.
205 * If the CIMInstance does not contain a name space, the optional fall back
206 * name space is used.
207 * @param cimInstance A CIMInstace with class name and name space.
208 * @param altNameSpace An alternative name space name.
209 * @exception Exception if a property is not part of class definition.
210 * @exception Exception if a property does not match the class definition.
211 */
212 SCMOInstance(
213 const CIMObject& cimObject,
214 const char* altNameSpace=0,
215 Uint64 altNSLen=0);
|
216 thilo.boehm 1.1.2.4
217 /**
|
218 thilo.boehm 1.1.2.1 * Converts the SCMOInstance into a CIMInstance.
219 * It is a deep copy of the SCMOInstance into the CIMInstance.
220 * @param cimInstance An empty CIMInstance.
221 */
|
222 thilo.boehm 1.1.2.6 SCMO_RC getCIMInstance(CIMInstance& cimInstance) const;
|
223 thilo.boehm 1.1.2.1
224 /**
225 * Makes a deep copy of the instance.
226 * This creates a new copy of the instance.
|
227 thilo.boehm 1.1.2.5 * @param objectPathOnly If set to true, only the object path relevant parts
228 * host name and key bindings are part of the cloned instance.
|
229 thilo.boehm 1.1.2.1 * @return A new copy of the SCMOInstance object.
230 */
|
231 thilo.boehm 1.1.2.5 SCMOInstance clone(Boolean objectPathOnly = false) const;
|
232 thilo.boehm 1.1.2.1
233 /**
|
234 r.kieninger 1.1.2.9 * Retrieves the objectpath part of the SCMOInstance as an instance
235 * of class CIMObjectPath. .
236 * @param cimObj Reference to an instantiated CIMObjectPath to be
237 * populated with the data from the SCMOInstance.
238 * @return void
239 */
240 void getCIMObjectPath(CIMObjectPath& cimObj) const;
241
242 /**
|
243 thilo.boehm 1.1.2.1 * Returns the number of properties of the instance.
244 * @param Number of properties
245 */
246 Uint32 getPropertyCount() const;
247
248 /**
249 * Gets the property name, type, and value addressed by a positional index.
250 * The property name and value has to be copied by the caller !
251 * @param pos The positional index of the property
252 * @param pname Returns the property name as '\0' terminated string.
253 * Has to be copied by caller.
254 * It is set to NULL if rc != SCMO_OK.
255 * @param pvalue Returns a pointer to the value of property.
|
256 thilo.boehm 1.1.2.13 * The value is strored in a SCMBUnion
257 * and has to be copied by the caller !
|
258 thilo.boehm 1.1.2.1 * It returns NULL if rc != SCMO_OK.
|
259 thilo.boehm 1.1.2.24 *
|
260 thilo.boehm 1.1.2.1 * If the value is an array, the
261 * value array is stored in continuous memory.
|
262 thilo.boehm 1.1.2.13 * e.g. (SCMBUnion*)value[0 to size-1]
|
263 thilo.boehm 1.1.2.24 *
264 * If the value is type of CIMTYPE_STRING,
265 * the string is referenced by the structure
266 * SCMBUnion.extString:
267 * pchar contains the absolut pointer to the string
268 * length contains the size of the string
|
269 thilo.boehm 1.1.2.13 * without trailing '\0'.
270 * Only for strings the caller has to free pvalue !
|
271 thilo.boehm 1.1.2.1 * @param type Returns the CIMType of the property
272 * It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.
273 * @param isArray Returns if the value is an array.
274 * It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.
275 * @param size Returns the size of the array.
276 * If it is not an array, 0 is returned.
277 * It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.
278 *
279 * @return SCMO_OK
280 * SCMO_NULL_VALUE : The value is a null value.
281 * SCMO_INDEX_OUT_OF_BOUND : Given index not found
282 *
283 */
284 SCMO_RC getPropertyAt(
285 Uint32 pos,
286 const char** pname,
287 CIMType& type,
|
288 thilo.boehm 1.1.2.13 const SCMBUnion** pvalue,
|
289 thilo.boehm 1.1.2.1 Boolean& isArray,
290 Uint32& size ) const;
291
292 /**
293 * Gets the type and value of the named property.
294 * The value has to be copied by the caller !
295 * @param name The property name
296 * @param pvalue Returns a pointer to the value of property.
|
297 thilo.boehm 1.1.2.13 * The value is strored in a SCMBUnion
298 * and has to be copied by the caller !
|
299 thilo.boehm 1.1.2.1 * It returns NULL if rc != SCMO_OK.
|
300 thilo.boehm 1.1.2.24 *
|
301 thilo.boehm 1.1.2.1 * If the value is an array, the
302 * value array is stored in continuous memory.
|
303 thilo.boehm 1.1.2.13 * e.g. (SCMBUnion*)value[0 to size-1]
|
304 thilo.boehm 1.1.2.24 *
305 * If the value is type of CIMTYPE_STRING,
306 * the string is referenced by the structure
307 * SCMBUnion.extString:
308 * pchar contains the absolut pointer to the string
309 * length contains the size of the string
|
310 thilo.boehm 1.1.2.13 * without trailing '\0'.
311 * Only for strings the caller has to free pvalue !
|
312 thilo.boehm 1.1.2.1 * @param type Returns the CIMType of the property
313 * It is invalid if rc == SCMO_NOT_FOUND.
314 * @param isArray Returns if the value is an array.
315 * It is invalid if rc == SCMO_NOT_FOUND.
316 * @param size Returns the size of the array.
317 * If it is not an array, 0 is returned.
318 * It is invalid if rc == SCMO_NOT_FOUND.
319 *
320 * @return SCMO_OK
321 * SCMO_NULL_VALUE : The value is a null value.
322 * SCMO_NOT_FOUND : Given property name not found.
323 */
324 SCMO_RC getProperty(
325 const char* name,
326 CIMType& type,
|
327 thilo.boehm 1.1.2.13 const SCMBUnion** pvalue,
|
328 thilo.boehm 1.1.2.1 Boolean& isArray,
329 Uint32& size ) const;
330
331 /**
332 * Set/replace a property in the instance.
333 * If the class origin is specified, it is honored at identifying
334 * the property within the instance.
335 * Note: Only properties which are already part of the instance/class can
336 * be set/replaced.
337 * @param name The name of the property to be set.
338 * @param type The CIMType of the property
|
339 thilo.boehm 1.1.2.13 * @param value A pointer to the value to be set at the named property.
340 * The value has to be in a SCMBUnion.
341 * The value is copied into the instance
342 * If the value == NULL, a null value is assumed.
|
343 thilo.boehm 1.1.2.24 * If the value is an array, the value array has to be
|
344 thilo.boehm 1.1.2.13 * stored in continuous memory.
345 * e.g. (SCMBUnion*)value[0 to size-1]
|
346 thilo.boehm 1.1.2.24 *
347 * To store an array of size 0, The value pointer has to
|
348 thilo.boehm 1.1.2.13 * not NULL ( value != NULL ) but the size has to be 0
349 * (size == 0).
|
350 thilo.boehm 1.1.2.24 *
351 * If the value is type of CIMTYPE_STRING,
352 * the string is referenced by the structure
353 * SCMBUnion.extString:
354 * pchar contains the absolut pointer to the string
355 * length contains the size of the string
|
356 thilo.boehm 1.1.2.13 * without trailing '\0'.
|
357 thilo.boehm 1.1.2.1 * @param isArray Indicate that the value is an array. Default false.
358 * @param size Returns the size of the array. If not an array this
359 * this parameter is ignorer. Default 0.
360 * @param origin The class originality of the property.
361 * If NULL, then it is ignorred. Default NULL.
362 * @return SCMO_OK
363 * SCMO_NOT_SAME_ORIGIN : The property name was found, but
364 * the origin was not the same.
365 * SCMO_NOT_FOUND : Given property name not found.
366 * SCMO_WRONG_TYPE : Named property has the wrong type.
367 * SCMO_NOT_AN_ARRAY : Named property is not an array.
368 * SCMO_IS_AN_ARRAY : Named property is an array.
369 */
370 SCMO_RC setPropertyWithOrigin(
371 const char* name,
372 CIMType type,
|
373 thilo.boehm 1.1.2.14 const SCMBUnion* value,
|
374 thilo.boehm 1.1.2.1 Boolean isArray=false,
375 Uint32 size = 0,
376 const char* origin = NULL);
377
378 /**
|
379 thilo.boehm 1.1.2.3 * Rebuild of the key bindings from the property values
|
380 thilo.boehm 1.1.2.1 * if no or incomplete key properties are set on the instance.
|
381 thilo.boehm 1.1.2.3 * @exception NoSuchProperty
|
382 thilo.boehm 1.1.2.1 */
|
383 thilo.boehm 1.1.2.2 void buildKeyBindingsFromProperties();
|
384 thilo.boehm 1.1.2.1
385 /**
386 * Set/replace a property filter on an instance.
387 * The filter is a white list of property names.
388 * A property part of the list can be accessed by name or index and
389 * is eligible to be returned to requester.
390 * Key properties can not be filtered. They are always a part of the
391 * instance. If a key property is not part of the property list,
392 * it will not be filtered out.
393 * @param propertyList Is an NULL terminated array of char* to
394 * property names
395 */
396 void setPropertyFilter(const char **propertyList);
397
398 /**
399 * Gets the hash index for the named property. Filtering is ignored.
400 * @param theName The property name
401 * @param pos Returns the hash index.
402 * @return SCMO_OK
403 * SCMO_INVALID_PARAMETER: name was a NULL pointer.
404 * SCMO_NOT_FOUND : Given property name not found.
405 thilo.boehm 1.1.2.1 */
406 SCMO_RC getPropertyNodeIndex(const char* name, Uint32& pos) const;
407
408 /**
409 * Set/replace a property in the instance at node index.
|
410 thilo.boehm 1.1.2.4 * Note: If node is filtered, the property is not set but the return value
|
411 thilo.boehm 1.1.2.1 * is still SCMO_OK.
412 * @param index The node index.
413 * @param type The CIMType of the property
|
414 thilo.boehm 1.1.2.13 * @param pInVal A pointer to the value to be set at the named property.
415 * The value has to be in a SCMBUnion.
416 * The value is copied into the instance
417 * If the value == NULL, a null value is assumed.
|
418 thilo.boehm 1.1.2.24 * If the value is an array, the value array has to be
|
419 thilo.boehm 1.1.2.13 * stored in continuous memory.
420 * e.g. (SCMBUnion*)value[0 to size-1]
|
421 thilo.boehm 1.1.2.24 *
422 * To store an array of size 0, The value pointer has to
|
423 thilo.boehm 1.1.2.13 * not NULL ( value != NULL ) but the size has to be 0
424 * (size == 0).
|
425 thilo.boehm 1.1.2.24 *
426 * If the value is type of CIMTYPE_STRING,
427 * the string is referenced by the structure
428 * SCMBUnion.extString:
429 * pchar contains the absolut pointer to the string
430 * length contains the size of the string
|
431 thilo.boehm 1.1.2.13 * without trailing '\0'.
|
432 thilo.boehm 1.1.2.1 * @param isArray Indicate that the value is an array. Default false.
433 * @param size The size of the array. If not an array this
434 * this parameter is ignorer. Default 0.
435 * @return SCMO_OK
436 * SCMO_INDEX_OUT_OF_BOUND : Given index not found
437 * SCMO_WRONG_TYPE : The property at given node index
438 * has the wrong type.
439 * SCMO_NOT_AN_ARRAY : The property at given node index
440 * is not an array.
441 * SCMO_IS_AN_ARRAY : The property at given node index
442 * is an array.
443 */
444 SCMO_RC setPropertyWithNodeIndex(
445 Uint32 node,
446 CIMType type,
|
447 thilo.boehm 1.1.2.14 const SCMBUnion* pInVal,
|
448 thilo.boehm 1.1.2.1 Boolean isArray=false,
449 Uint32 size = 0);
450
451 /**
|
452 r.kieninger 1.1.2.10 * Set/replace the named key binding using binary data
453 * @param name The key binding name.
454 * @param type The type as CIMType.
|
455 thilo.boehm 1.1.2.12 * @param keyvalue A pointer to the binary key value.
|
456 r.kieninger 1.1.2.10 * The value is copied into the instance
457 * If the value == NULL, a null value is assumed.
|
458 thilo.boehm 1.1.2.13 * @param keyvalue A pointer to the value to be set at the key binding,
459 * The keyvalue has to be in a SCMBUnion.
460 * The keyvalue is copied into the instance.
461 * If the keyvalue == NULL, a null value is assumed.
|
462 thilo.boehm 1.1.2.24 *
463 * If the keyvalue is type of CIMTYPE_STRING,
464 * the string is referenced by the structure
465 * SCMBUnion.extString:
466 * pchar contains the absolut pointer to the string
467 * length contains the size of the string
|
468 thilo.boehm 1.1.2.13 * without trailing '\0'.
|
469 r.kieninger 1.1.2.10 * @return SCMO_OK
470 * SCMO_INVALID_PARAMETER : Given name or pvalue
471 * is a NULL pointer.
472 * SCMO_TYPE_MISSMATCH : Given type does not
473 * match to key binding type
474 * SCMO_NOT_FOUND : Given property name not found.
475 */
476 SCMO_RC setKeyBinding(
477 const char* name,
478 CIMType type,
|
479 thilo.boehm 1.1.2.14 const SCMBUnion* keyvalue);
|
480 r.kieninger 1.1.2.10
481 /**
482 * Set/replace the key binding at node
|
483 thilo.boehm 1.1.2.7 * @param node The node index of the key.
|
484 r.kieninger 1.1.2.10 * @param type The type as CIMType.
|
485 thilo.boehm 1.1.2.13 * @param keyvalue A pointer to the value to be set at the key binding,
486 * The keyvalue has to be in a SCMBUnion.
487 * The keyvalue is copied into the instance.
488 * If the keyvalue == NULL, a null value is assumed.
|
489 thilo.boehm 1.1.2.24 *
490 * If the keyvalue is type of CIMTYPE_STRING,
491 * the string is referenced by the structure
492 * SCMBUnion.extString:
493 * pchar contains the absolut pointer to the string
494 * length contains the size of the string
|
495 thilo.boehm 1.1.2.13 * without trailing '\0'.
|
496 r.kieninger 1.1.2.10 * @return SCMO_OK
497 * SCMO_INVALID_PARAMETER : Given pvalue is a NULL pointer.
498 * SCMO_TYPE_MISSMATCH : Given type does not
499 * match to key binding type
500 * SCMO_INDEX_OUT_OF_BOUND : Given index is our of range.
501 */
502 SCMO_RC setKeyBindingAt(
503 Uint32 node,
504 CIMType type,
|
505 thilo.boehm 1.1.2.14 const SCMBUnion* keyvalue);
|
506 r.kieninger 1.1.2.10
507 /**
|
508 thilo.boehm 1.1.2.31 * Clears all key bindings in an instance.
509 * Warning: External references are freed but only the internal
510 * control structures are resetted. No memory is freed and at setting
511 * new key bindings the instance will grow in memory usage.
512 **/
513 void clearKeyBindings();
514
515 /**
|
516 thilo.boehm 1.1.2.1 * Gets the key binding count.
517 * @return the number of key bindings set.
518 */
|
519 marek 1.1.2.11 Uint32 getKeyBindingCount() const;
|
520 thilo.boehm 1.1.2.1
521 /**
522 * Get the indexed key binding.
523 * @parm idx The key bining index
524 * @parm pname Returns the name.
525 * Has to be copied by caller.
526 * It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.
|
527 thilo.boehm 1.1.2.12 * @param type Returns the type as CIMType.
|
528 thilo.boehm 1.1.2.1 * It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.
|
529 thilo.boehm 1.1.2.12 * @param keyvalue A pointer to the binary key value.
|
530 thilo.boehm 1.1.2.1 * Has to be copied by caller.
531 * It is only valid if rc == SCMO_OK.
532 * @return SCMO_OK
533 * SCMO_NULL_VALUE : The key binding is not set.
534 * SCMO_INDEX_OUT_OF_BOUND : Given index not found
535 *
536 */
537 SCMO_RC getKeyBindingAt(
538 Uint32 idx,
539 const char** pname,
|
540 thilo.boehm 1.1.2.12 CIMType& type,
|
541 thilo.boehm 1.1.2.13 const SCMBUnion** keyvalue) const;
|
542 thilo.boehm 1.1.2.1
543 /**
544 * Get the named key binding.
545 * @parm name The name of the key binding.
|
546 thilo.boehm 1.1.2.12 * @param type Returns the type as CIMType.
|
547 thilo.boehm 1.1.2.1 * It is invalid if rc == SCMO_INDEX_OUT_OF_BOUND.
|
548 thilo.boehm 1.1.2.13 * @param keyvalue Returns a pointer to the value of keybinding.
549 * The value is strored in a SCMBUnion
550 * and has to be copied by the caller !
551 * It returns NULL if rc != SCMO_OK.
|
552 thilo.boehm 1.1.2.24 *
553 * If the value is type of CIMTYPE_STRING,
554 * the string is referenced by the structure
555 * SCMBUnion.extString:
556 * pchar contains the absolut pointer to the string
557 * length contains the size of the string
|
558 thilo.boehm 1.1.2.13 * without trailing '\0'.
559 * Only for strings the caller has to free pvalue !
|
560 thilo.boehm 1.1.2.12 * @param keyvalue A pointer to the binary key value.
|
561 thilo.boehm 1.1.2.1 * Has to be copied by caller.
562 * It is only valid if rc == SCMO_OK.
563 * @return SCMO_OK
564 * SCMO_NULL_VALUE : The key binding is not set.
565 * SCMO_NOT_FOUND : Given property name not found.
566 */
567 SCMO_RC getKeyBinding(
568 const char* name,
|
569 thilo.boehm 1.1.2.12 CIMType& ptype,
|
570 thilo.boehm 1.1.2.13 const SCMBUnion** keyvalue) const;
|
571 thilo.boehm 1.1.2.1
572 /**
|
573 thilo.boehm 1.1.2.24 * Determines whether the c++ object has been initialized.
574 * @return True if the c++ object has not been initialized, false otherwise.
|
575 thilo.boehm 1.1.2.1 */
|
576 thilo.boehm 1.1.2.17 Boolean isUninitialized( ) const {return (0 == inst.base); };
|
577 thilo.boehm 1.1.2.1
578 /**
|
579 thilo.boehm 1.1.2.32 * Determines if the SCMOInstance does not contain any property information.
580 * Maybe only the class name and/or name space are available.
581 * @return True if the SCMOInstacne is empty, false otherwise.
582 */
583 Boolean isEmpty( ) const {return (inst.hdr->theClass->isEmpty()); };
584
585 /**
|
586 thilo.boehm 1.1.2.24 * Determines whether the instance is used as a class container.
587 * @return True if the instance is used as a class container only.
588 */
|
589 thilo.boehm 1.1.2.25 Boolean getIsClassOnly( ) const
|
590 thilo.boehm 1.1.2.24 {
591 return inst.hdr->flags.isClassOnly;
592 }
593
594 /**
|
595 thilo.boehm 1.1.2.25 * To mark if this instance is a class only container.
|
596 thilo.boehm 1.1.2.24 */
|
597 thilo.boehm 1.1.2.25 void setIsClassOnly( Boolean b )
|
598 thilo.boehm 1.1.2.24 {
|
599 thilo.boehm 1.1.2.25 inst.hdr->flags.isClassOnly = b;
|
600 thilo.boehm 1.1.2.24 }
601
602 /**
|
603 thilo.boehm 1.1.2.1 * Determies if two objects are referencing to the same instance
604 * @return True if the objects are referencing to the some instance.
605 */
606 Boolean isSame(SCMOInstance& theInstance) const;
607
608 /**
|
609 thilo.boehm 1.1.2.21 * Sets the provided host name at the instance.
610 * @param hostName The host name as UTF8.
611 */
612 void setHostName(const char* hostName);
613
614 /**
|
615 thilo.boehm 1.1.2.26 * Sets the provided host name unchecked at the instance.
616 * @param hostName The host name as UTF8.
617 * @param len The strlen of the host name.
618 */
|
619 thilo.boehm 1.1.2.32 void setHostName_l(const char* hostName, Uint64 len);
|
620 thilo.boehm 1.1.2.26
621 /**
|
622 thilo.boehm 1.1.2.1 * Get the host name of the instance. The caller has to make a copy !
623 * @return The host name as UTF8.
624 */
625 const char* getHostName() const;
626
627 /**
|
628 thilo.boehm 1.1.2.21 * Get the host name of the instance.
|
629 thilo.boehm 1.1.2.27 * @param Return strlen of result string.
|
630 thilo.boehm 1.1.2.21 * @return The class name as UTF8.
|
631 thilo.boehm 1.1.2.1 */
|
632 thilo.boehm 1.1.2.21 const char* getHostName_l(Uint64 & length) const;
633
|
634 thilo.boehm 1.1.2.24 /**
|
635 thilo.boehm 1.1.2.21 * Sets the provided class name at the instance. By caling this function
|
636 thilo.boehm 1.1.2.24 * the instance is in an inconsitacne state and is maked as isCompromised.
|
637 thilo.boehm 1.1.2.21 * @param className The class name as UTF8.
638 */
639 void setClassName(const char* className);
|
640 thilo.boehm 1.1.2.1
641 /**
|
642 marek 1.1.2.30 * Sets the provided class name at the instance. By caling this function
643 * the instance is in an inconsitacne state and is maked as isCompromised.
644 * @param className The class name as UTF8.
645 * @param len The strlen of the name space.
646 */
647 void setClassName_l(const char* className, Uint64 len);
648
649 /**
|
650 marek 1.1.2.11 * Get the class name of the instance. The caller has to make a copy !
|
651 thilo.boehm 1.1.2.1 * @return The class name as UTF8.
652 */
653 const char* getClassName() const;
654
655 /**
|
656 marek 1.1.2.11 * Get the class name of the instance. The caller has to make a copy !
|
657 thilo.boehm 1.1.2.32 * @param lenght Return strlen of result string.
|
658 thilo.boehm 1.1.2.21 * @return The class name as UTF8.
|
659 marek 1.1.2.11 */
660 const char* getClassName_l(Uint64 & length) const;
661
|
662 thilo.boehm 1.1.2.24 /**
663 * Sets the provided name space name at the instance.
664 * By caling this function the instance is in an inconsitacne state and
665 * is maked as isCompromised.
|
666 thilo.boehm 1.1.2.21 * @param nameSpaceName The name space name as UTF8.
667 */
668 void setNameSpace(const char* nameSpace);
669
|
670 marek 1.1.2.11 /**
|
671 thilo.boehm 1.1.2.26 * Sets the provided name space name unchecked at the instance.
672 * By caling this function the instance is in an inconsitacne state and
673 * is maked as isCompromised.
674 * @param nameSpaceName The name space name as UTF8.
675 * @param len The strlen of the name space.
676 */
|
677 thilo.boehm 1.1.2.32 void setNameSpace_l(const char* nameSpace, Uint64 len);
|
678 thilo.boehm 1.1.2.26
679 /**
|
680 thilo.boehm 1.1.2.1 * Get the name space of the instance. The caller has to make a copy !
681 * @return The name space as UTF8.
682 */
683 const char* getNameSpace() const;
684
685 /**
|
686 thilo.boehm 1.1.2.21 * Get the class name of the instance. The caller has to make a copy !
|
687 thilo.boehm 1.1.2.27 * @param Return strlen of result string.
|
688 thilo.boehm 1.1.2.21 * @return The class name as UTF8.
689 */
690 const char* getNameSpace_l(Uint64 & length) const;
691
|
692 thilo.boehm 1.1.2.24 /**
|
693 thilo.boehm 1.1.2.21 * Is the name space or class name of the instance the origianl values
694 * set by the used SCMOClass.
695 * The class name and/or name space may differ with the associated class.
|
696 thilo.boehm 1.1.2.24 * @return true if name space or class name was set manually by
|
697 thilo.boehm 1.1.2.21 * setNameSpace() or setClassName()
698 */
|
699 thilo.boehm 1.1.2.22 Boolean isCompromised() const
|
700 thilo.boehm 1.1.2.21 {
701 return inst.hdr->flags.isCompromised;
|
702 thilo.boehm 1.1.2.22 };
|
703 thilo.boehm 1.1.2.21
|
704 thilo.boehm 1.1.2.23
|
705 thilo.boehm 1.1.2.24 /**
|
706 thilo.boehm 1.1.2.23 * Mark the instance as a non validated instance.
707 */
|
708 thilo.boehm 1.1.2.24 void markAsCompromised()
|
709 thilo.boehm 1.1.2.23 {
710 inst.hdr->flags.isCompromised = true;
711 };
712
|
713 thilo.boehm 1.1.2.21 /**
|
714 thilo.boehm 1.1.2.1 * To indicate the export processing ( eg. XMLWriter )
715 * to include qualifiers for this instance.
716 */
717 void includeQualifiers()
718 {
719 inst.hdr->flags.includeQualifiers = true;
720 };
721
722 /**
723 * To indicate the export processing ( eg. XMLWriter )
724 * to NOT to include (exclude) qualifiers for this instance.
725 */
726 void excludeQualifiers()
727 {
728 inst.hdr->flags.includeQualifiers = false;
729 }
730
731 /**
732 * To indicate the export processing ( eg. XMLWriter )
733 * to include class origins for this instance.
734 */
735 thilo.boehm 1.1.2.1 void includeClassOrigins()
736 {
737 inst.hdr->flags.includeClassOrigin = true;
738 };
739
740 /**
741 * To indicate the export processing ( eg. XMLWriter )
742 * to NOT to include (exclude) class origins for this instance.
743 */
744 void excludeClassOrigins()
745 {
746 inst.hdr->flags.includeClassOrigin = false;
747 }
748
|
749 thilo.boehm 1.1.2.36
750 /**
751 * Returns the number of external references hosted by the instance.
752 **/
753 Uint32 numberExtRef()
754 {
755 return inst.mem->numberExtRef;
756 }
757
758 /**
759 * Gets the pointer of an external reference of the instance.
760 * Warning: The pointer is purely returned. No management is done.
761 * @parm idx The index of the external reference.
762 **/
763 SCMOInstance* getExtRef(Uint32 idx);
764
765 /**
766 * Sets a pointer of an external reference of the instance.
767 * Warning: The pointer is purely returned. No management is done.
768 * @parm idx The index of the external reference.
769 * @parm ptr The pointer to an SCMOInstance
770 thilo.boehm 1.1.2.36 **/
771 void putExtRef(Uint32 idx,SCMOInstance* ptr);
772
|
773 thilo.boehm 1.1.2.1 private:
774
775 void Ref()
776 {
777 inst.hdr->refCount++;
778 // printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get());
779 };
780
|
781 thilo.boehm 1.1.2.17 void Unref()
782 {
783 if (inst.hdr->refCount.decAndTestIfZero())
784 {
785 // printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get());
786 // All external references has to be destroyed.
787 _destroyExternalReferences();
788 // The class has also be dereferenced.
789 delete inst.hdr->theClass;
790 free(inst.base);
791 inst.base=NULL;
792 }
793 else
794 {
795 // printf("\ninst.hdr->refCount=%u\n",inst.hdr->refCount.get());
796 }
797
798 };
799
|
800 thilo.boehm 1.1.2.16
801 void _destroyExternalReferences();
|
802 thilo.boehm 1.1.2.1
|
803 thilo.boehm 1.1.2.31 void _destroyExternalKeyBindings();
804
|
805 thilo.boehm 1.1.2.20 void _copyExternalReferences();
806
|
807 thilo.boehm 1.1.2.34 void _setExtRefIndex(Uint64 idx);
808
|
809 thilo.boehm 1.1.2.15 void _initSCMOInstance(SCMOClass* pClass);
|
810 thilo.boehm 1.1.2.1
|
811 thilo.boehm 1.1.2.15 void _setCIMInstance(const CIMInstance& cimInstance);
|
812 thilo.boehm 1.1.2.1
|
813 marek 1.1.2.28 void _getPropertyAt(
814 Uint32 pos,
815 SCMBValue** value,
816 const char ** valueBase,
817 SCMBClassProperty ** propDef) const;
818
|
819 thilo.boehm 1.1.2.1 SCMO_RC _getPropertyAtNodeIndex(
|
820 thilo.boehm 1.1.2.15 Uint32 pos,
821 const char** pname,
822 CIMType& type,
823 const SCMBUnion** pvalue,
824 Boolean& isArray,
825 Uint32& size ) const;
|
826 thilo.boehm 1.1.2.1
827 void _setPropertyAtNodeIndex(
828 Uint32 pos,
829 CIMType type,
|
830 thilo.boehm 1.1.2.14 const SCMBUnion* pInVal,
|
831 thilo.boehm 1.1.2.1 Boolean isArray,
832 Uint32 size);
833
|
834 thilo.boehm 1.1.2.21 void _setCIMValueAtNodeIndex(
|
835 thilo.boehm 1.1.2.24 Uint32 node,
|
836 thilo.boehm 1.1.2.21 CIMValueRep* valRep,
837 CIMType realType);
|
838 thilo.boehm 1.1.2.4
|
839 thilo.boehm 1.1.2.16 static void _getCIMValueFromSCMBUnion(
|
840 thilo.boehm 1.1.2.12 CIMValue& cimV,
841 const CIMType type,
842 const Boolean isNull,
843 const Boolean isArray,
844 const Uint32 arraySize,
845 const SCMBUnion& scmbUn,
|
846 thilo.boehm 1.1.2.16 const char * base);
|
847 thilo.boehm 1.1.2.12
|
848 thilo.boehm 1.1.2.16 static void _getCIMValueFromSCMBValue(
|
849 thilo.boehm 1.1.2.6 CIMValue& cimV,
850 const SCMBValue& scmbV,
|
851 thilo.boehm 1.1.2.16 const char * base);
|
852 thilo.boehm 1.1.2.6
|
853 thilo.boehm 1.1.2.32 static SCMOClass _getSCMOClass(
854 const CIMObjectPath& theCIMObj,
855 const char* altNS,
856 Uint64 altNSlength);
857
|
858 thilo.boehm 1.1.2.6 CIMProperty _getCIMPropertyAtNodeIndex(Uint32 nodeIdx) const;
859
|
860 thilo.boehm 1.1.2.4 void _setCIMObjectPath(const CIMObjectPath& cimObj);
861
|
862 thilo.boehm 1.1.2.13 SCMBUnion* _resolveSCMBUnion(
|
863 thilo.boehm 1.1.2.1 CIMType type,
864 Boolean isArray,
865 Uint32 size,
866 Uint64 start,
867 char* base) const;
868
869 void _setSCMBUnion(
|
870 thilo.boehm 1.1.2.14 const SCMBUnion* pInVal,
|
871 thilo.boehm 1.1.2.1 CIMType type,
872 Boolean isArray,
873 Uint32 size,
|
874 thilo.boehm 1.1.2.12 SCMBUnion & u);
|
875 thilo.boehm 1.1.2.1
|
876 thilo.boehm 1.1.2.16 static void _setUnionValue(
|
877 thilo.boehm 1.1.2.4 Uint64 start,
878 SCMBMgmt_Header** pmem,
879 CIMType type,
|
880 thilo.boehm 1.1.2.21 Uint64 startNS,
881 Uint64 lenNS,
|
882 thilo.boehm 1.1.2.4 Union& u);
883
|
884 thilo.boehm 1.1.2.12 static void _setUnionArrayValue(
|
885 thilo.boehm 1.1.2.4 Uint64 start,
886 SCMBMgmt_Header** pmem,
887 CIMType type,
888 Uint32& n,
|
889 thilo.boehm 1.1.2.21 Uint64 startNS,
890 Uint64 lenNS,
|
891 thilo.boehm 1.1.2.4 Union& u);
892
|
893 thilo.boehm 1.1.2.34 static void _setExtRefIndex(SCMBUnion* pInst, SCMBMgmt_Header** pmem);
894
|
895 thilo.boehm 1.1.2.12 SCMO_RC _getKeyBindingDataAtNodeIndex(
|
896 marek 1.1.2.11 Uint32 node,
897 const char** pname,
898 Uint32 & pnameLen,
|
899 thilo.boehm 1.1.2.12 CIMType& type,
900 const SCMBUnion** pdata) const;
|
901 marek 1.1.2.11
|
902 thilo.boehm 1.1.2.5 void _copyKeyBindings(SCMOInstance& targetInst) const;
903
|
904 thilo.boehm 1.1.2.1 Uint32 _initPropFilterWithKeys();
905
906 void _setPropertyInPropertyFilter(Uint32 i);
907
908 Boolean _isPropertyInFilter(Uint32 i) const;
909
910 void _clearPropertyFilter();
911
|
912 thilo.boehm 1.1.2.3 void _setKeyBindingFromSCMBUnion(
|
913 thilo.boehm 1.1.2.4 CIMType type,
|
914 thilo.boehm 1.1.2.12 const SCMBUnion& u,
915 const char * uBase,
916 SCMBKeyBindingValue& keyData);
917
|
918 thilo.boehm 1.1.2.23 SCMO_RC _setKeyBindingFromString(
|
919 thilo.boehm 1.1.2.24 const char* name,
920 CIMType type,
|
921 thilo.boehm 1.1.2.23 String cimKeyBinding);
922
923 SCMBUserKeyBindingElement* _getUserDefinedKeyBinding(
924 const char* name,
925 Uint32 nameLen,
926 CIMType type);
927
928 void _setUserDefinedKeyBinding(
929 SCMBUserKeyBindingElement& theInsertElement,
930 char* elementBase);
931 /**
|
932 thilo.boehm 1.1.2.24 * Set a SCMO user defined key binding using the class CIM type tolerating
933 * CIM key binding types converted to CIM types by fuction
934 * _CIMTypeFromKeyBindingType().
935 *
|
936 thilo.boehm 1.1.2.23 * @parm classType The type of the key binding in the class definition
937 * @parm setType The type of the key binding to be set.
938 * @param keyValue A pointer to the key binding to be set.
939 * @param kbValue Out parameter, the SCMO keybinding to be set.
|
940 thilo.boehm 1.1.2.24 *
|
941 thilo.boehm 1.1.2.23 **/
942 SCMO_RC _setKeyBindingTypeTolerate(
943 CIMType classType,
944 CIMType setType,
945 const SCMBUnion* keyValue,
946 SCMBKeyBindingValue& kbValue);
947
948 CIMType _CIMTypeFromKeyBindingType(
|
949 thilo.boehm 1.1.2.24 const char* key,
|
950 thilo.boehm 1.1.2.23 CIMKeyBinding::Type t);
951
952 SCMO_RC _getUserKeyBindingNodeIndex(Uint32& node, const char* name) const;
953
954 SCMBUserKeyBindingElement* _getUserDefinedKeyBindingAt(Uint32 index) const;
|
955 thilo.boehm 1.1.2.12
|
956 thilo.boehm 1.1.2.18 Boolean _setCimKeyBindingStringToSCMOKeyBindingValue(
|
957 thilo.boehm 1.1.2.16 const String& kbs,
|
958 thilo.boehm 1.1.2.12 CIMType type,
959 SCMBKeyBindingValue& scmoKBV
960 );
961
|
962 thilo.boehm 1.1.2.2
|
963 thilo.boehm 1.1.2.1 union{
964 // To access the instance main structure
965 SCMBInstance_Main *hdr;
966 // To access the memory management header
967 SCMBMgmt_Header *mem;
968 // Generic access pointer
969 char *base;
970 }inst;
971
972 friend class SCMOClass;
973 friend class SCMODump;
|
974 thilo.boehm 1.1.2.20 friend class SCMOXmlWriter;
|
975 thilo.boehm 1.1.2.1 };
976
|
977 marek 1.1.2.29 inline void SCMOInstance::_getPropertyAt(
978 Uint32 pos,
979 SCMBValue** value,
980 const char ** valueBase,
981 SCMBClassProperty ** propDef) const
982 {
983 Uint32 node;
984 // is filtering on ?
985 if (inst.hdr->flags.isFiltered)
986 {
987 // Get absolut pointer to property filter index map of the instance
988 Uint32* propertyFilterIndexMap =
989 (Uint32*)&(inst.base[inst.hdr->propertyFilterIndexMap.start]);
990 // get the real node index of the property.
991 node = propertyFilterIndexMap[pos];
992 }
993 else
994 {
995 // the index is used as node index.
996 node = pos;
997 }
998 marek 1.1.2.29
999 SCMBValue* theInstPropNodeArray =
1000 (SCMBValue*)&(inst.base[inst.hdr->propertyArray.start]);
1001
1002 // create a pointer to property node array of the class.
1003 Uint64 idx = inst.hdr->theClass->cls.hdr->propertySet.nodeArray.start;
1004 SCMBClassPropertyNode* theClassPropNodeArray =
1005 (SCMBClassPropertyNode*)&(inst.hdr->theClass->cls.base)[idx];
1006
1007 // return the absolute pointer to the property definition
1008 *propDef= &(theClassPropNodeArray[node].theProperty);
1009
1010 // need check if property set or not, if not set use the default value
1011 if (theInstPropNodeArray[node].flags.isSet)
1012 {
1013 // return the absolute pointer to the property value in the instance
1014 *value = &(theInstPropNodeArray[node]);
1015 *valueBase = inst.base;
1016 }
1017 else
1018 {
1019 marek 1.1.2.29 // return the absolute pointer to
1020 *value = &(theClassPropNodeArray[node].theProperty.defaultValue);
1021 *valueBase = inst.hdr->theClass->cls.base;
1022 }
1023 }
|
1024 thilo.boehm 1.1.2.1
|
1025 thilo.boehm 1.1.2.19 #define PEGASUS_ARRAY_T SCMOInstance
1026 # include <Pegasus/Common/ArrayInter.h>
1027 #undef PEGASUS_ARRAY_T
1028
|
1029 thilo.boehm 1.1.2.1 PEGASUS_NAMESPACE_END
1030
1031
1032 #endif
|