(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.50 and 1.55

version 1.50, 2006/01/30 16:16:46 version 1.55, 2008/12/02 09:00:42
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  
 // EMC Corporation; Symantec Corporation; The Open Group.  
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // Permission is hereby granted, free of charge, to any person obtaining a
 // of this software and associated documentation files (the "Software"), to  // copy of this software and associated documentation files (the "Software"),
 // deal in the Software without restriction, including without limitation the  // to deal in the Software without restriction, including without limitation
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // sell copies of the Software, and to permit persons to whom the Software is  // and/or sell copies of the Software, and to permit persons to whom the
 // furnished to do so, subject to the following conditions:  // Software is furnished to do so, subject to the following conditions:
 // //
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // The above copyright notice and this permission notice shall be included
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // in all copies or substantial portions of the Software.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
 // 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.  
 // //
 //==============================================================================  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 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.
   //
   //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #ifndef Pegasus_DateTime_h  #ifndef Pegasus_CIMDateTime_h
 #define Pegasus_DateTime_h  #define Pegasus_CIMDateTime_h
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Array.h> #include <Pegasus/Common/Array.h>
Line 121 
Line 119 
 { {
 public: public:
  
   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
   
       /** Wildcard parameter for component-based initializer member functions.
       */
       static const Uint32 WILDCARD;
   
   #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
   
     /** Creates a new CIMDateTime object with a zero interval value.     /** Creates a new CIMDateTime object with a zero interval value.
     */     */
     CIMDateTime();     CIMDateTime();
  
       /** Creates a CIMDateTime object from another CIMDateTime object.
           @param x  Specifies the name of the CIMDateTime object to copy.
       */
       CIMDateTime(const CIMDateTime& x);
   
     /** Creates a new CIMDateTime object from a string constant representing     /** Creates a new CIMDateTime object from a string constant representing
         the CIM DateTime formatted datetime.         the CIM DateTime formatted datetime.
         See the class documentation for CIMDateTime for the definition of the         See the class documentation for CIMDateTime for the definition of the
Line 136 
Line 147 
     */     */
     CIMDateTime(const String & str);     CIMDateTime(const String & str);
  
     /** Creates a CIMDateTime object from another CIMDateTime object.  
         @param x  Specifies the name of the CIMDateTime object to copy.  
     */  
     CIMDateTime(const CIMDateTime& x);  
   
     /** Creates a CIMDateTime object from an integer.     /** Creates a CIMDateTime object from an integer.
         @param microSec For a time stamp, the number of microseconds since          @param usec 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 Specifies whether the CIMDateTime object is to be          @param isInterval Specifies whether the CIMDateTime object is to be
         created as an interval value (true) or a time stamp (false).         created as an interval value (true) or a time stamp (false).
         @exception DateTimeOutOfRangeException If the microSec value is too         @exception DateTimeOutOfRangeException If the microSec value is too
         large (greater than 317,455,200,000,000,000 for a time stamps or         large (greater than 317,455,200,000,000,000 for a time stamps or
Line 153 
Line 159 
         @exception InvalidDateTimeFormatException If the CIMDateTime object is         @exception InvalidDateTimeFormatException If the CIMDateTime object is
         not formed correctly.         not formed correctly.
     */     */
     CIMDateTime(Uint64 microSec, Boolean interval);      CIMDateTime(Uint64 usec, Boolean isInterval);
   
   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
   
       /** Create datetime time stamp from components.
           @param year zero-based year number (or CIMDateTime::WILDCARD)
           @param month number from 1 to 12 (or CIMDateTime::WILDCARD)
           @param day one-based day of the month (or CIMDateTime::WILDCARD)
           @param hours a number from 0 to 23 (or CIMDateTime::WILDCARD)
           @param minutes a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param seconds a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param microseconds a number from 0 to 999999
           @param numSignificantMicrosecondDigits the number of decimal digits of
               the microseconds parameter (from left to right) that are
               significant (all others are wildcarded) or six if they are all
               significant.
           @param UTF offset in minutes (negative or positive).
           @exception DateTimeOutOfRangeException.
       */
       CIMDateTime(
           Uint32 year,
           Uint32 month,
           Uint32 day,
           Uint32 hours,
           Uint32 minutes,
           Uint32 seconds,
           Uint32 microseconds,
           Uint32 numSignificantMicrosecondDigits,
           Sint32 utcOffset);
   
       /** Create datetime interval from components.
           @param days a number from 0 to 99999999 (or CIMDateTime::WILDCARD)
           @param hours a number from 0 to 23 (or CIMDateTime::WILDCARD)
           @param minutes a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param seconds a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param microseconds a number from 0 to 999999
           @param numSignificantMicrosecondDigits the number of decimal digits of
               the microseconds parameter (from left to right) that are
               significant (all others are wildcarded) or six if they are all
               significant.
           @exception DateTimeOutOfRangeException.
       */
       CIMDateTime(
           Uint32 days,
           Uint32 hours,
           Uint32 minutes,
           Uint32 seconds,
           Uint32 microseconds,
           Uint32 numSignificantMicrosecondDigits);
   
   #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
  
     /** CIMDateTime destructor. */     /** CIMDateTime destructor. */
     ~CIMDateTime();     ~CIMDateTime();
Line 167 
Line 223 
             CIMDateTime d2 = "00000000000000.000000:000";             CIMDateTime d2 = "00000000000000.000000:000";
             d1 = d2;             d1 = d2;
         </PRE>         </PRE>
         Therefore, d1 is assigned the same "00000000000000.000000:000" value as d2.          Therefore, d1 is assigned the same "00000000000000.000000:000" value
           as d2.
     */     */
     CIMDateTime& operator=(const CIMDateTime& x);     CIMDateTime& operator=(const CIMDateTime& x);
  
Line 193 
Line 250 
     */     */
     void set(const String & str);     void set(const String & str);
  
   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
   
       /** Sets the datetime timestamp from individual components.
           @param year zero-based year number (or CIMDateTime::WILDCARD)
           @param month number from 1 to 12 (or CIMDateTime::WILDCARD)
           @param day one-based day of the month (or CIMDateTime::WILDCARD)
           @param hours a number from 0 to 23 (or CIMDateTime::WILDCARD)
           @param minutes a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param seconds a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param microseconds a number from 0 to 999999
           @param UTF offset in minutes (negative or positive).
           @param numSignificantMicrosecondDigits the number of decimal digits of
               the microseconds parameter (from left to right) that are
               significant (all others are wildcarded) or six if they are all
               significant.
           @exception DateTimeOutOfRangeException.
       */
       void setTimeStamp(
           Uint32 year,
           Uint32 month,
           Uint32 day,
           Uint32 hours,
           Uint32 minutes,
           Uint32 seconds,
           Uint32 microseconds,
           Uint32 numSignificantMicrosecondDigits,
           Sint32 utcOffset);
   
       /** Create datetime interval from components.
           @param days a number from 0 to 99999999
           @param hours a number from 0 to 23 (or CIMDateTime::WILDCARD)
           @param minutes a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param seconds a number from 0 to 59 (or CIMDateTime::WILDCARD)
           @param microseconds a number from 0 to 999999
           @param numSignificantMicrosecondDigits the number of decimal digits of
               the microseconds parameter (from left to right) that are
               significant (all others are wildcarded) or six if they are all
               significant.
           @exception DateTimeOutOfRangeException.
       */
       void setInterval(
           Uint32 days,
           Uint32 hours,
           Uint32 minutes,
           Uint32 seconds,
           Uint32 microseconds,
           Uint32 numSignificantMicrosecondDigits);
   
   #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
   
     /** Clears the datetime class object.  The date time is set to     /** Clears the datetime class object.  The date time is set to
         a zero interval value.         a zero interval value.
     */     */
Line 218 
Line 325 
         @return True if the datetime is an interval value, false otherwise.         @return True if the datetime is an interval value, false otherwise.
     */     */
     Boolean isInterval() const;     Boolean isInterval() const;
   
       /** Checks whether the datetime is an interval.  (This non-const form is
           maintained for compatibility.)
           @return True if the datetime is an interval value, false otherwise.
       */
     Boolean isInterval();     Boolean isInterval();
  
   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
   
       /** Checks whether the datetime is a timestamp.
           @return True if so.
       */
       Boolean isTimeStamp() const;
   
   #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
   
     /** 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.
Line 238 
Line 359 
  
     /** 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 x operand on the RHS of the operator
         @return 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 the operation causes an         @exception DateTimeOutOfRangeException If the operation causes an
Line 246 
Line 367 
         @exception TypeMismatchException If the operands are not type         @exception TypeMismatchException If the operands are not type
         compatible (see table of operations).         compatible (see table of operations).
     */     */
     CIMDateTime operator+(const CIMDateTime& cDT) const;      CIMDateTime operator+(const CIMDateTime& x) 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 x operand on the RHS of the operator
         @return 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 the operation causes an         @exception DateTimeOutOfRangeException If the operation causes an
Line 258 
Line 379 
         @exception TypeMismatchException If the operands are not type         @exception TypeMismatchException If the operands are not type
         compatible (see table of operations).         compatible (see table of operations).
     */     */
     CIMDateTime & operator+=(const CIMDateTime& cDT);      CIMDateTime & operator+=(const CIMDateTime& x);
  
     /** Subtracts one CIMDateTime object from another and returns a     /** Subtracts one CIMDateTime object from another and returns a
         CIMDateTime object that represents the difference.         CIMDateTime object that represents the difference.
         @param cDT operand on the RHS of the operator          @param x operand on the RHS of the operator
         @return 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 the operation causes an         @exception DateTimeOutOfRangeException If the operation causes an
Line 271 
Line 392 
         @exception TypeMismatchException If the operands are not type         @exception TypeMismatchException If the operands are not type
         compatible (see table of operations).         compatible (see table of operations).
     */     */
     CIMDateTime operator-(const CIMDateTime& cDT) const;      CIMDateTime operator-(const CIMDateTime& x) const;
  
     /** Subtracts one CIMDateTime object from another, returns the difference     /** Subtracts one CIMDateTime object from another, returns the difference
         and changes the value of the calling CIMDateTime object to match the         and changes the value of the calling CIMDateTime object to match the
         return value.         return value.
         @param cDT operand on the RHS of the operator          @param x operand on the RHS of the operator
         @return A CIMDateTime object that is the result of subtracting the         @return A CIMDateTime object that is the result of subtracting the
         object on the RHS from the calling object.         object on the RHS from the calling object.
         @exception DateTimeOutOfRangeException If the operation causes an         @exception DateTimeOutOfRangeException If the operation causes an
Line 285 
Line 406 
         @exception TypeMismatchException If the operands are not type         @exception TypeMismatchException If the operands are not type
         compatible (see table of operations).         compatible (see table of operations).
     */     */
     CIMDateTime & operator-=(const CIMDateTime& cDT);      CIMDateTime & operator-=(const CIMDateTime& x);
  
     /** 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 x integer operand on the RHS of the operator
         @return A CIMDateTime object that is the result of multiplying the         @return A CIMDateTime object that is the result of multiplying the
         calling object by the RHS operand.         calling object by the RHS operand.
         @exception DateTimeOutOfRangeException If the operation causes an         @exception DateTimeOutOfRangeException If the operation causes an
Line 297 
Line 418 
         @exception TypeMismatchException If the operands are not type         @exception TypeMismatchException If the operands are not type
         compatible (see table of operations).         compatible (see table of operations).
     */     */
     CIMDateTime operator*(Uint64 num) const;      CIMDateTime operator*(Uint64 x) 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         and changes the value of the calling object to match the returned
         product.         product.
         @param num integer operand on the RHS of the operator          @param x integer operand on the RHS of the operator
         @return A CIMDateTime object that is the result of multiplying the         @return A CIMDateTime object that is the result of multiplying the
         calling object by the RHS operand.         calling object by the RHS operand.
         @exception DateTimeOutOfRangeException If the operation causes an         @exception DateTimeOutOfRangeException If the operation causes an
Line 310 
Line 431 
         @exception TypeMismatchException If the operands are not type         @exception TypeMismatchException If the operands are not type
         compatible (see table of operations).         compatible (see table of operations).
     */     */
     CIMDateTime & operator*=(Uint64 num);      CIMDateTime & operator*=(Uint64 x);
  
     /** 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.
Line 355 
Line 476 
  
     /** Compare two CIMDateTime objects and returns true if the LHS is     /** Compare two CIMDateTime objects and returns true if the LHS is
         less than the RHS.         less than the RHS.
         @param cDT operand on the RHS of the operator          @param x operand on the RHS of the operator
         @return true if the LHS is less than the RHS, false otherwise.         @return true if the LHS is less than the RHS, false otherwise.
         @exception DateTimeOutOfRangeException If conversion to UTC (an         @exception DateTimeOutOfRangeException If conversion to UTC (an
         internal operation) causes an overflow condition.         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& x) const;
  
     /** Compare two CIMDateTime objects and returns true if the LHS is     /** Compare two CIMDateTime objects and returns true if the LHS is
         less than or equal to the RHS.         less than or equal to the RHS.
         @param cDT operand on the RHS of the operator          @param x operand on the RHS of the operator
         @return true if the LHS is less than or equal to the RHS, false         @return true if the LHS is less than or equal to the RHS, false
         otherwise.         otherwise.
         @exception DateTimeOutOfRangeException If conversion to UTC (an         @exception DateTimeOutOfRangeException If conversion to UTC (an
Line 374 
Line 495 
         @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& x) const;
  
     /** Compare two CIMDateTime objects and returns true if the LHS is     /** Compare two CIMDateTime objects and returns true if the LHS is
         greater than the RHS.         greater than the RHS.
         @param cDT operand on the RHS of the operator          @param x operand on the RHS of the operator
         @return true if the LHS is greater than the RHS, false otherwise.         @return true if the LHS is greater than the RHS, false otherwise.
         @exception DateTimeOutOfRangeException If conversion to UTC (an         @exception DateTimeOutOfRangeException If conversion to UTC (an
         internal operation) causes an overflow condition.         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 & x) const;
  
     /** Compare two CIMDateTime objects and returns true if the LHS is     /** Compare two CIMDateTime objects and returns true if the LHS is
         greater than or equal to the RHS.         greater than or equal to the RHS.
         @param cDT operand on the RHS of the operator          @param x operand on the RHS of the operator
         @return true if the LHS is greater than or equal to the RHS, false         @return true if the LHS is greater than or equal to the RHS, false
         otherwise.         otherwise.
         @exception DateTimeOutOfRangeException If conversion to UTC (an         @exception DateTimeOutOfRangeException If conversion to UTC (an
Line 397 
Line 518 
         @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 & x) const;
  
     /** 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 x operand on the RHS of the operator
         @return true if the LHS is not equal to RHS, false otherwise.         @return true if the LHS is not equal to RHS, false otherwise.
         @exception DateTimeOutOfRangeException If conversion to UTC (an         @exception DateTimeOutOfRangeException If conversion to UTC (an
         internal operation) causes an overflow condition.         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 & x) const;
  
 private: private:
   
     CIMDateTimeRep* _rep;     CIMDateTimeRep* _rep;
     Boolean _set(const String & dateTimeStr);      CIMDateTime(CIMDateTimeRep*);
     enum Field {ONLY_WILD_CARDS, SOME_WILD_CARDS, ONLY_DIGITS, ERR};  
   
     Field fieldcheck(const String & in_p, String & rep_field);  
   
     Boolean restOfFields(Uint32 start_position,const String & inStr);  
   
     Uint64 _toMicroSeconds();  
   
     void convertToUTC();  
   
     void setUtcOffSet(Sint32 utc);  
   
     void insert_WildCard(Uint32 index);  
   
     Uint32 getHighestWildCardPosition(const CIMDateTime & cDT_s);  
 }; };
  
 /** Compares two CIMDateTime objects and returns true if they represent the /** Compares two CIMDateTime objects and returns true if they represent the
Line 446 
Line 551 
 # include <Pegasus/Common/ArrayInter.h> # include <Pegasus/Common/ArrayInter.h>
 #undef PEGASUS_ARRAY_T #undef PEGASUS_ARRAY_T
  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 #endif /* Pegasus_DateTime_h */  #endif /* Pegasus_CIMDateTime_h */


Legend:
Removed from v.1.50  
changed lines
  Added in v.1.55

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2