(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.47 and 1.48

version 1.47, 2005/04/04 13:44:25 version 1.48, 2005/05/04 21:38:32
Line 36 
Line 36 
 #include <Pegasus/Common/Array.h> #include <Pegasus/Common/Array.h>
 #include <Pegasus/Common/Linkage.h> #include <Pegasus/Common/Linkage.h>
  
   
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   
 class CIMDateTimeRep; 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 time stamp or an interval. CIMDateTime      CIMDateTime.  A CIM datetime may contain a time stamp or an interval.
     is an intrinsic CIM data type that represents the time as a string with a      CIMDateTime is an intrinsic CIM data type that represents the time as a
     fixed length.      string with a fixed length.
  
     <PRE>     <PRE>
     A time stamp has the following form:     A time stamp has the following form:
Line 79 
Line 76 
     mmmmmm = microseconds     mmmmmm = microseconds
     </PRE>     </PRE>
  
     Note: intervals always end in ":000". This distinguishes intervals from time stamps.      Note:  Intervals always end in ":000".  This distinguishes intervals from
       time stamps.
  
     CIMDateTime objects are constructed from String objects or from     CIMDateTime objects are constructed from String objects or from
     other CIMDateTime objects.  Character strings must be exactly     other CIMDateTime objects.  Character strings must be exactly
     twenty-five characters in length and conform to either the time stamp or interval      twenty-five characters in length and conform to either the time stamp
     format.      or interval format.
  
     CIMDateTime objects that are not explicitly initialized will be     CIMDateTime objects that are not explicitly initialized will be
     implicitly initialized with a zero time interval:     implicitly initialized with a zero time interval:
Line 92 
Line 90 
     00000000000000.000000:000     00000000000000.000000:000
  
  
   
 The following table shows what arithmetic operations are allowed The following table shows what arithmetic operations are allowed
 between CIMDateTime types. The entries in the last four columns define between CIMDateTime types. The entries in the last four columns define
 the type of the result when the operation, specified in the column header, the type of the result when the operation, specified in the column header,
Line 103 
Line 100 
 RHS - right hand side   IV - interval RHS - right hand side   IV - interval
 X - operation not allowed between types X - operation not allowed between types
  
   
   
 LHS     RHS    +       -       *        / LHS     RHS    +       -       *        /
 _____________________________________________ _____________________________________________
 TS      TS     X       IV      X       X TS      TS     X       IV      X       X
   
 TS      IV     TS      TS      X       X TS      IV     TS      TS      X       X
   
 TS      int    X       X       X       X TS      int    X       X       X       X
   
 IV      IV     IV      IV      X       int IV      IV     IV      IV      X       int
   
 IV      TS     X       X       X       X IV      TS     X       X       X       X
   
 IV      int    X       X       IV      IV IV      int    X       X       IV      IV
   
 int     TS     X       X       X       X int     TS     X       X       X       X
   
 int     IV     X       X       X       X int     IV     X       X       X       X
   
   
 </PRE> </PRE>
  
 The relational operators may only operate on two operands of the same type, The relational operators may only operate on two operands of the same type,
 i.e. two time stamps or two intervals. i.e. two time stamps or two intervals.
   
 */ */
   
 class PEGASUS_COMMON_LINKAGE CIMDateTime class PEGASUS_COMMON_LINKAGE CIMDateTime
 { {
   
 public: public:
  
     /** Creates a new CIMDateTime object with a zero interval value.     /** Creates a new CIMDateTime object with a zero interval value.
Line 146 
Line 129 
         input string for absolute and interval datetime.         input string for absolute and interval datetime.
         @param str  String object containing the CIMDateTime formatted string.         @param str  String object containing the CIMDateTime formatted string.
         This must contain twenty-five characters.         This must contain twenty-five characters.
         @exception InvalidDateTimeFormatException if the input sting  is not          @exception InvalidDateTimeFormatException If the input string is not
         formatted correctly          formatted correctly.
     */     */
     CIMDateTime(const String & str);     CIMDateTime(const String & str);
  
Line 160 
Line 143 
         @param microSec For a time stamp, the number of microseconds since         @param microSec For a time stamp, the number of microseconds since
         the epoch 0/0/0000 (12 am Jan 1, 1BCE); For an interval, the number         the epoch 0/0/0000 (12 am Jan 1, 1BCE); For an interval, the number
         of microseconds in the interval.         of microseconds in the interval.
         @param interval tells what type of CIMDateTime object  will be created.          @param interval Specifies whether the CIMDateTime object is to be
         If true an interval will be created, if false a time stamp will          created as an interval value (true) or a time stamp (false).
         be created.          @exception DateTimeOutOfRangeException If the microSec value is too
         @exception DateTimeOutOfRangeException if param microSec is grater then          large (greater than 317,455,200,000,000,000 for a time stamps or
         317,455,200,000,000,000 for time stamps or 8,640,000,000,000,000,000 for          8,640,000,000,000,000,000 for an interval).
         intervals.          @exception InvalidDateTimeFormatException If the CIMDateTime object is
         @exception InvalidDateTimeFormatException if CIMDateTime object was not          not formed correctly.
         formed correctly.  
      */      */
     CIMDateTime(Uint64 microSec, Boolean interval);     CIMDateTime(Uint64 microSec, Boolean interval);
  
Line 193 
Line 175 
     */     */
     String toString () const;     String toString () const;
  
     /** Sets the date and time in the CIMDateTime object from      /** Sets the datetime value from the input parameter.
         the input parameter.          @param str String containing the new value in the datetime format
         @param str  String constant containing the datetime          (specified in the CIMDateTime class description).  For example, the
         in the datetime format. This must conform the to formatting rules specified          following sets the date to December 24, 1999 and time to 12:00 P.M.
         in the CIMDateTime class description.  For example, the following sets          EST.
         the date to December 24, 1999 and time to 12:00 P.M.  
  
         <PRE>         <PRE>
         CIMDateTime dt;         CIMDateTime dt;
         dt.set("19991224120000.000000+360");          dt.set("19991224120000.000000-300");
         </PRE>         </PRE>
  
         @exception InvalidDateTimeFormatException if the date and time are not          @exception InvalidDateTimeFormatException If the datetime String is not
         formatted correctly.  See the CIMDateTime class description for the          formatted correctly.
         formatting rules.  
     */     */
     void set(const String & str);     void set(const String & str);
  
Line 216 
Line 196 
     */     */
     void clear();     void clear();
  
     /** Receives the current time as CIMDateTime. The time is returned as the local time.      /** Returns the current local time in a CIMDateTime object.
         @return CIMDateTime object containing the current date and time.          @return CIMDateTime object containing the current local date and time.
     */     */
     static CIMDateTime getCurrentDateTime();     static CIMDateTime getCurrentDateTime();
  
     /** Computes the difference in microseconds between two CIMDateTime time stamps or      /** Computes the difference in microseconds between two CIMDateTime time
         two CIMDateTime intervals.          stamps or two CIMDateTime intervals.
         @param startTime  Contains the start datetime.         @param startTime  Contains the start datetime.
         @param finishTime  Contains the finish datetime.         @param finishTime  Contains the finish datetime.
         @returns Integer that contains the difference between the two datetime values          @return An integer that contains the difference between the two
         in microseconds.          datetime values (in microseconds).
         @exception InvalidDateTimeFormatException If arguments are not the same         @exception InvalidDateTimeFormatException If arguments are not the same
         type of CIMDateTime.         type of CIMDateTime.
       */
       static Sint64 getDifference(CIMDateTime startTime, CIMDateTime finishTime);
  
       /** Checks whether the datetime is an interval.
           @return True if the datetime is an interval value, false otherwise.
     */     */
     static Sint64 getDifference(const CIMDateTime& startTime, const CIMDateTime& finishTime);      Boolean isInterval();
  
     /** Checks whether the datetime is an interval.     /** Checks whether the datetime is an interval.
         @return True if the datetime is an interval; otherwise, false.          @return True if the datetime is an interval value, false otherwise.
     */     */
     Boolean isInterval() const;     Boolean isInterval() const;
  
     /** Compares the CIMDateTime object to another CIMDateTime object for     /** Compares the CIMDateTime object to another CIMDateTime object for
         equality.         equality.
         @param x  CIMDateTime object to be compared.         @param x  CIMDateTime object to be compared.
         @returns true if the two CIMDateTime objects are equal; otherwise, false.          @return true if the two CIMDateTime objects are equal, false otherwise
         @exception TypeMismatchException If arguments are of different types.         @exception TypeMismatchException If arguments are of different types.
     */     */
     Boolean equal (const CIMDateTime & x) const;     Boolean equal (const CIMDateTime & x) const;
  
     /** Converts a CIMDateTime object to its microsecond representation.     /** Converts a CIMDateTime object to its microsecond representation.
         @returns  microseconds since the epoch, for time stamps. Number of          @return Number of microseconds since the epoch (for time stamps) or
         microseconds in span of time, for intervals          in a span of time (for intervals).
         @exception DateTimeOutOfRangeException if value overflow occurs during          @exception DateTimeOutOfRangeException If conversion to UTC (an
         conversion to UTC (internal operation).          internal operation) causes an overflow condition.
     */     */
     Uint64 toMicroSeconds() const;     Uint64 toMicroSeconds() const;
  
      /** Adds two CIMDateTime objects and returns a CIMDateTime object that      /** Adds two CIMDateTime objects and returns a CIMDateTime object that
          represents the sum.          represents the sum.
          @param cDT operand on the RHS of the operator          @param cDT operand on the RHS of the operator
          @returns a CIMDateTime object that is the result of adding the calling          @return A CIMDateTime object that is the result of adding the calling
          object to the RHS operand          object to the RHS operand
          @exception DateTimeOutOfRangeException if overflow conditions occur.          @exception DateTimeOutOfRangeException If the operation causes an
          @exception TypeMismatchException if input and caller are not the correct          overflow condition.
          type. (see table of operations)          @exception TypeMismatchException If the operands are not type
           compatible (see table of operations).
     */     */
     CIMDateTime operator+(const CIMDateTime & cDT) const;     CIMDateTime operator+(const CIMDateTime & cDT) const;
  
     /** Adds two CIMDateTime objects, returns the sum and changes     /** Adds two CIMDateTime objects, returns the sum and changes
         the value of the calling CIMDateTime object to match the return value.         the value of the calling CIMDateTime object to match the return value.
         @param cDT operand on the RHS of the operator         @param cDT operand on the RHS of the operator
         @returns a CIMDateTime object that is the result of adding the calling          @return A CIMDateTime object that is the result of adding the calling
         object to the RHS operand         object to the RHS operand
         @exception DateTimeOutOfRangeException if overflow conditions occur.          @exception DateTimeOutOfRangeException If the operation causes an
         @exception TypeMismatchException if input and caller are not the correct          overflow condition.
         type. (see table of operations)          @exception TypeMismatchException If the operands are not type
           compatible (see table of operations).
     */     */
     CIMDateTime & operator+=(const CIMDateTime & cDT);     CIMDateTime & operator+=(const CIMDateTime & cDT);
  
     /** Subtracts one CIMDateTime object from another and returns a CIMDateTime object      /** Subtracts one CIMDateTime object from another and returns a
         that represents the difference.          CIMDateTime object that represents the difference.
         @param cDT operand on the RHS of the operator         @param cDT operand on the RHS of the operator
         @returns a CIMDateTime object that is the result of subtracting the          @return A CIMDateTime object that is the result of subtracting the
         the RHS object from the calling.         the RHS object from the calling.
         @exception DateTimeOutOfRangeException if overflow conditions occur.          @exception DateTimeOutOfRangeException If the operation causes an
         @exception TypeMismatchException if input and caller are not the correct          underflow condition or conversion to UTC (an internal operation)
         type. (see table of operations)          causes an overflow condition.
           @exception TypeMismatchException If the operands are not type
           compatible (see table of operations).
     */     */
     CIMDateTime operator-(const CIMDateTime & cDT) const;     CIMDateTime operator-(const CIMDateTime & cDT) const;
  
     /** Subtracts one CIMDateTime object from another, returns the difference and changes      /** Subtracts one CIMDateTime object from another, returns the difference
         the value of the calling CIMDateTime object to match the return value.          and changes the value of the calling CIMDateTime object to match the
           return value.
         @param cDT operand on the RHS of the operator         @param cDT operand on the RHS of the operator
         @returns a CIMDateTime object that is the result of subtracting the object on          @return A CIMDateTime object that is the result of subtracting the
         the RHS from the calling object.          object on the RHS from the calling object.
         @exception DateTimeOutOfRangeException if underflow conditions occur for          @exception DateTimeOutOfRangeException If the operation causes an
         result or overflow condition occurs during conversion to UTC (internal operation).          underflow condition or conversion to UTC (an internal operation)
         @exception TypeMismatchException if input and caller are not the correct          causes an overflow condition.
         type. (see table of operations)          @exception TypeMismatchException If the operands are not type
           compatible (see table of operations).
     */     */
     CIMDateTime & operator-=(const CIMDateTime & cDT);     CIMDateTime & operator-=(const CIMDateTime & cDT);
  
     /**Multiplies a CIMDateTime object by an integer and returns a CIMDateTime     /**Multiplies a CIMDateTime object by an integer and returns a CIMDateTime
        object that represents the product.        object that represents the product.
        @param num integer operand on the RHS of the operator        @param num integer operand on the RHS of the operator
        @returns a CIMDateTime object that is the result of multiplying the calling          @return A CIMDateTime object that is the result of multiplying the
        object by the RHS operand.          calling object by the RHS operand.
        @exception DateTimeOutOfRangeException if overflow conditions occur.          @exception DateTimeOutOfRangeException If the operation causes an
        @exception TypeMismatchException if caller is not the correct          overflow condition.
        type. (see table of operations)          @exception TypeMismatchException If the operands are not type
           compatible (see table of operations).
     */     */
     CIMDateTime operator*(Uint64 num) const;     CIMDateTime operator*(Uint64 num) const;
  
     /**Multiplies a CIMDateTime object by an integer, returns the product     /**Multiplies a CIMDateTime object by an integer, returns the product
        and changes the value of the calling object to match the returned product.          and changes the value of the calling object to match the returned
           product.
       @param num integer operand on the RHS of the operator       @param num integer operand on the RHS of the operator
       @returns a CIMDateTime object that is the result of multiplying the calling          @return A CIMDateTime object that is the result of multiplying the
       object by the RHS operand.          calling object by the RHS operand.
       @exception DateTimeOutOfRangeException if overflow condition occur.          @exception DateTimeOutOfRangeException If the operation causes an
       @exception TypeMismatchException if caller is not the correct          overflow condition.
       type. (see table of operations)          @exception TypeMismatchException If the operands are not type
           compatible (see table of operations).
    */    */
     CIMDateTime & operator*=(Uint64 num);     CIMDateTime & operator*=(Uint64 num);
  
     /**Divides a CIMDateTime object by an integer and returns a CIMDateTime     /**Divides a CIMDateTime object by an integer and returns a CIMDateTime
       object that represents the quotient.       object that represents the quotient.
       @param num integer operand on the RHS of the operator       @param num integer operand on the RHS of the operator
       @returns a CIMDateTime object that is the result of dividing the calling          @return A CIMDateTime object that is the result of dividing the calling
       object by the RHS operand.       object by the RHS operand.
       @exception DateTimeOutOfRangeException if overflow condition occur.          @exception DateTimeOutOfRangeException If conversion to UTC (an
       @exception TypeMismatchException if caller is not the correct          internal operation) causes an overflow condition.
       type. (see table of operations)          @exception TypeMismatchException If the CIMDateTime object does not
           hold an interval value (see table of operations).
       @exception Exception if param num is zero.       @exception Exception if param num is zero.
    */    */
     CIMDateTime operator/(Uint64 num) const;     CIMDateTime operator/(Uint64 num) const;
  
     /**Divides a CIMDateTime object by an integer, returns the quotient     /**Divides a CIMDateTime object by an integer, returns the quotient
        and changes the value of the calling object to match the returned quotient.          and changes the value of the calling object to match the returned
           quotient.
       @param num integer operand on the RHS of the operator       @param num integer operand on the RHS of the operator
       @returns a CIMDateTime object that is the result of dividing the calling          @return A CIMDateTime object that is the result of dividing the calling
       object by the RHS operand          object by the RHS operand.
       @exception DateTimeOutOfRangeException if overflow condition          @exception DateTimeOutOfRangeException If conversion to UTC (an
        occurs during conversion to UTC.(internal operation)          internal operation) causes an overflow condition.
       @exception TypeMismatchException if caller is not the correct          @exception TypeMismatchException If the CIMDateTime object does not
       type. (see table of operations)          hold an interval value (see table of operations).
       @exception Exception if input is zero.          @exception Exception if param num is zero.
    */    */
     CIMDateTime & operator/=(Uint64 num);     CIMDateTime & operator/=(Uint64 num);
  
     /**Divides a CIMDateTime object by another CIMDateTime object and returns     /**Divides a CIMDateTime object by another CIMDateTime object and returns
        an integer quotient.        an integer quotient.
       @param cdt CIMDateTime object on the RHS of the operator       @param cdt CIMDateTime object on the RHS of the operator
       @returns an integer that is the result of dividing the number of microseconds          @return An integer that is the result of dividing the number of
       represented by the calling CIMDateTime object by the          microseconds represented by the calling CIMDateTime object by the
       number of microseconds represented by the CIMDateTime object on the RHS of          number of microseconds represented by the CIMDateTime object on the
       the operator.          RHS of the operator.
       @exception DateTimeOutOfRangeException if overflow condition          @exception DateTimeOutOfRangeException If conversion to UTC (an
        occurs during conversion to UTC.(internal operation)          internal operation) causes an overflow condition.
       @exception TypeMismatchException if operands are not the correct          @exception TypeMismatchException If the operands are not type
       type. (see table of operations)          compatible (see table of operations).
   
    */    */
     Uint64 operator/(const CIMDateTime & cdt) const;     Uint64 operator/(const CIMDateTime & cdt) const;
  
     /**Compare two CIMDateTime objects and returns true if the LHS is     /**Compare two CIMDateTime objects and returns true if the LHS is
        greater then RHS.          less than the RHS.
        @param cDT operand on the RHS of the operator        @param cDT operand on the RHS of the operator
        @returns true if the LHS is greater then RHS.          @return true if the LHS is less than the RHS, false otherwise.
        @exception DateTimeOutOfRangeException if overflow condition          @exception DateTimeOutOfRangeException If conversion to UTC (an
        occurs during conversion to UTC.(internal operation)          internal operation) causes an overflow condition.
        @exception TypeMismatchException if operands are not of the same        @exception TypeMismatchException if operands are not of the same
        type.        type.
      */      */
     Boolean operator<(const CIMDateTime & cDT) const;     Boolean operator<(const CIMDateTime & cDT) const;
  
     /**Compare two CIMDateTime objects and returns true if the LHS is     /**Compare two CIMDateTime objects and returns true if the LHS is
        greater then or equal to the RHS.          less than or equal to the RHS.
        @param cDT operand on the RHS of the operator        @param cDT operand on the RHS of the operator
        @returns true if the LHS is greater then RHS.          @return true if the LHS is less than or equal to the RHS, false
        @exception DateTimeOutOfRangeException if overflow condition          otherwise.
        occurs during conversion to UTC.(internal operation)          @exception DateTimeOutOfRangeException If conversion to UTC (an
           internal operation) causes an overflow condition.
        @exception TypeMismatchException if operands are not of the same        @exception TypeMismatchException if operands are not of the same
        type.        type.
     */     */
     Boolean operator<=(const CIMDateTime & cDT) const;     Boolean operator<=(const CIMDateTime & cDT) const;
  
     /**Compare two CIMDateTime objects and returns true if the LHS is     /**Compare two CIMDateTime objects and returns true if the LHS is
        less then RHS.          greater than the RHS.
        @param cDT operand on the RHS of the operator        @param cDT operand on the RHS of the operator
        @returns true if the LHS is less then RHS.          @return true if the LHS is greater than the RHS, false otherwise.
        @exception DateTimeOutOfRangeException if overflow condition          @exception DateTimeOutOfRangeException If conversion to UTC (an
        occurs during conversion to UTC (internal operation).          internal operation) causes an overflow condition.
        @exception TypeMismatchException if operands are not of the same        @exception TypeMismatchException if operands are not of the same
        type.        type.
     */     */
     Boolean operator>(const CIMDateTime & cDT) const;     Boolean operator>(const CIMDateTime & cDT) const;
  
     /**Compare two CIMDateTime objects and returns true if the LHS is     /**Compare two CIMDateTime objects and returns true if the LHS is
        less then or equal to the RHS.          greater than or equal to the RHS.
        @param cDT operand on the RHS of the operator        @param cDT operand on the RHS of the operator
        @returns true if the LHS is less then RHS.          @return true if the LHS is greater than or equal to the RHS, false
        @exception DateTimeOutOfRangeException if overflow condition          otherwise.
        occurs during conversion to UTC (internal operation).          @exception DateTimeOutOfRangeException If conversion to UTC (an
           internal operation) causes an overflow condition.
        @exception TypeMismatchException if operands are not of the same        @exception TypeMismatchException if operands are not of the same
        type.        type.
     */     */
Line 409 
Line 404 
     /**Compare two CIMDateTime objects and returns true if the LHS is     /**Compare two CIMDateTime objects and returns true if the LHS is
        not equal to the RHS.        not equal to the RHS.
        @param cDT operand on the RHS of the operator        @param cDT operand on the RHS of the operator
        @returns true if the LHS is not equal to RHS.          @return true if the LHS is not equal to RHS, false otherwise.
        @exception DateTimeOutOfRangeException if overflow condition          @exception DateTimeOutOfRangeException If conversion to UTC (an
        occurs during conversion to UTC (internal operation).          internal operation) causes an overflow condition.
        @exception TypeMismatchException if operands are not of the same        @exception TypeMismatchException if operands are not of the same
        type.        type.
     */     */
     Boolean operator!=(const CIMDateTime & cDT) const;     Boolean operator!=(const CIMDateTime & cDT) const;
  
   
   
 private: private:
  
     CIMDateTimeRep* _rep;     CIMDateTimeRep* _rep;
Line 444 
Line 437 
    same time or length of time.    same time or length of time.
    @param x one of the CIMDateTime objects to be compared    @param x one of the CIMDateTime objects to be compared
    @param y one of the CIMDateTime objects to be compared    @param y one of the CIMDateTime objects to be compared
    @returns true if the two objects passed in represent the same time or      @return true if the two objects passed in represent the same time or
    length of time.      length of time, false otherwise.
 */ */
 PEGASUS_COMMON_LINKAGE Boolean operator==( const CIMDateTime& x, const CIMDateTime& y);  PEGASUS_COMMON_LINKAGE Boolean operator==(
       const CIMDateTime& x,
       const CIMDateTime& y);
  
 #define PEGASUS_ARRAY_T CIMDateTime #define PEGASUS_ARRAY_T CIMDateTime
 # include <Pegasus/Common/ArrayInter.h> # include <Pegasus/Common/ArrayInter.h>


Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2