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

  1 karl  1.39 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.12 //
  3 karl  1.36 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.33 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.36 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.37 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.39 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.12 //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15 kumpf 1.21 // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18 mike  1.12 // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20 karl  1.39 // 
 21 kumpf 1.21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 mike  1.12 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24 kumpf 1.21 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27 mike  1.12 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34            #ifndef Pegasus_Parameter_h
 35            #define Pegasus_Parameter_h
 36            
 37            #include <Pegasus/Common/Config.h>
 38 kumpf 1.24 #include <Pegasus/Common/CIMName.h>
 39 kumpf 1.16 #include <Pegasus/Common/CIMQualifier.h>
 40            #include <Pegasus/Common/CIMType.h>
 41 kumpf 1.23 #include <Pegasus/Common/Linkage.h>
 42 mike  1.12 
 43            PEGASUS_NAMESPACE_BEGIN
 44            
 45            ////////////////////////////////////////////////////////////////////////////////
 46            //
 47            // CIMParameter
 48            //
 49            ////////////////////////////////////////////////////////////////////////////////
 50            
 51 kumpf 1.22 class Resolver;
 52 mike  1.12 class CIMConstParameter;
 53 kumpf 1.16 class CIMParameterRep;
 54 mike  1.12 
 55 kumpf 1.40 /**
 56                The CIMParameter class represents the DMTF standard CIM parameter
 57                definition.  A CIMParameter is generally defined in the context of
 58                a CIMMethod.
 59 karl  1.32     A CIM Parameter consists of:
 60 kumpf 1.40     <ul>
 61                    <li>A CIMName containing the name of the parameter
 62                    <li>A CIMType defining the parameter type
 63                    <li>A Boolean indicating whether it is an Array parameter
 64                    <li>A Uint32 indicating the size of the Array, if the parameter is an
 65                        Array parameter
 66                    <li>A CIMName containing the reference class name for this parameter,
 67                        if the parameter is of reference type
 68                    <li>Zero or more CIMQualifier objects
 69                </ul>
 70            
 71                <p>The CIMParameter class uses a shared representation model, such that
 72                multiple CIMParameter objects may refer to the same data copy.  Assignment
 73                and copy operators create new references to the same data, not distinct
 74                copies.  An update to a CIMParameter object affects all the CIMParameter
 75                objects that refer to the same data copy.  The data remains valid until
 76                all the CIMParameter objects that refer to it are destructed.  A separate
 77                copy of the data may be created using the clone method.
 78 karl  1.32 */
 79 mike  1.12 class PEGASUS_COMMON_LINKAGE CIMParameter
 80            {
 81            public:
 82            
 83 kumpf 1.40     /**
 84                    Constructs an uninitialized CIMParameter object.  A method
 85                    invocation on an uninitialized object will result in the throwing
 86                    of an UninitializedObjectException.  An uninitialized object may
 87                    be converted into an initialized object only by using the assignment
 88                    operator with an initialized object.
 89                */
 90 kumpf 1.16     CIMParameter();
 91 mike  1.12 
 92 kumpf 1.40     /**
 93                    Constructs a CIMParameter object from the value of a specified
 94                    CIMParameter object, so that both objects refer to the same data copy.
 95                    @param x The CIMParameter object from which to construct a new
 96                        CIMParameter object.
 97 david.dillard 1.38     */
 98 kumpf         1.16     CIMParameter(const CIMParameter& x);
 99 mike          1.12 
100 kumpf         1.40     /**
101                            Constructs a CIMParameter object with the specified attributes.
102                            @param name A CIMName specifying the name of the parameter.
103                            @param type A CIMType defining the parameter type.
104                            @param isArray A Boolean indicating whether it is an Array parameter.
105                            @param arraySize A Uint32 indicating the size of the Array, if the
106                                parameter is an Array parameter.  The default value of zero
107                                indicates a variable size array.
108                            @param referenceClassName A CIMName containing the reference class
109                                name for this parameter, if the parameter is of reference type.
110                            @exception TypeMismatchException If the parameter is of reference
111                                type and referenceClassName is null or if the parameter is not of
112                                reference type and referenceClassName is not null.
113                            @exception TypeMismatchException If isArray is true and arraySize is
114                                not zero.
115                            @exception UninitializedObjectException If the parameter name is null.
116 david.dillard 1.38     */
117 mike          1.12     CIMParameter(
118 david.dillard 1.38         const CIMName& name,
119                            CIMType type,
120                            Boolean isArray = false,
121                            Uint32 arraySize = 0,
122                            const CIMName& referenceClassName = CIMName());
123 kumpf         1.16 
124 kumpf         1.40     /**
125                            Destructs the CIMParameter object.
126 david.dillard 1.38     */
127 kumpf         1.16     ~CIMParameter();
128                    
129 kumpf         1.40     /**
130                            Assigns the value of the specified CIMParameter object to this object,
131                            so that both objects refer to the same data copy.
132                            @param x The CIMParameter object from which to assign this
133                                CIMParameter object.
134                            @return A reference to this CIMParameter object.
135 david.dillard 1.38     */
136 kumpf         1.16     CIMParameter& operator=(const CIMParameter& x);
137                    
138 kumpf         1.40     /**
139                            Gets the parameter name.
140                            @return A CIMName containing the name of the parameter.
141                            @exception UninitializedObjectException If the object is not
142                                initialized.
143 david.dillard 1.38     */
144                        const CIMName& getName() const;
145 mike          1.12 
146 kumpf         1.40     /**
147                            Sets the parameter name.
148                            @param name A CIMName indicating the new name for the parameter.
149                            @exception UninitializedObjectException If the object is not
150                                initialized.
151 david.dillard 1.38     */
152 kumpf         1.24     void setName(const CIMName& name);
153 mike          1.12 
154 kumpf         1.40     /**
155                            Checks whether the parameter is an Array parameter.
156                            @return True if the parameter is an Array parameter, false otherwise.
157                            @exception UninitializedObjectException If the object is not
158                                initialized.
159 david.dillard 1.38     */
160 kumpf         1.16     Boolean isArray() const;
161 kumpf         1.15 
162 kumpf         1.40     /**
163                            Gets the array size for the parameter.
164 david.dillard 1.38         @return Uint32 array size.
165 kumpf         1.40         @exception UninitializedObjectException If the object is not
166                                initialized.
167 david.dillard 1.38     */
168 kumpf         1.16     Uint32 getArraySize() const;
169                    
170 kumpf         1.40     /**
171                            Gets the reference class name for the parameter.
172                            @return A CIMName containing the reference class name for the
173                                parameter if the parameter is of reference type, a null CIMName
174                                otherwise.
175                            @exception UninitializedObjectException If the object is not
176                                initialized.
177                        */
178 david.dillard 1.38     const CIMName& getReferenceClassName() const;
179 kumpf         1.16 
180 kumpf         1.40     /**
181                            Gets the parameter type.
182                            @return A CIMType indicating the type of this parameter.
183                            @exception UninitializedObjectException If the object is not
184                                initialized.
185                        */
186                        CIMType getType() const;
187                    
188                        /**
189                            Adds a qualifier to the parameter.
190                            @param x The CIMQualifier to be added.
191                            @return A reference to this CIMParameter object.
192                            @exception AlreadyExistsException If a qualifier with the
193                                same name already exists in the CIMParameter.
194                            @exception UninitializedObjectException If the object is not
195                                initialized.
196 karl          1.32     */
197 kumpf         1.16     CIMParameter& addQualifier(const CIMQualifier& x);
198                    
199 kumpf         1.40     /**
200                            Finds a qualifier by name.
201                            @param name A CIMName specifying the name of the qualifier to be found.
202                            @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
203                            @exception UninitializedObjectException If the object is not
204                                initialized.
205 david.dillard 1.38     */
206 kumpf         1.24     Uint32 findQualifier(const CIMName& name) const;
207 mike          1.12 
208 kumpf         1.40     /**
209                            Gets the qualifier at the specified index.
210                            @param index The index of the qualifier to be retrieved.
211                            @return The CIMQualifier at the specified index.
212                            @exception IndexOutOfBoundsException If the index is outside
213                                the range of qualifiers available for the CIMParameter.
214                            @exception UninitializedObjectException If the object is not
215                                initialized.
216 david.dillard 1.38     */
217 kumpf         1.29     CIMQualifier getQualifier(Uint32 index);
218 kumpf         1.16 
219 kumpf         1.40     /**
220                            Removes a qualifier from the parameter.
221 david.dillard 1.38         @param index Index of the qualifier to be removed.
222 kumpf         1.40         @exception IndexOutOfBoundsException If the index is outside
223                                the range of qualifiers available for the CIMParameter.
224                            @exception UninitializedObjectException If the object is not
225                                initialized.
226 kumpf         1.27     */
227 kumpf         1.29     void removeQualifier (Uint32 index);
228 kumpf         1.27 
229 kumpf         1.40     /**
230                            Gets the qualifier at the specified index.
231                            @param index The index of the qualifier to be retrieved.
232                            @return The CIMConstQualifier at the specified index.
233                            @exception IndexOutOfBoundsException If the index is outside
234                                the range of qualifiers available for the CIMParameter.
235                            @exception UninitializedObjectException If the object is not
236                                initialized.
237 david.dillard 1.38     */
238 kumpf         1.29     CIMConstQualifier getQualifier(Uint32 index) const;
239 kumpf         1.16 
240 kumpf         1.40     /**
241                            Gets the number of qualifiers in the parameter.
242 david.dillard 1.38         <pre>
243                                 // loop to access all qualifiers in a CIMparameter
244                                 CIMParameter parm;
245                                 ....               // build the parameter
246 kumpf         1.40              for (Uint32 i = 0 ; i < parm.getQualifierCount() ; i++)
247                                     ....
248 david.dillard 1.38         </pre>
249 kumpf         1.40         @return An integer count of the CIMQualifiers in the CIMParameter.
250                            @exception UninitializedObjectException If the object is not
251                                initialized.
252 david.dillard 1.38     */
253 kumpf         1.16     Uint32 getQualifierCount() const;
254                    
255 kumpf         1.40     /**
256                            Determines whether the object has been initialized.
257                            @return True if the object has not been initialized, false otherwise.
258                        */
259 kumpf         1.26     Boolean isUninitialized() const;
260 kumpf         1.16 
261 kumpf         1.40     /**
262                            Compares the parameter with another parameter.
263                            @param x The CIMConstParameter to be compared.
264                            @return True if this parameter is identical to the one specified,
265                                false otherwise.
266                            @exception UninitializedObjectException If either of the objects
267                                is not initialized.
268                        */
269 mike          1.12     Boolean identical(const CIMConstParameter& x) const;
270                    
271 kumpf         1.40     /**
272                            Makes a deep copy of the parameter.  This creates a new copy
273                            of all the parameter attributes including qualifiers.
274                            @return A new copy of the CIMParameter object.
275                            @exception UninitializedObjectException If the object is not
276                                initialized.
277 david.dillard 1.38     */
278 kumpf         1.16     CIMParameter clone() const;
279 mike          1.12 
280                    private:
281                    
282 kumpf         1.16     CIMParameter(CIMParameterRep* rep);
283                    
284                        void _checkRep() const;
285 mike          1.12 
286                        CIMParameterRep* _rep;
287 kumpf         1.19 
288 mike          1.12     friend class CIMConstParameter;
289 kumpf         1.22     friend class Resolver;
290 kumpf         1.18     friend class XmlWriter;
291 kumpf         1.19     friend class MofWriter;
292 schuur        1.34     friend class BinaryStreamer;
293 mike          1.12 };
294                    
295 kumpf         1.40 
296 mike          1.12 ////////////////////////////////////////////////////////////////////////////////
297                    //
298                    // CIMConstParameter
299                    //
300                    ////////////////////////////////////////////////////////////////////////////////
301                    
302 kumpf         1.40 /**
303                        The CIMConstParameter class provides a const interface to a CIMParameter
304                        object.  This class is needed because the shared representation model
305                        used by CIMParameter does not prevent modification to a const CIMParameter
306                        object.  Note that the value of a CIMConstParameter object could still be
307                        modified by a CIMParameter object that refers to the same data copy.
308                    */
309 mike          1.12 class PEGASUS_COMMON_LINKAGE CIMConstParameter
310                    {
311                    public:
312                    
313 kumpf         1.40     /**
314                            Constructs an uninitialized CIMConstParameter object.  A method
315                            invocation on an uninitialized object will result in the throwing
316                            of an UninitializedObjectException.  An uninitialized object may
317                            be converted into an initialized object only by using the assignment
318                            operator with an initialized object.
319                        */
320 kumpf         1.16     CIMConstParameter();
321 mike          1.12 
322 kumpf         1.40     /**
323                            Constructs a CIMConstParameter object from the value of a specified
324                            CIMConstParameter object, so that both objects refer to the same data
325                            copy.
326                            @param x The CIMConstParameter object from which to construct a new
327                                CIMConstParameter object.
328                        */
329 kumpf         1.16     CIMConstParameter(const CIMConstParameter& x);
330 mike          1.12 
331 kumpf         1.40     /**
332                            Constructs a CIMConstParameter object from the value of a specified
333                            CIMParameter object, so that both objects refer to the same data
334                            copy.
335                            @param x The CIMParameter object from which to construct a new
336                                CIMConstParameter object.
337                        */
338 kumpf         1.16     CIMConstParameter(const CIMParameter& x);
339 mike          1.12 
340 kumpf         1.40     /**
341                            Constructs a CIMConstParameter object with the specified attributes.
342                            @param name A CIMName specifying the name of the parameter.
343                            @param type A CIMType defining the parameter type.
344                            @param isArray A Boolean indicating whether it is an Array parameter.
345                            @param arraySize A Uint32 indicating the size of the Array, if the
346                                parameter is an Array parameter.  The default value of zero
347                                indicates a variable size array.
348                            @param referenceClassName A CIMName containing the reference class
349                                name for this parameter, if the parameter is of reference type.
350                            @exception TypeMismatchException If the parameter is of reference
351                                type and referenceClassName is null.
352                            @exception TypeMismatchException If isArray is true and arraySize is
353                                not zero.
354                        */
355 mike          1.12     CIMConstParameter(
356 david.dillard 1.38         const CIMName& name,
357                            CIMType type,
358                            Boolean isArray = false,
359                            Uint32 arraySize = 0,
360                            const CIMName& referenceClassName = CIMName());
361 kumpf         1.16 
362 kumpf         1.40     /**
363                            Destructs the CIMConstParameter object.
364                        */
365 kumpf         1.16     ~CIMConstParameter();
366                    
367 kumpf         1.40     /**
368                            Assigns the value of the specified CIMConstParameter object to this
369                            object, so that both objects refer to the same data copy.
370                            @param x The CIMConstParameter object from which to assign this
371                                CIMConstParameter object.
372                            @return A reference to this CIMConstParameter object.
373                        */
374 kumpf         1.16     CIMConstParameter& operator=(const CIMConstParameter& x);
375                    
376 kumpf         1.40     /**
377                            Assigns the value of the specified CIMParameter object to this
378                            object, so that both objects refer to the same data copy.
379                            @param x The CIMParameter object from which to assign this
380                                CIMConstParameter object.
381                            @return A reference to this CIMConstParameter object.
382                        */
383 kumpf         1.16     CIMConstParameter& operator=(const CIMParameter& x);
384                    
385 kumpf         1.40     /**
386                            Gets the parameter name.
387                            @return A CIMName containing the name of the parameter.
388                            @exception UninitializedObjectException If the object is not
389                                initialized.
390                        */
391 kumpf         1.24     const CIMName& getName() const;
392 kumpf         1.16 
393 kumpf         1.40     /**
394                            Checks whether the parameter is an Array parameter.
395                            @return True if the parameter is an Array parameter, false otherwise.
396                            @exception UninitializedObjectException If the object is not
397                                initialized.
398                        */
399 kumpf         1.16     Boolean isArray() const;
400                    
401 kumpf         1.40     /**
402                            Gets the array size for the parameter.
403                            @return Uint32 array size.
404                            @exception UninitializedObjectException If the object is not
405                                initialized.
406                        */
407 kumpf         1.16     Uint32 getArraySize() const;
408                    
409 kumpf         1.40     /**
410                            Gets the reference class name for the parameter.
411                            @return A CIMName containing the reference class name for the
412                                parameter if the parameter is of reference type, a null CIMName
413                                otherwise.
414                            @exception UninitializedObjectException If the object is not
415                                initialized.
416                        */
417 kumpf         1.24     const CIMName& getReferenceClassName() const;
418 kumpf         1.16 
419 kumpf         1.40     /**
420                            Gets the parameter type.
421                            @return A CIMType indicating the type of this parameter.
422                            @exception UninitializedObjectException If the object is not
423                                initialized.
424                        */
425 kumpf         1.16     CIMType getType() const;
426                    
427 kumpf         1.40     /**
428                            Finds a qualifier by name.
429                            @param name A CIMName specifying the name of the qualifier to be found.
430                            @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
431                            @exception UninitializedObjectException If the object is not
432                                initialized.
433                        */
434 kumpf         1.24     Uint32 findQualifier(const CIMName& name) const;
435 kumpf         1.16 
436 kumpf         1.40     /**
437                            Gets the qualifier at the specified index.
438                            @param index The index of the qualifier to be retrieved.
439                            @return The CIMConstQualifier at the specified index.
440                            @exception IndexOutOfBoundsException If the index is outside
441                                the range of qualifiers available for the CIMParameter.
442                            @exception UninitializedObjectException If the object is not
443                                initialized.
444                        */
445 kumpf         1.29     CIMConstQualifier getQualifier(Uint32 index) const;
446 kumpf         1.16 
447 kumpf         1.40     /**
448                            Gets the number of qualifiers in the parameter.
449                            @return An integer count of the qualifiers in the CIMParameter.
450                            @exception UninitializedObjectException If the object is not
451                                initialized.
452                        */
453 kumpf         1.16     Uint32 getQualifierCount() const;
454                    
455 kumpf         1.40     /**
456                            Determines whether the object has been initialized.
457                            @return True if the object has not been initialized, false otherwise.
458                        */
459 kumpf         1.26     Boolean isUninitialized() const;
460 kumpf         1.16 
461 kumpf         1.40     /**
462                            Compares the parameter with another parameter.
463                            @param x The CIMConstParameter to be compared.
464                            @return True if this parameter is identical to the one specified,
465                                false otherwise.
466                            @exception UninitializedObjectException If either of the objects
467                                is not initialized.
468                        */
469 kumpf         1.16     Boolean identical(const CIMConstParameter& x) const;
470                    
471 kumpf         1.40     /**
472                            Makes a deep copy of the parameter.  This creates a new copy
473                            of all the parameter attributes including qualifiers.
474                            @return A CIMParameter object with a separate copy of the
475                                CIMConstParameter object.
476                            @exception UninitializedObjectException If the object is not
477                                initialized.
478                        */
479 kumpf         1.16     CIMParameter clone() const;
480 mike          1.12 
481                    private:
482                    
483 kumpf         1.16     void _checkRep() const;
484 mike          1.12 
485                        CIMParameterRep* _rep;
486                        friend class CIMParameter;
487 kumpf         1.18     friend class XmlWriter;
488 kumpf         1.19     friend class MofWriter;
489 mike          1.12 };
490                    
491                    #define PEGASUS_ARRAY_T CIMParameter
492 kumpf         1.20 # include <Pegasus/Common/ArrayInter.h>
493 mike          1.12 #undef PEGASUS_ARRAY_T
494                    
495                    PEGASUS_NAMESPACE_END
496                    
497                    #endif /* Pegasus_Parameter_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2