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

  1 karl  1.47 //%2003////////////////////////////////////////////////////////////////////////
  2 mike  1.18 //
  3 karl  1.47 // 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            // IBM Corp.; EMC Corporation, The Open Group.
  7 kumpf 1.34 //
  8 mike  1.18 // Permission is hereby granted, free of charge, to any person obtaining a copy
  9 kumpf 1.34 // of this software and associated documentation files (the "Software"), to
 10            // deal in the Software without restriction, including without limitation the
 11            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 12 mike  1.18 // sell copies of the Software, and to permit persons to whom the Software is
 13            // furnished to do so, subject to the following conditions:
 14            // 
 15 kumpf 1.34 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 16 mike  1.18 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 17            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 18 kumpf 1.34 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 19            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 20            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 21 mike  1.18 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 22            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 23            //
 24            //==============================================================================
 25            //
 26            // Author: Mike Brasher (mbrasher@bmc.com)
 27            //
 28 kumpf 1.25 // Modified By: Roger Kumpf (roger_kumpf@hp.com)
 29 kumpf 1.36 //              Carol Ann Krug Graves, Hewlett-Packard Company
 30            //                (carolann_graves@hp.com)
 31 mike  1.18 //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34            #ifndef Pegasus_Property_h
 35            #define Pegasus_Property_h
 36            
 37            #include <Pegasus/Common/Config.h>
 38 kumpf 1.39 #include <Pegasus/Common/Linkage.h>
 39            #include <Pegasus/Common/CIMName.h>
 40 kumpf 1.27 #include <Pegasus/Common/CIMValue.h>
 41 kumpf 1.25 #include <Pegasus/Common/CIMQualifier.h>
 42 mike  1.18 
 43            PEGASUS_NAMESPACE_BEGIN
 44            
 45            ////////////////////////////////////////////////////////////////////////////////
 46            //
 47            // CIMProperty
 48            //
 49            ////////////////////////////////////////////////////////////////////////////////
 50            
 51            class CIMConstProperty;
 52 kumpf 1.27 class CIMPropertyRep;
 53 kumpf 1.25 class CIMClassRep;
 54 mike  1.18 class CIMInstanceRep;
 55 kumpf 1.37 class Resolver;
 56 mike  1.18 
 57 karl  1.49 /** The CIMProperty class is used to represent CIM properties in Pegasus. A CIM Property
 58                consists of the following entities;
 59                
 60                <ul>
 61                    <li>Name of the property, a CIMName. Functions are provided to manipulate the name.
 62                    The name must be a legal name for a CIMProperty {@link CIMName}. 
 63                    <li>CIMType of the value of the property, a CIMType.
 64                    <li>CIMValue - The value of the property corresponding to the Type defined.  Properties
 65                    can have either single values or arrays of values. Functions are provided to
 66                    allow definition and query of the characteristics of the value (isArray(),
 67                    getArraySize()).
 68                
 69                    <li>Optional CIMQualifiers for the property. A property can contain zero or
 70                    more CIMQualifiers and functions are provided to manipulate the
 71                    list of CIMQualifiers
 72                </ul>
 73                In addition, internally, there are the following additional attributes
 74                that are part of a CIMProperty.
 75                <ul>
 76                    <li>propagated - attributed defining whether this CIMMethod is 
 77                    propagated from a superclass.  Note that this is normally set as part of 
 78 karl  1.49         completing the definition of objects (resolving) when they are placed in a 
 79                    repository and is NOT automatically set when creating a local object.  It 
 80                    is part of the context of the object within the repository.  It can only 
 81                    logically be set in context of the superclass of which this CIMProperty is 
 82                    defined.  
 83                    <li>ClassOrigin - attribute defining the superclass in which this 
 84                    CIMProperty was originally defined.  This is normally set as part of 
 85                    resolving Class and instances in the context of other objects (i.e.  a 
 86                    repository).  This attribute is available from objects retrieved from the 
 87                    repository, for example and indicates the Class/Instance in the hiearchy 
 88                    (this object or a superclass or instance of a superclass)was originally 
 89                    defined.  Together the propagated and ClassOrigin attributes can be used 
 90                    to determine if methods originated with the current object or were 
 91                    inherited from higher levels in the hiearchy.  
 92                </ul>
 93                Normally CIMProperties are defined in the context of CIMClasses and CIMInstances.
 94                A CIMClass or CIMInstance can include zero or more CIMProperties.
 95                CIMProperty is a shared class so that assignment and copy operators do not
 96                create new copies of the data representing a CIMMethod object but point
 97                back to the original object and the lifecycle of the original object is
 98                controlled by the accumulative lifecycle of any copies and assigned
 99 karl  1.49     objects.
100                {@link Shared Classes}
101                @see CIMConstProperty
102                @see CIMQualifiers
103                @see CIMType
104 mike  1.18 */
105 kumpf 1.25 class PEGASUS_COMMON_LINKAGE CIMProperty
106 mike  1.18 {
107            public:
108            
109 karl  1.49     /** Creates a new Null CIMProperty object. CIMProperites created with
110                    this constructor are have no information the only operation that can
111                    be performed on them is to copy another object into the new object.
112                    @exception throws UninitializedObjectException() if any method except the copy
113                    function is executed against.
114                    @see CIMConstProperty()
115                    @see Unitialized()
116 karl  1.48     */
117 kumpf 1.25     CIMProperty();
118 mike  1.18 
119 karl  1.48     /** Constructs a CIMPropery object from another 
120 karl  1.49         CIMProperty object. This method assigns the new object to the representation
121                    in the parameter and increments the representation count.  It does NOT
122                    create a new independent object be creates a reference from the assigned object
123                    to the representation of the object being assigned.
124                    @param x CIMProperty object from which to create newCIMProperty object.
125                    <pre>
126                        CIMProperty p1(CIMName ("name"), CIMTYPE_STRING);
127                        const CIMProperty cp1(p1);
128                    </pre>
129 kumpf 1.46     */
130 kumpf 1.25     CIMProperty(const CIMProperty& x);
131 mike  1.18 
132 karl  1.49     /** Constructs a CIMProperty with the specified attributes. Note that all attributes
133                    are optional except for the name and value.
134                    @param name Specifies the name of the  CIMproperty. This must be a legal CIMProperty
135                    name.
136 karl  1.48         @param value Specifies the name of the CIMValue property.
137                    @param arraySize Specifies the size of array, if fixed array size (optional).
138                    @param referenceClassName CIMName parameter that defines the 
139 karl  1.23         reference class name for the property. This parameter is required if
140 karl  1.48         the property is type CIMObjectPath. (optional)
141                    @param classOrigin CIMName parameter to define the class 
142                    origin of the property (optional). 
143                    @param propagated If true, this parameter defines the property as 
144                    propagated (optional).
145 kumpf 1.46         @return    The constructed CIM property object.
146 mike  1.18     */
147                CIMProperty(
148 kumpf 1.46         const CIMName& name,
149                    const CIMValue& value,
150                    Uint32 arraySize = 0,
151                    const CIMName& referenceClassName = CIMName(),
152                    const CIMName& classOrigin = CIMName(),
153                    Boolean propagated = false);
154 mike  1.18 
155 karl  1.48     /** Destructs the CIMProperty object.
156                */
157 kumpf 1.25     ~CIMProperty();
158 mike  1.18 
159 karl  1.48     /** REVIEWERS: Insert description here.
160 karl  1.49         @param x REVIEWERS: Insert description here.
161 karl  1.48     */
162 kumpf 1.25     CIMProperty& operator=(const CIMProperty& x);
163 mike  1.18 
164 kumpf 1.46     /** Gets the name of the property.
165 karl  1.48         @return CIMName containing the property name. For example, 
166 mike  1.18         <pre>
167                    CIMProperty p1("count", Uint32(231));
168 kumpf 1.46         assert(p1.getName() == "count");
169                    </pre>
170 mike  1.18     */
171 kumpf 1.39     const CIMName& getName() const;
172 mike  1.18 
173 kumpf 1.46     /** Set the property name.
174 karl  1.48         @param name  Specifies the CIMName that contains the name for 
175                    the parameter name.
176 mike  1.18     */
177 kumpf 1.39     void setName(const CIMName& name);
178 mike  1.18 
179 karl  1.48     /** Get the value of the property. 
180                */
181 kumpf 1.25     const CIMValue& getValue() const;
182 mike  1.18 
183 karl  1.48     /** Get the type of the property. 
184                */
185 kumpf 1.25     CIMType getType() const;
186 mike  1.18 
187 karl  1.48     /** Check if the property is an array type. 
188                */
189 kumpf 1.25     Boolean isArray() const;
190 kumpf 1.21 
191 kumpf 1.46     /** Sets the Value in the Property object from the input 
192 mike  1.18         parameter.
193 karl  1.48         @param value Specifies the CIMValue that contains the value to be put into the 
194 kumpf 1.46         property.
195 mike  1.18     */
196 kumpf 1.25     void setValue(const CIMValue& value);
197 mike  1.18 
198 kumpf 1.46     /** Gets the arraysize parameter from the property.
199                    @return Uint32 with the arraysize.
200                */
201 kumpf 1.25     Uint32 getArraySize() const;
202 mike  1.18 
203 kumpf 1.46     /** Gets the referenceClassName.
204                    @return CIMName containing the referenceClassName if this 
205                    is a reference property or empty if another CIMType.
206 mike  1.18     */
207 kumpf 1.39     const CIMName& getReferenceClassName() const;
208 mike  1.18 
209 kumpf 1.46     /** Gets the classOrigin field from the property
210                    object. 
211                    @return CIMName with classOrigin name. This will be a string 
212                    with the name of the originating class for the property or 
213                    empty if this is the originating class.
214                */
215 kumpf 1.39     const CIMName& getClassOrigin() const;
216 mike  1.18 
217 kumpf 1.46     /** Sets the Class Origin attribute.
218 karl  1.48         @param classOrigin Specifies the CIMName that contains the classOrigin.
219 mike  1.18     */
220 kumpf 1.39     void setClassOrigin(const CIMName& classOrigin);
221 mike  1.18 
222 kumpf 1.46     /** Tests if this property is propagated.
223 karl  1.48         @return True if the class is propagated; otherwise, false.
224 mike  1.19     */
225 kumpf 1.25     Boolean getPropagated() const;
226 mike  1.18 
227 kumpf 1.46     /** Sets the propagated attribute true or false.
228 karl  1.48         @param x Specifies a true or false value that represents
229                    the propagated state to be set.
230 kumpf 1.46     */
231 kumpf 1.25     void setPropagated(Boolean propagated);
232 mike  1.18 
233 kumpf 1.46     /** Adds a qualifier object to the property and
234                    increases the qualifier count.
235 karl  1.48         @param x CIMQualifier object to be added.
236                    @return The resulting CIMProperpty.
237                    @exception AlreadyExistsException True if the qualifier already 
238                    exists; otherwise, false..
239 mike  1.18     */
240 kumpf 1.25     CIMProperty& addQualifier(const CIMQualifier& x);
241 mike  1.18 
242 kumpf 1.46     /** Finds the qualifier object defined by the name parameter 
243                    if it is attached to this CIMProperty.
244 karl  1.48         @param name CIMName parameter that defines the name of Qualifier
245 kumpf 1.46         object.
246 karl  1.48         @return Position of the qualifier object or PEG_NOT_FOUND (-1),  
247 kumpf 1.46         if not found.
248 mike  1.18     */
249 kumpf 1.39     Uint32 findQualifier(const CIMName& name) const;
250 mike  1.18 
251 kumpf 1.46     /** Gets the Qualifier object specified by the input parameter.
252 karl  1.48         @param index Index parameter for the Qualifier object to be
253 kumpf 1.46         retrieved.
254                    @return CIMQualifier object at specified index.
255 karl  1.48         @exception IndexOutOfBoundsException If index is outside range
256                    of Qualifiers in this property object; otherwise, false.
257 mike  1.18     */
258 kumpf 1.44     CIMQualifier getQualifier(Uint32 index);
259 mike  1.18 
260 kumpf 1.46     /** Returns the qualifier at the specified index.
261 karl  1.48         @param index Specifies the index of the qualifier. The index is obtained from the
262 kumpf 1.44         findQualifier method.
263 kumpf 1.46         @return The qualifier object.
264 karl  1.48         @exception IndexOutOfBoundsException If index is outside the range
265                    of qualifiers that exist for the property; otherwise, false.
266 karl  1.24     */
267 kumpf 1.44     CIMConstQualifier getQualifier(Uint32 index) const;
268 mike  1.18 
269 kumpf 1.46     /** Removes the CIMQualifier defined by the 
270                    index input as a parameter.
271 karl  1.48         @param index Index of the qualifier requested.
272                    @exception IndexOutOfBoundsException If the index is outside the
273                    range of qualifiers in this property object; otherwise, false.
274 mike  1.18     */
275 kumpf 1.44     void removeQualifier(Uint32 index);
276 mike  1.18     
277 kumpf 1.46     /** Returns count of the number of qualifiers attached to 
278                    the CIMProperty object.
279                    @return Count of the number of CIMQualifier objects attached
280                    to the CIMProperty object.
281 mike  1.18     */
282 kumpf 1.25     Uint32 getQualifierCount() const;
283            
284 kumpf 1.46     /** Compares the CIMProperty object with
285                    another CIMProperty object defined by the input parameter.
286 karl  1.48         @param x CIMPropery object for comparison.
287                    @return True if the objects are identical; otherwise, false.
288 kumpf 1.25     */
289                Boolean identical(const CIMConstProperty& x) const;
290            
291 kumpf 1.46     /** Makes a deep copy (clone) of the given object.
292 karl  1.48         @return Copy of the CIMProperty object.
293 kumpf 1.46     */
294 kumpf 1.42     CIMProperty clone() const;
295 kumpf 1.25 
296 kumpf 1.46     /** Determines if the object has not been initialized.
297 karl  1.48         @return  True if the object has not been initialized;
298                    otherwise, false.
299 kumpf 1.46     */
300 kumpf 1.41     Boolean isUninitialized() const;
301 mike  1.18 
302            private:
303            
304 kumpf 1.25     CIMProperty(CIMPropertyRep* rep);
305 mike  1.18 
306 karl  1.48     /** This constructor allows the CIMClassRep friend class to cast
307                away constness.
308                @param x Specifies the name of the CIMConstProperty instance.
309                */ 
310 mike  1.18     PEGASUS_EXPLICIT CIMProperty(const CIMConstProperty& x);
311            
312 kumpf 1.25     void _checkRep() const;
313 mike  1.18 
314                friend class CIMConstProperty;
315                friend class CIMClassRep;
316                friend class CIMInstanceRep;
317 kumpf 1.37     friend class Resolver;
318 kumpf 1.30     friend class XmlWriter;
319 kumpf 1.31     friend class MofWriter;
320 schuur 1.50     friend class BinaryStreamer;
321 kumpf  1.26 
322                 CIMPropertyRep* _rep;
323 mike   1.18 };
324             
325             ////////////////////////////////////////////////////////////////////////////////
326             //
327             // CIMConstProperty
328             //
329             ////////////////////////////////////////////////////////////////////////////////
330             
331 kumpf  1.46 ///
332 mike   1.18 class PEGASUS_COMMON_LINKAGE CIMConstProperty
333             {
334             public:
335             
336 karl   1.48     /** REVIEWERS: Insert text here.
337                 */
338 kumpf  1.25     CIMConstProperty();
339 mike   1.18 
340 karl   1.48     /** REVIEWERS: Insert text here.
341                 */
342 kumpf  1.25     CIMConstProperty(const CIMConstProperty& x);
343 mike   1.18 
344 karl   1.48     /** REVIEWERS: Insert text here.
345                 */
346 kumpf  1.25     CIMConstProperty(const CIMProperty& x);
347 mike   1.18 
348 karl   1.48     /** REVIEWERS: Insert text here.
349                 */
350 mike   1.18     CIMConstProperty(
351 kumpf  1.46         const CIMName& name,
352                     const CIMValue& value,
353                     Uint32 arraySize = 0,
354                     const CIMName& referenceClassName = CIMName(),
355                     const CIMName& classOrigin = CIMName(),
356                     Boolean propagated = false);
357 kumpf  1.25 
358 karl   1.48     /** REVIEWERS: Insert text here.
359                 */
360 kumpf  1.25     ~CIMConstProperty();
361             
362 karl   1.48     /** REVIEWERS: Insert text here.
363                 */
364 kumpf  1.25     CIMConstProperty& operator=(const CIMConstProperty& x);
365             
366 karl   1.48     /** REVIEWERS: Insert text here.
367                 */
368 kumpf  1.25     CIMConstProperty& operator=(const CIMProperty& x);
369             
370 karl   1.48     /** REVIEWERS: Insert text here.
371                 */
372 kumpf  1.39     const CIMName& getName() const;
373 kumpf  1.25 
374 karl   1.48     /** REVIEWERS: Insert text here.
375                 */
376 kumpf  1.25     const CIMValue& getValue() const;
377             
378 karl   1.48     /** REVIEWERS: Insert text here.
379                 */
380 kumpf  1.25     CIMType getType() const;
381             
382 karl   1.48     /** REVIEWERS: Insert text here.
383                 */
384 kumpf  1.25     Boolean isArray() const;
385             
386 karl   1.48     /** REVIEWERS: Insert text here.
387                 */
388 kumpf  1.25     Uint32 getArraySize() const;
389             
390 karl   1.48     /** REVIEWERS: Insert text here.
391                 */
392 kumpf  1.39     const CIMName& getReferenceClassName() const;
393 kumpf  1.25 
394 karl   1.48     /** REVIEWERS: Insert text here.
395                 */
396 kumpf  1.39     const CIMName& getClassOrigin() const;
397 kumpf  1.25 
398 karl   1.48     /** REVIEWERS: Insert text here.
399                 */
400 kumpf  1.25     Boolean getPropagated() const;
401             
402 karl   1.48     /** REVIEWERS: Insert text here.
403                 */
404 kumpf  1.39     Uint32 findQualifier(const CIMName& name) const;
405 kumpf  1.25 
406 karl   1.48     /** REVIEWERS: Insert text here.
407                 */
408 kumpf  1.44     CIMConstQualifier getQualifier(Uint32 index) const;
409 kumpf  1.25 
410 karl   1.48     /** REVIEWERS: Insert text here.
411                 */
412 kumpf  1.25     Uint32 getQualifierCount() const;
413             
414 karl   1.48     /** REVIEWERS: Insert text here.
415                 */
416 kumpf  1.25     Boolean identical(const CIMConstProperty& x) const;
417             
418 karl   1.48     /** REVIEWERS: Insert text here.
419                 */
420 kumpf  1.42     CIMProperty clone() const;
421 kumpf  1.25 
422 kumpf  1.46     ///
423 kumpf  1.41     Boolean isUninitialized() const;
424 mike   1.18 
425             private:
426             
427 kumpf  1.25     void _checkRep() const;
428 mike   1.18 
429                 CIMPropertyRep* _rep;
430             
431                 friend class CIMProperty;
432                 friend class CIMPropertyRep;
433 kumpf  1.30     friend class XmlWriter;
434 kumpf  1.31     friend class MofWriter;
435 mike   1.18 };
436             
437             #define PEGASUS_ARRAY_T CIMProperty
438 kumpf  1.33 # include <Pegasus/Common/ArrayInter.h>
439 mike   1.18 #undef PEGASUS_ARRAY_T
440             
441             PEGASUS_NAMESPACE_END
442             
443             #endif /* Pegasus_Property_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2