/scratch/rpmbuild.16050.r16097/pegasus/src/Pegasus/Common/CIMDateTime.h

00001 //%LICENSE////////////////////////////////////////////////////////////////
00002 //
00003 // Licensed to The Open Group (TOG) under one or more contributor license
00004 // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
00005 // this work for additional information regarding copyright ownership.
00006 // Each contributor licenses this file to you under the OpenPegasus Open
00007 // Source License; you may not use this file except in compliance with the
00008 // License.
00009 //
00010 // Permission is hereby granted, free of charge, to any person obtaining a
00011 // copy of this software and associated documentation files (the "Software"),
00012 // to deal in the Software without restriction, including without limitation
00013 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00014 // and/or sell copies of the Software, and to permit persons to whom the
00015 // Software is furnished to do so, subject to the following conditions:
00016 //
00017 // The above copyright notice and this permission notice shall be included
00018 // in all copies or substantial portions of the Software.
00019 //
00020 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00021 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00024 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00025 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00026 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00027 //
00029 //
00030 //%/////////////////////////////////////////////////////////////////////////////
00031 
00032 #ifndef Pegasus_CIMDateTime_h
00033 #define Pegasus_CIMDateTime_h
00034 
00035 #include <Pegasus/Common/Config.h>
00036 #include <Pegasus/Common/Array.h>
00037 #include <Pegasus/Common/Linkage.h>
00038 
00039 PEGASUS_NAMESPACE_BEGIN
00040 
00041 class CIMDateTimeRep;
00042 
00118 class PEGASUS_COMMON_LINKAGE CIMDateTime
00119 {
00120 public:
00121 
00122 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00123 
00126     static const Uint32 WILDCARD;
00127 
00128 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00129 
00132     CIMDateTime();
00133 
00137     CIMDateTime(const CIMDateTime& x);
00138 
00148     CIMDateTime(const String& str);
00149 
00162     CIMDateTime(Uint64 usec, Boolean isInterval);
00163 
00164 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00165 
00181     CIMDateTime(
00182         Uint32 year,
00183         Uint32 month,
00184         Uint32 day,
00185         Uint32 hours,
00186         Uint32 minutes,
00187         Uint32 seconds,
00188         Uint32 microseconds,
00189         Uint32 numSignificantMicrosecondDigits,
00190         Sint32 utcOffset);
00191 
00204     CIMDateTime(
00205         Uint32 days,
00206         Uint32 hours,
00207         Uint32 minutes,
00208         Uint32 seconds,
00209         Uint32 microseconds,
00210         Uint32 numSignificantMicrosecondDigits);
00211 
00212 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00213 
00215     ~CIMDateTime();
00216 
00229     CIMDateTime& operator=(const CIMDateTime& x);
00230 
00235     String toString() const;
00236 
00251     void set(const String & str);
00252 
00253 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00254 
00270     void setTimeStamp(
00271         Uint32 year,
00272         Uint32 month,
00273         Uint32 day,
00274         Uint32 hours,
00275         Uint32 minutes,
00276         Uint32 seconds,
00277         Uint32 microseconds,
00278         Uint32 numSignificantMicrosecondDigits,
00279         Sint32 utcOffset);
00280 
00293     void setInterval(
00294         Uint32 days,
00295         Uint32 hours,
00296         Uint32 minutes,
00297         Uint32 seconds,
00298         Uint32 microseconds,
00299         Uint32 numSignificantMicrosecondDigits);
00300 
00301 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00302 
00306     void clear();
00307 
00311     static CIMDateTime getCurrentDateTime();
00312 
00322     static Sint64 getDifference(CIMDateTime startTime, CIMDateTime finishTime);
00323 
00327     Boolean isInterval() const;
00328 
00333     Boolean isInterval();
00334 
00335 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00336 
00340     Boolean isTimeStamp() const;
00341 
00342 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00343 
00350     Boolean equal(const CIMDateTime& x) const;
00351 
00358     Uint64 toMicroSeconds() const;
00359 
00370     CIMDateTime operator+(const CIMDateTime& x) const;
00371 
00382     CIMDateTime & operator+=(const CIMDateTime& x);
00383 
00395     CIMDateTime operator-(const CIMDateTime& x) const;
00396 
00409     CIMDateTime & operator-=(const CIMDateTime& x);
00410 
00421     CIMDateTime operator*(Uint64 x) const;
00422 
00434     CIMDateTime & operator*=(Uint64 x);
00435 
00447     CIMDateTime operator/(Uint64 num) const;
00448 
00461     CIMDateTime & operator/=(Uint64 num);
00462 
00475     Uint64 operator/(const CIMDateTime& cdt) const;
00476 
00486     Boolean operator<(const CIMDateTime& x) const;
00487 
00498     Boolean operator<=(const CIMDateTime& x) const;
00499 
00509     Boolean operator>(const CIMDateTime & x) const;
00510 
00521     Boolean operator>=(const CIMDateTime & x) const;
00522 
00532     Boolean operator!=(const CIMDateTime & x) const;
00533 
00534 private:
00535     CIMDateTimeRep* _rep;
00536     CIMDateTime(CIMDateTimeRep*);
00537 };
00538 
00546 PEGASUS_COMMON_LINKAGE Boolean operator==(
00547     const CIMDateTime& x,
00548     const CIMDateTime& y);
00549 
00550 #define PEGASUS_ARRAY_T CIMDateTime
00551 # include <Pegasus/Common/ArrayInter.h>
00552 #undef PEGASUS_ARRAY_T
00553 
00554 PEGASUS_NAMESPACE_END
00555 
00556 #endif /* Pegasus_CIMDateTime_h */