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

  1 karl  1.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 karl  1.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 Pegasus_UintArgs_h
 33           #define Pegasus_UintArgs_h
 34           
 35           #include <Pegasus/Common/Config.h>
 36           #include <Pegasus/Common/String.h>
 37           #include <Pegasus/Common/Linkage.h>
 38           
 39           /************************************************************
 40            The classes in this file provide a means to pass Nullable Uint32
 41            and Uin64 arguments  APIs and to manage them in the Pegasus client and server.
 42            Each class contains state (NULL) and value.
 43 karl  1.1 
 44            These classes were created specifically to support API extensions for
 45            the DMTF defined client Pull operations (See DSP0200, version 1.3.1)
 46           
 47            Each class defines the functions for a singleCIMType.  Today the possible
 48            type are Uint32 and Uint64.
 49           
 50            They are not reference counted and do not provide a separate representation
 51            class.
 52           
 53            The class provides the means to construct, destruct, assign, set and test
 54            the characteristics of an argument. They may be constructed with the default
 55            NULL or a specific integer value.
 56           
 57            *************************************************************/
 58           
 59           PEGASUS_NAMESPACE_BEGIN
 60           
 61           class PEGASUS_COMMON_LINKAGE Uint32Arg
 62           {
 63           public:
 64 karl  1.1 
 65               /** constructs an object with NULL state (default constructor)
 66               */
 67               Uint32Arg();
 68           
 69               /** Constructs one object from another assigning value and state
 70                   to the new object
 71               */
 72               Uint32Arg(const Uint32Arg& x);
 73           
 74               /** Construct a new object with the value defined by the input
 75                   parameter and with state !NULL
 76           
 77                   @param x Uint32 integer that is assigned to the new object
 78                   <pre>
 79                       Uint32Arg maxObjectCount(9);
 80                   </pre>
 81               */
 82               Uint32Arg(Uint32 x);
 83           
 84               /** destruct the object
 85 karl  1.1     */
 86               ~Uint32Arg();
 87           
 88               /** Assigns one object to another
 89               */
 90               Uint32Arg& operator=(const Uint32Arg& x);
 91           
 92               /** Returns the value component of the object. If the object is in
 93                   NULL state, this function still returns a value.  It is the
 94                   responsibility of the user to test for NULLness before using any
 95                   value.
 96           
 97                   @return Uint32 containing the current value of the object.
 98                   <pre>
 99                       Uint32Arg x(999);
100                       Uint32 y = x.getValue();
101                   </pre>
102               */
103               const Uint32& getValue() const;
104           
105               /** Sets the input value into the object and sets the state to
106 karl  1.1         !NULL.
107                   @param x Uint32 value to be set into the object
108                   <pre>
109                       Uint32Arg maxObjectCount(9);
110                       if (!maxObjectCount.isNull && maxObjectCount.getValue() == 9)
111                           ...
112                   </pre>
113               */
114               void setValue(Uint32 x);
115           
116               /** Tests the object for NULL state.
117                   @return This method returns true if the object is NULL. Otherwise
118                   it returns false.
119                   <pre>
120                       Uint32Arg maxObjectCount;
121                       assert(maxObjectCount.isNull);
122                   </pre>
123               */
124               Boolean isNull() const;
125           
126               /** Sets the state of the object to NULL.  This also sets the
127 karl  1.1         value component to zero.
128                   <pre>
129                       Uint32Arg operationTimeout(9);
130                       assert(!operationTimeout.isNULL())
131                   </pre>
132               */
133               void setNullValue();
134           
135               /** Output String with value of the object or String "NULL".
136           
137                  @return String containing the numeric value of the object or
138                      NULL if the state of the object is NULL
139                */
140               String toString();
141           
142               Boolean equal(const Uint32Arg& x) const;
143           
144           private:
145               Uint32 _value;
146               Boolean _null;
147           };
148 karl  1.1 
149           class PEGASUS_COMMON_LINKAGE Uint64Arg
150           {
151           public:
152           
153               /** constructs an object with NULL state (default constructor)
154               */
155               Uint64Arg();
156           
157               /** Constructs one object from another assigning value and state
158                   to the new object
159               */
160               Uint64Arg(const Uint64Arg& x);
161           
162               /** constructs a new object with the value defined by the input
163                   parameter and with state !NULL
164           
165                   @param x Uint64 integer that is assigned to the new object
166                   <pre>
167                       Uint64Arg maxObjectCount(9);
168                   </pre>
169 karl  1.1     */
170               Uint64Arg(Uint64 x);
171           
172               /** destructs the object
173               */
174               ~Uint64Arg();
175           
176               /** Assigns one object to another
177               */
178               Uint64Arg& operator=(const Uint64Arg& x);
179               /** Returns the value component of the object. If the object is in
180                   NULL state, this function still returns a value.  It is the
181                   responsibility of the user to test for NULLness before using any
182                   value.
183           
184                   @return Uint32 containing the current value of the object.
185                   <pre>
186                       Uint64Arg x(999);
187                       Uint64 y = x.getValue();
188                   </pre>
189               */
190 karl  1.1     const Uint64& getValue() const;
191           
192               /** Sets the input value into the object and sets the state to
193                   !NULL.
194                   @param x Uint64 value to be set into the object
195                   <pre>
196                       Uint64Arg maxObjectCount(9);
197                       if (!maxObjectCount.isNull && maxObjectCount.getValue()
198                           ...
199                   </pre>
200               */
201               void setValue(Uint64 x);
202               /** Tests the object for NULL state.
203                   @return This method returns true if the object is NULL. Otherwise
204                   it returns false.
205                   <pre>
206                       Uint64Arg maxObjectCount;
207                       assert(!maxObjectCount.isNull);
208                   </pre>
209               */
210               Boolean isNull() const;
211 karl  1.1 
212               /** Sets the state of the object to NULL.  This also sets the
213                   value component to zero.
214                   <pre>
215                       Uint64Arg operationTimeout(9);
216                       operationTimeout.setNullValue();
217                       assert(operationTimeout.isNULL())
218                   </pre>
219               */
220               void setNullValue();
221           
222               /** Output String with value of the object or String "NULL".
223           
224                  @return String containing the numeric value of the object or
225                      NULL if the state of the object is NULL
226                */
227               String toString();
228           
229               Boolean equal(const Uint64Arg& x) const;
230           
231           private:
232 karl  1.1     Uint64 _value;
233               Boolean _null;
234           };
235           
236           /**
237               Test for equality of two NullableArg objects
238            */
239           PEGASUS_COMMON_LINKAGE Boolean operator==(const Uint32Arg& x,
240               const Uint32Arg& y);
241           
242           PEGASUS_COMMON_LINKAGE Boolean operator==(const Uint64Arg& x,
243               const Uint64Arg& y);
244           
245           PEGASUS_NAMESPACE_END
246           
247           #endif /* Pegasus_UintArgs_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2