(file) Return to SCMOInstance.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2