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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2