/usr/src/startcom/BUILD/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 struct CIMDateTimeRep;
00042 class CMPISCMOUtilities;
00043 
00119 class PEGASUS_COMMON_LINKAGE CIMDateTime
00120 {
00121 public:
00122 
00123 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00124 
00127     static const Uint32 WILDCARD;
00128 
00129 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00130 
00133     CIMDateTime();
00134 
00138     CIMDateTime(const CIMDateTime& x);
00139 
00149     CIMDateTime(const String& str);
00150 
00163     CIMDateTime(Uint64 usec, Boolean isInterval);
00164 
00165 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00166 
00182     CIMDateTime(
00183         Uint32 year,
00184         Uint32 month,
00185         Uint32 day,
00186         Uint32 hours,
00187         Uint32 minutes,
00188         Uint32 seconds,
00189         Uint32 microseconds,
00190         Uint32 numSignificantMicrosecondDigits,
00191         Sint32 utcOffset);
00192 
00205     CIMDateTime(
00206         Uint32 days,
00207         Uint32 hours,
00208         Uint32 minutes,
00209         Uint32 seconds,
00210         Uint32 microseconds,
00211         Uint32 numSignificantMicrosecondDigits);
00212 
00213 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00214 
00216     ~CIMDateTime();
00217 
00230     CIMDateTime& operator=(const CIMDateTime& x);
00231 
00236     String toString() const;
00237 
00252     void set(const String & str);
00253 
00254 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00255 
00271     void setTimeStamp(
00272         Uint32 year,
00273         Uint32 month,
00274         Uint32 day,
00275         Uint32 hours,
00276         Uint32 minutes,
00277         Uint32 seconds,
00278         Uint32 microseconds,
00279         Uint32 numSignificantMicrosecondDigits,
00280         Sint32 utcOffset);
00281 
00294     void setInterval(
00295         Uint32 days,
00296         Uint32 hours,
00297         Uint32 minutes,
00298         Uint32 seconds,
00299         Uint32 microseconds,
00300         Uint32 numSignificantMicrosecondDigits);
00301 
00302 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00303 
00307     void clear();
00308 
00312     static CIMDateTime getCurrentDateTime();
00313 
00323     static Sint64 getDifference(CIMDateTime startTime, CIMDateTime finishTime);
00324 
00328     Boolean isInterval() const;
00329 
00334     Boolean isInterval();
00335 
00336 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00337 
00341     Boolean isTimeStamp() const;
00342 
00343 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00344 
00351     Boolean equal(const CIMDateTime& x) const;
00352 
00359     Uint64 toMicroSeconds() const;
00360 
00371     CIMDateTime operator+(const CIMDateTime& x) const;
00372 
00383     CIMDateTime & operator+=(const CIMDateTime& x);
00384 
00396     CIMDateTime operator-(const CIMDateTime& x) const;
00397 
00410     CIMDateTime & operator-=(const CIMDateTime& x);
00411 
00422     CIMDateTime operator*(Uint64 x) const;
00423 
00435     CIMDateTime & operator*=(Uint64 x);
00436 
00448     CIMDateTime operator/(Uint64 num) const;
00449 
00462     CIMDateTime & operator/=(Uint64 num);
00463 
00476     Uint64 operator/(const CIMDateTime& cdt) const;
00477 
00487     Boolean operator<(const CIMDateTime& x) const;
00488 
00499     Boolean operator<=(const CIMDateTime& x) const;
00500 
00510     Boolean operator>(const CIMDateTime & x) const;
00511 
00522     Boolean operator>=(const CIMDateTime & x) const;
00523 
00533     Boolean operator!=(const CIMDateTime & x) const;
00534 
00535 private:
00536     CIMDateTimeRep* _rep;
00537     CIMDateTime(CIMDateTimeRep*);
00538     CIMDateTime(const CIMDateTimeRep*);
00539 
00540     friend class CIMBuffer;
00541     friend class SCMOClass;
00542     friend class SCMODump;
00543     friend class SCMOInstance;
00544     friend class CMPISCMOUtilities;
00545 };
00546 
00554 PEGASUS_COMMON_LINKAGE Boolean operator==(
00555     const CIMDateTime& x,
00556     const CIMDateTime& y);
00557 
00558 #define PEGASUS_ARRAY_T CIMDateTime
00559 # include <Pegasus/Common/ArrayInter.h>
00560 #undef PEGASUS_ARRAY_T
00561 
00562 PEGASUS_NAMESPACE_END
00563 
00564 #endif /* Pegasus_CIMDateTime_h */