OW_NAMESPACE::CIMDateTime Class Reference

The CIMDateTime class represents the CIM datetime data type. More...

#include <OW_CIMDateTime.hpp>

Collaboration diagram for OW_NAMESPACE::CIMDateTime:

Collaboration graph
[legend]
List of all members.

Public Types

typedef COWIntrusiveReference<
DateTimeData > CIMDateTime::* 
safe_bool
enum  EErrorCodes { E_INVALID_DATE_TIME_FORMAT }

Public Member Functions

 CIMDateTime ()
 Create a new interval type of CIMDateTime set to 0's.
 ~CIMDateTime ()
 CIMDateTime (CIMNULL_t)
 Create a new interval type of CIMDateTime this object will have a null implementation.
 CIMDateTime (const CIMDateTime &arg)
 Create a new CIMDateTime object that is a copy of another.
 CIMDateTime (const String &arg)
 Create a new CIMDateTime object from a string representation of a CIM DateTime (See description of this string format in the class documentation of CIMDateTime.
 CIMDateTime (const DateTime &arg)
 Create an CIMDateTime object from a regular DateTime object.
 CIMDateTime (UInt64 microSeconds)
 Create an CIMDateTime object that represents an interval.
CIMDateTimeoperator= (const CIMDateTime &arg)
 Assignment operation.
UInt16 getYear () const
UInt8 getMonth () const
UInt32 getDays () const
UInt32 getDay () const
UInt8 getHours () const
UInt8 getMinutes () const
UInt8 getSeconds () const
UInt32 getMicroSeconds () const
Int16 getUtc () const
bool equal (const CIMDateTime &arg) const
 Check if another CIMDateTime object is equal to this one.
CIMDateTimesetYear (UInt16 arg)
 Set the year component of the CIMDateTime object.
CIMDateTimesetMonth (UInt8 arg)
 Set the month component of the CIMDateTime object.
CIMDateTimesetDays (UInt32 arg)
 Set the days component of the CIMDateTime object.
CIMDateTimesetDay (UInt32 arg)
 Set the day component of the CIMDateTime object.
CIMDateTimesetHours (UInt8 arg)
 Set the hours component of the CIMDateTime object.
CIMDateTimesetMinutes (UInt8 arg)
 Set the minutes component of the CIMDateTime object.
CIMDateTimesetSeconds (UInt8 arg)
 Set the seconds component of the CIMDateTime object.
CIMDateTimesetMicroSeconds (UInt32 arg)
 Set the microseconds component of the CIMDateTime object.
CIMDateTimesetUtc (Int16 arg)
 Set the utc offset component of the CIMDateTime object.
bool isInterval () const
void setInterval (bool val)
void readObject (std::istream &istrm)
 Read this object from an input stream.
void writeObject (std::ostream &ostrm) const
 Write this object to an output stream.
String toString () const
DateTime toDateTime () const
 operator safe_bool () const
bool operator! () const

Private Attributes

COWIntrusiveReference< DateTimeDatam_dptr

Friends

OW_COMMON_API bool operator== (const CIMDateTime &x, const CIMDateTime &y)
OW_COMMON_API bool operator< (const CIMDateTime &x, const CIMDateTime &y)
 Compare 2 CIMDateTime instances.

Classes

struct  DateTimeData

Detailed Description

The CIMDateTime class represents the CIM datetime data type.

Recall that a CIM datetime may contain a date or an interval.

A date has the following form:

yyyymmddhhmmss.mmmmmmsutc

Where

yyyy = year (0000-9999) mm = month (01-12) dd = day (01-31) hh = hour (00-23) mm = minute (00-59) ss = second (00-60) normally 59, but a leap second may be present mmmmmm = microseconds (0-999999). s = '+' or '-' to represent the UTC sign. utc = UTC offset (same as GMT offset). utc is the offset from UTC in minutes. It's worth noting that when daylight saving time is in effect, the utc will be different then when it's not.

An interval has the following form:

ddddddddhhmmss.mmmmmm:000

Where

dddddddd = days hh = hours mm = minutes ss = seconds mmmmmm = microseconds

Note that intervals always end in ":000" (this is how they are distinguished from dates).

Intervals are really durations since they do not specify a start and end time (as one expects when speaking about an interval). It is better to think of an interval as specifying time elapsed since some event.

Values must be zero-padded so that the entire string is always the same 25-character length. Fields which are not significant must be replaced with asterisk characters.

CIMDateTime objects are constructed from C character strings or from DateTime objects. These character strings must be exactly twenty-five characters and conform to one of the forms idententified above.

CIMDateTime objects which are not explicitly initialized will be implicitly initialized with the null time interval:

00000000000000.000000:000

Instances can be tested for nullness with the isNull() method.

Definition at line 113 of file OW_CIMDateTime.hpp.


Member Typedef Documentation

typedef COWIntrusiveReference<DateTimeData> CIMDateTime::* OW_NAMESPACE::CIMDateTime::safe_bool
 

Definition at line 308 of file OW_CIMDateTime.hpp.


Member Enumeration Documentation

enum OW_NAMESPACE::CIMDateTime::EErrorCodes
 

Enumerator:
E_INVALID_DATE_TIME_FORMAT 

Definition at line 134 of file OW_CIMDateTime.hpp.


Constructor & Destructor Documentation

OW_NAMESPACE::CIMDateTime::CIMDateTime  ) 
 

Create a new interval type of CIMDateTime set to 0's.

Definition at line 85 of file OW_CIMDateTime.cpp.

OW_NAMESPACE::CIMDateTime::~CIMDateTime  ) 
 

Definition at line 90 of file OW_CIMDateTime.cpp.

OW_NAMESPACE::CIMDateTime::CIMDateTime CIMNULL_t   )  [explicit]
 

Create a new interval type of CIMDateTime this object will have a null implementation.

Definition at line 94 of file OW_CIMDateTime.cpp.

OW_NAMESPACE::CIMDateTime::CIMDateTime const CIMDateTime arg  ) 
 

Create a new CIMDateTime object that is a copy of another.

Parameters:
arg The CIMDateTime object to make a copy of.

Definition at line 99 of file OW_CIMDateTime.cpp.

OW_NAMESPACE::CIMDateTime::CIMDateTime const String arg  )  [explicit]
 

Create a new CIMDateTime object from a string representation of a CIM DateTime (See description of this string format in the class documentation of CIMDateTime.

Parameters:
arg An String that contains the string form of the CIM Date time.
Exceptions:
CIMDateTimeException E_INVALID_DATE_TIME_FORMAT if arg isn't a valid CIM date time string.

Definition at line 104 of file OW_CIMDateTime.cpp.

References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::fillDateTimeData(), and m_dptr.

OW_NAMESPACE::CIMDateTime::CIMDateTime const DateTime arg  ) 
 

Create an CIMDateTime object from a regular DateTime object.

This constructor is *not* explicit so that a DateTime can be used where a CIMDateTime may be required.

Parameters:
arg The DateTime object to use in determining the value of this CIMDateTime object.

Definition at line 110 of file OW_CIMDateTime.cpp.

References OW_NAMESPACE::DateTime::getMicrosecond(), m_dptr, and OW_NAMESPACE::DateTime::toLocal().

OW_NAMESPACE::CIMDateTime::CIMDateTime UInt64  microSeconds  )  [explicit]
 

Create an CIMDateTime object that represents an interval.

Parameters:
microSeconds The number of micro seconds that this interval represents.

Definition at line 125 of file OW_CIMDateTime.cpp.

References m_dptr.


Member Function Documentation

bool OW_NAMESPACE::CIMDateTime::equal const CIMDateTime arg  )  const
 

Check if another CIMDateTime object is equal to this one.

Parameters:
arg The CIMDateTime object to check for equality with this one.
Returns:
true if the given CIMDateTime object is equal to this one. Otherwise false.

Definition at line 247 of file OW_CIMDateTime.cpp.

References m_dptr.

Referenced by OW_NAMESPACE::operator==().

UInt32 OW_NAMESPACE::CIMDateTime::getDay  )  const
 

Returns:
The day component of this CIMDateTime object as an UInt32. Range (1-31)

Definition at line 395 of file OW_CIMDateTime.cpp.

References m_dptr.

UInt32 OW_NAMESPACE::CIMDateTime::getDays  )  const
 

Returns:
The days component of this CIMDateTime object as an UInt32. Range (1-31)

Definition at line 392 of file OW_CIMDateTime.cpp.

References m_dptr.

UInt8 OW_NAMESPACE::CIMDateTime::getHours  )  const
 

Returns:
The hours component of this CIMDateTime object as an UInt8. Range (0-23)

Definition at line 398 of file OW_CIMDateTime.cpp.

References m_dptr.

UInt32 OW_NAMESPACE::CIMDateTime::getMicroSeconds  )  const
 

Returns:
The microseconds component of this CIMDateTime object as an UInt32. Range (0-999999)

Definition at line 407 of file OW_CIMDateTime.cpp.

References m_dptr.

UInt8 OW_NAMESPACE::CIMDateTime::getMinutes  )  const
 

Returns:
The minutes component of this CIMDateTime object as an UInt8. Range (0-59)

Definition at line 401 of file OW_CIMDateTime.cpp.

References m_dptr.

UInt8 OW_NAMESPACE::CIMDateTime::getMonth  )  const
 

Returns:
The month component of this CIMDateTime object as an UInt8. Range (1-12)

Definition at line 389 of file OW_CIMDateTime.cpp.

References m_dptr.

Referenced by OW_NAMESPACE::getMagnitude().

UInt8 OW_NAMESPACE::CIMDateTime::getSeconds  )  const
 

Returns:
The seconds component of this CIMDateTime object as an UInt8. Range (0-60) - 60 in the case of a leap second

Definition at line 404 of file OW_CIMDateTime.cpp.

References m_dptr.

Int16 OW_NAMESPACE::CIMDateTime::getUtc  )  const
 

Returns:
The utc offset component of this CIMDateTime object as an Int16

Definition at line 410 of file OW_CIMDateTime.cpp.

References m_dptr.

UInt16 OW_NAMESPACE::CIMDateTime::getYear  )  const
 

Returns:
The year component of this CIMDateTime object as an UInt16. Range (0-9999)

Definition at line 386 of file OW_CIMDateTime.cpp.

References m_dptr.

bool OW_NAMESPACE::CIMDateTime::isInterval  )  const
 

Returns:
true if this CIMDateTime object represents an interval type of CIM date time.

Definition at line 413 of file OW_CIMDateTime.cpp.

References m_dptr.

Referenced by OW_NAMESPACE::getMagnitude(), OW_NAMESPACE::operator<(), and toString().

OW_NAMESPACE::CIMDateTime::operator CIMDateTime::safe_bool  )  const
 

Returns:
true If this CIMDateTime is not comprised of zero values.

Definition at line 151 of file OW_CIMDateTime.cpp.

References m_dptr.

bool OW_NAMESPACE::CIMDateTime::operator!  )  const
 

Definition at line 168 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::operator= const CIMDateTime arg  ) 
 

Assignment operation.

Parameters:
arg The CIMDateTime object to assign to this one.
Returns:
A reference to this CIMDataTime object after the assignment is made.

Definition at line 145 of file OW_CIMDateTime.cpp.

References m_dptr.

void OW_NAMESPACE::CIMDateTime::readObject std::istream &  istrm  ) 
 

Read this object from an input stream.

Parameters:
istrm The input stream to read this object from.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setDay UInt32  arg  ) 
 

Set the day component of the CIMDateTime object.

Parameters:
arg The new day for this object. Valid values are 1-31
Returns:
a reference to *this

Definition at line 205 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setDays UInt32  arg  ) 
 

Set the days component of the CIMDateTime object.

Parameters:
arg The new days value for this object. Valid values are 1-31
Returns:
a reference to *this

Definition at line 198 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setHours UInt8  arg  ) 
 

Set the hours component of the CIMDateTime object.

Parameters:
arg The new hours value for this object. Valid values are 0-23
Returns:
a reference to *this

Definition at line 212 of file OW_CIMDateTime.cpp.

References m_dptr.

void OW_NAMESPACE::CIMDateTime::setInterval bool  val  ) 
 

Parameters:
val bool indicating whether this is an interval

Definition at line 416 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setMicroSeconds UInt32  arg  ) 
 

Set the microseconds component of the CIMDateTime object.

Parameters:
arg The new microseconds value for this object. Valid values are 0-999999
Returns:
a reference to *this

Definition at line 233 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setMinutes UInt8  arg  ) 
 

Set the minutes component of the CIMDateTime object.

Parameters:
arg The new minutes value for this object. Valid values are 0-59
Returns:
a reference to *this

Definition at line 219 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setMonth UInt8  arg  ) 
 

Set the month component of the CIMDateTime object.

Parameters:
arg The new month for this object. Valid values are 1-12
Returns:
a reference to *this

Definition at line 191 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setSeconds UInt8  arg  ) 
 

Set the seconds component of the CIMDateTime object.

Parameters:
arg The new seconds value for this object. Valid values are 0-60 (60 only for minutes that have leap seconds)
Returns:
a reference to *this

Definition at line 226 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setUtc Int16  arg  ) 
 

Set the utc offset component of the CIMDateTime object.

Parameters:
arg The new utc offset for this object.
Returns:
a reference to *this

Definition at line 240 of file OW_CIMDateTime.cpp.

References m_dptr.

CIMDateTime & OW_NAMESPACE::CIMDateTime::setYear UInt16  arg  ) 
 

Set the year component of the CIMDateTime object.

Parameters:
arg The new year for this object. Valid values are 0-9999
Returns:
a reference to *this

Definition at line 184 of file OW_CIMDateTime.cpp.

References m_dptr.

DateTime OW_NAMESPACE::CIMDateTime::toDateTime  )  const
 

Returns:
a DateTime object that corresponds to this CIMDateTime.

Definition at line 321 of file OW_CIMDateTime.cpp.

References toString().

String OW_NAMESPACE::CIMDateTime::toString  )  const
 

Returns:
the string representation of this CIMDateTime object. (see description of string format in documentation of class CIMDateTime)

Definition at line 300 of file OW_CIMDateTime.cpp.

References isInterval(), and m_dptr.

Referenced by OW_NAMESPACE::StringBuffer::operator+=(), OW_NAMESPACE::operator<<(), OW_NAMESPACE::String::String(), toDateTime(), and OW_NAMESPACE::toString().

void OW_NAMESPACE::CIMDateTime::writeObject std::ostream &  ostrm  )  const
 

Write this object to an output stream.

Parameters:
ostrm The output stream to write this object to.


Friends And Related Function Documentation

OW_COMMON_API bool operator< const CIMDateTime x,
const CIMDateTime y
[friend]
 

Compare 2 CIMDateTime instances.

An interval is always less than a date/time. Comparing a CIMNULL instance is undefined, and may throw a COWNULLReference exception or dereference a NULL pointer. The result of a comparison with an invalid date/time (any value out of range) is undefined.

Definition at line 465 of file OW_CIMDateTime.cpp.

OW_COMMON_API bool operator== const CIMDateTime x,
const CIMDateTime y
[friend]
 

Definition at line 419 of file OW_CIMDateTime.cpp.


Member Data Documentation

COWIntrusiveReference<DateTimeData> OW_NAMESPACE::CIMDateTime::m_dptr [private]
 

Definition at line 321 of file OW_CIMDateTime.hpp.

Referenced by CIMDateTime(), equal(), getDay(), getDays(), getHours(), getMicroSeconds(), getMinutes(), getMonth(), getSeconds(), getUtc(), getYear(), isInterval(), operator safe_bool(), operator!(), operator=(), setDay(), setDays(), setHours(), setInterval(), setMicroSeconds(), setMinutes(), setMonth(), setSeconds(), setUtc(), setYear(), and toString().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:12:24 2006 for openwbem by  doxygen 1.4.6