CIMDateTime.h
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 // 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 //
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31 
32 #ifndef Pegasus_CIMDateTime_h
33 #define Pegasus_CIMDateTime_h
34 
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/Array.h>
37 #include <Pegasus/Common/Linkage.h>
38 
39 PEGASUS_NAMESPACE_BEGIN
40 
41 struct CIMDateTimeRep;
42 class CMPISCMOUtilities;
43 
119 class PEGASUS_COMMON_LINKAGE CIMDateTime
120 {
121 public:
122 
123 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
124 
127  static const Uint32 WILDCARD;
128 
129 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
130 
133  CIMDateTime();
134 
138  CIMDateTime(const CIMDateTime& x);
139 
149  CIMDateTime(const String& str);
150 
163  CIMDateTime(Uint64 usec, Boolean isInterval);
164 
165 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
166 
182  CIMDateTime(
183  Uint32 year,
184  Uint32 month,
185  Uint32 day,
186  Uint32 hours,
187  Uint32 minutes,
188  Uint32 seconds,
189  Uint32 microseconds,
190  Uint32 numSignificantMicrosecondDigits,
191  Sint32 utcOffset);
192 
205  CIMDateTime(
206  Uint32 days,
207  Uint32 hours,
208  Uint32 minutes,
209  Uint32 seconds,
210  Uint32 microseconds,
211  Uint32 numSignificantMicrosecondDigits);
212 
213 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
214 
216  ~CIMDateTime();
217 
230  CIMDateTime& operator=(const CIMDateTime& x);
231 
236  String toString() const;
237 
252  void set(const String & str);
253 
254 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
255 
271  void setTimeStamp(
272  Uint32 year,
273  Uint32 month,
274  Uint32 day,
275  Uint32 hours,
276  Uint32 minutes,
277  Uint32 seconds,
278  Uint32 microseconds,
279  Uint32 numSignificantMicrosecondDigits,
280  Sint32 utcOffset);
281 
294  void setInterval(
295  Uint32 days,
296  Uint32 hours,
297  Uint32 minutes,
298  Uint32 seconds,
299  Uint32 microseconds,
300  Uint32 numSignificantMicrosecondDigits);
301 
302 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
303 
307  void clear();
308 
312  static CIMDateTime getCurrentDateTime();
313 
323  static Sint64 getDifference(CIMDateTime startTime, CIMDateTime finishTime);
324 
328  Boolean isInterval() const;
329 
334  Boolean isInterval();
335 
336 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
337 
341  Boolean isTimeStamp() const;
342 
343 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
344 
351  Boolean equal(const CIMDateTime& x) const;
352 
359  Uint64 toMicroSeconds() const;
360 
371  CIMDateTime operator+(const CIMDateTime& x) const;
372 
383  CIMDateTime & operator+=(const CIMDateTime& x);
384 
396  CIMDateTime operator-(const CIMDateTime& x) const;
397 
410  CIMDateTime & operator-=(const CIMDateTime& x);
411 
422  CIMDateTime operator*(Uint64 x) const;
423 
435  CIMDateTime & operator*=(Uint64 x);
436 
448  CIMDateTime operator/(Uint64 num) const;
449 
462  CIMDateTime & operator/=(Uint64 num);
463 
476  Uint64 operator/(const CIMDateTime& cdt) const;
477 
487  Boolean operator<(const CIMDateTime& x) const;
488 
499  Boolean operator<=(const CIMDateTime& x) const;
500 
510  Boolean operator>(const CIMDateTime & x) const;
511 
522  Boolean operator>=(const CIMDateTime & x) const;
523 
533  Boolean operator!=(const CIMDateTime & x) const;
534 
535 private:
536  CIMDateTimeRep* _rep;
537  CIMDateTime(CIMDateTimeRep*);
538  CIMDateTime(const CIMDateTimeRep*);
539 
540  friend class CIMBuffer;
541  friend class SCMOClass;
542  friend class SCMODump;
543  friend class SCMOInstance;
544  friend class CMPISCMOUtilities;
545 };
546 
554 PEGASUS_COMMON_LINKAGE Boolean operator==(
555  const CIMDateTime& x,
556  const CIMDateTime& y);
557 
558 #define PEGASUS_ARRAY_T CIMDateTime
559 # include <Pegasus/Common/ArrayInter.h>
560 #undef PEGASUS_ARRAY_T
561 
562 PEGASUS_NAMESPACE_END
563 
564 #endif /* Pegasus_CIMDateTime_h */
Definition: String.h:119
Definition: CIMDateTime.h:119