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

Diff for /pegasus/src/Pegasus/Common/CIMDateTime.h between version 1.3 and 1.27

version 1.3, 2001/04/25 22:20:53 version 1.27, 2002/06/03 19:33:29
Line 1 
Line 1 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
   // The Open Group, Tivoli Systems
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a  // Permission is hereby granted, free of charge, to any person obtaining a copy
 // copy of this software and associated documentation files (the "Software"),  // of this software and associated documentation files (the "Software"), to
 // to deal in the Software without restriction, including without limitation  // deal in the Software without restriction, including without limitation the
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,  // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // and/or sell copies of the Software, and to permit persons to whom the  // sell copies of the Software, and to permit persons to whom the Software is
 // Software is furnished to do so, subject to the following conditions:  // furnished to do so, subject to the following conditions:
 //  //
 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL  // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 // DEALINGS IN THE SOFTWARE.  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (mbrasher@bmc.com) // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // Modified By:  // Modified By: Karl Schopmeyer(k.schopmeyer@opengroup.org)
   //              Sushma Fernandes, Hewlett Packard Company
   //                  (sushma_fernandes@hp.com)
   //              Roger Kumpf, Hewlett Packard Company (roger_kumpf@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 29 
Line 34 
 #define Pegasus_DateTime_h #define Pegasus_DateTime_h
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
   #include <Pegasus/Common/Array.h>
   #include <time.h>
   #ifdef PEGASUS_INTERNALONLY
 #include <iostream> #include <iostream>
   #endif
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   /* ATTN: P3. KS Several functions should be added to this class for datetime manipulation
      including get and set each subcomponent (year, month, etc), test for equality,
      create intervals from absolutes, possibly gett current time, Note that
      the Java rep is probably tostring, not get string,
   */
   
   class CIMDateTimeRep;
   
 /** /**
     The CIMDateTime class represents the CIM datetime data type as a C++ class     The CIMDateTime class represents the CIM datetime data type as a C++ class
     CIMDateTime. A CIM datetime may contain a date or an interval. CIMDateTime     CIMDateTime. A CIM datetime may contain a date or an interval. CIMDateTime
Line 62 
Line 79 
     Where     Where
  
         dddddddd = days         dddddddd = days
         hh = hours          hh = hours (0-23)
         mm = minutes          mm = minutes (0-59)
         ss = seconds          ss = seconds (0-59)
         mmmmmm = microseconds         mmmmmm = microseconds
     </PRE>     </PRE>
  
Line 87 
Line 104 
         00000000000000.000000:000         00000000000000.000000:000
  
     Instances can be tested for nullness with the isNull() method.     Instances can be tested for nullness with the isNull() method.
   
     ATTN: Add inequalities.  
 */ */
 class PEGASUS_COMMON_LINKAGE CIMDateTime class PEGASUS_COMMON_LINKAGE CIMDateTime
 { {
 public: public:
  
     enum { FORMAT_LENGTH = 25 };      /** Create a new CIMDateTime object with NULL DateTime definition.
       */
     /// CIMDateTime CIMMethod  
     CIMDateTime();     CIMDateTime();
  
     /** CIMDateTime CIMMethod creates the CIM CIMDateTime from a string      /** CIMDateTime - Creat a CIM CIMDateTime instance from a string
         constant.          constant representing the CIM DateTime formatted datetime
           See the class documentation for CIMDateTime for the defintion of the
           input string for absolute and interval datetime.
           @param str String object containing the CIM DateTime formatted string
     */     */
     CIMDateTime(const char* str);     CIMDateTime(const char* str);
  
     /** CIMDateTime CIMMethod - Creates the CIMDateTime instance from another      /** CIMDateTime Create a CIMDateTime instance from another
         CIMDateTime instance          CIMDateTime object
           @param x CIMDateTime object to be copied.
     */     */
     CIMDateTime(const CIMDateTime& x);     CIMDateTime(const CIMDateTime& x);
  
     /** CIMDateTime method again      /** DateTime Destructor. */
       ~CIMDateTime();
   
       /**  Assign one DateTime object to another
       @param - The DateTime Object to assign
       <pre>
       CIMDateTime d1;
       CIMDateTime d2 = "00000000000000.000000:000";
       d1 = d1;
       </pre>
     */     */
     CIMDateTime& operator=(const CIMDateTime& x);     CIMDateTime& operator=(const CIMDateTime& x);
  
     /** CIMDateTime isNull method - Tests for an all zero date time      /** CIMDateTime isNull method - Tests for an all zero date time. Note that
           today this function checks for absolute datetime == zero, not interval.
         <PRE>         <PRE>
         CIMDateTime dt;         CIMDateTime dt;
         dt.clear();         dt.clear();
Line 124 
Line 152 
     */     */
     Boolean isNull() const;     Boolean isNull() const;
  
     /// method getString      /** getString - Returns the string representing the DateTime value of the
           CIMDateTime Object.
           ATTN: P3 KS.  This simply returns a string whether the datetime is a
           real value or the NULL value.  It is up to the user to test.  Should
           this be modified so we do something like an interupt on NULL?
       */
     const char* getString() const;     const char* getString() const;
  
     /** method set - Sets the date time. Creates the CIMDateTime instance from     /** method set - Sets the date time. Creates the CIMDateTime instance from
Line 142 
Line 175 
     */     */
     void set(const char* str);     void set(const char* str);
  
     /// CIMDateTime method clear - Clears the datetime class instance.      /**  clear - Clears the datetime class instance. The date time is set to our
           defintion of NULL, absolute zero date time.
       */
     void clear();     void clear();
  
     /** CIMDateTime CIMMethod - ATTN: Friend operator Test for CIMDateTime      /** Makes a deep copy (clone) of the given object. */
         equality      CIMDateTime clone() const;
   
       /**
       Get current time as CIMDateTime. The time returned is the local time.
   
       @return CIMDateTime   Contains the current datetime as a CIMDateTime object.
   
       Note: Original code was taken from OperationSystem::getLocalDateTime()
     */     */
     PEGASUS_COMMON_LINKAGE friend Boolean operator==(      static CIMDateTime getCurrentDateTime();
         const CIMDateTime& x,  
         const CIMDateTime& y);      /**
       Get the difference between two CIMDateTimes. This function computes the
       difference between two datetimes or between two intervals. The result
       is truncated and returned as the number of seconds.
   
       @param startTime     Contains the start time.
   
       @param finishTime    Contains the finish time.
   
       @return difference   Difference between the two datetimes in seconds.
   
       @throws BadFormat
   
       */
       static Sint64 getDifference(CIMDateTime startTime, CIMDateTime finishTime);
   
       /**
       Checks whether the datetime is an interval.
   
       @return isInterval  True if the datetime is an interval, else false
       */
       Boolean isInterval();
  
 private: private:
  
       CIMDateTimeRep* _rep;
   
     Boolean _set(const char* str);     Boolean _set(const char* str);
     char _rep[FORMAT_LENGTH + 1];  
       /**
          This function extracts the different components of the date and time
          from the string passed and assigns it to the tm structure.
   
          @param dateTimeStr  Contains the string to be assigned.
   
          @param tm           Contains the tm structure to be updated.
       */
       static void formatDateTime(char* dateTime, tm* tm);
   
       /** CIMDateTime - ATTN: Friend operator Test for CIMDateTime
           equality
       */
       PEGASUS_COMMON_LINKAGE friend Boolean operator==(
           const CIMDateTime& x,
           const CIMDateTime& y);
 }; };
  
 PEGASUS_COMMON_LINKAGE Boolean operator==( PEGASUS_COMMON_LINKAGE Boolean operator==(
     const CIMDateTime& x,     const CIMDateTime& x,
     const CIMDateTime& y);     const CIMDateTime& y);
  
 PEGASUS_COMMON_LINKAGE std::ostream& operator<<(  #ifdef PEGASUS_INTERNALONLY
     std::ostream& os,  PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<(
       PEGASUS_STD(ostream)& os,
     const CIMDateTime& x);     const CIMDateTime& x);
   #endif
   
   #define PEGASUS_ARRAY_T CIMDateTime
   # include <Pegasus/Common/ArrayInter.h>
   #undef PEGASUS_ARRAY_T
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.27

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2