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