OWBI1::CIMDateTime Class Reference

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

#include <OWBI1_CIMDateTime.hpp>

Collaboration diagram for OWBI1::CIMDateTime:

Collaboration graph
[legend]
List of all members.

Public Types

typedef detail::CIMDateTimeRepRef
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.
 CIMDateTime (const detail::CIMDateTimeRepRef &rep)
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
detail::CIMDateTimeRepRef getRep () const

Private Attributes

detail::CIMDateTimeRepRef m_rep

Friends

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

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 OWBI1_CIMDateTime.hpp.


Member Typedef Documentation

typedef detail::CIMDateTimeRepRef CIMDateTime::* OWBI1::CIMDateTime::safe_bool
 

Definition at line 310 of file OWBI1_CIMDateTime.hpp.


Member Enumeration Documentation

enum OWBI1::CIMDateTime::EErrorCodes
 

Enumerator:
E_INVALID_DATE_TIME_FORMAT 

Definition at line 133 of file OWBI1_CIMDateTime.hpp.


Constructor & Destructor Documentation

OWBI1::CIMDateTime::CIMDateTime  ) 
 

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

Definition at line 60 of file OWBI1_CIMDateTime.cpp.

OWBI1::CIMDateTime::~CIMDateTime  ) 
 

Definition at line 65 of file OWBI1_CIMDateTime.cpp.

OWBI1::CIMDateTime::CIMDateTime CIMNULL_t   )  [explicit]
 

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

Definition at line 69 of file OWBI1_CIMDateTime.cpp.

OWBI1::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 74 of file OWBI1_CIMDateTime.cpp.

OWBI1::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 79 of file OWBI1_CIMDateTime.cpp.

OWBI1::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 84 of file OWBI1_CIMDateTime.cpp.

OWBI1::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 89 of file OWBI1_CIMDateTime.cpp.

OWBI1::CIMDateTime::CIMDateTime const detail::CIMDateTimeRepRef rep  )  [explicit]
 

Definition at line 95 of file OWBI1_CIMDateTime.cpp.


Member Function Documentation

bool OWBI1::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 184 of file OWBI1_CIMDateTime.cpp.

References m_rep.

Referenced by OWBI1::operator==().

UInt32 OWBI1::CIMDateTime::getDay  )  const
 

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

Definition at line 231 of file OWBI1_CIMDateTime.cpp.

References m_rep.

UInt32 OWBI1::CIMDateTime::getDays  )  const
 

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

Definition at line 228 of file OWBI1_CIMDateTime.cpp.

References m_rep.

UInt8 OWBI1::CIMDateTime::getHours  )  const
 

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

Definition at line 234 of file OWBI1_CIMDateTime.cpp.

References m_rep.

UInt32 OWBI1::CIMDateTime::getMicroSeconds  )  const
 

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

Definition at line 243 of file OWBI1_CIMDateTime.cpp.

References m_rep.

UInt8 OWBI1::CIMDateTime::getMinutes  )  const
 

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

Definition at line 237 of file OWBI1_CIMDateTime.cpp.

References m_rep.

UInt8 OWBI1::CIMDateTime::getMonth  )  const
 

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

Definition at line 225 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTimeRepRef OWBI1::CIMDateTime::getRep  )  const
 

Definition at line 256 of file OWBI1_CIMDateTime.cpp.

References m_rep.

UInt8 OWBI1::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 240 of file OWBI1_CIMDateTime.cpp.

References m_rep.

Int16 OWBI1::CIMDateTime::getUtc  )  const
 

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

Definition at line 246 of file OWBI1_CIMDateTime.cpp.

References m_rep.

UInt16 OWBI1::CIMDateTime::getYear  )  const
 

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

Definition at line 222 of file OWBI1_CIMDateTime.cpp.

References m_rep.

bool OWBI1::CIMDateTime::isInterval  )  const
 

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

Definition at line 249 of file OWBI1_CIMDateTime.cpp.

References m_rep.

OWBI1::CIMDateTime::operator CIMDateTime::safe_bool  )  const
 

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

Definition at line 108 of file OWBI1_CIMDateTime.cpp.

References m_rep.

bool OWBI1::CIMDateTime::operator!  )  const
 

Definition at line 115 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 102 of file OWBI1_CIMDateTime.cpp.

References m_rep.

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

Read this object from an input stream.

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

CIMDateTime & OWBI1::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 142 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 135 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 149 of file OWBI1_CIMDateTime.cpp.

References m_rep.

void OWBI1::CIMDateTime::setInterval bool  val  ) 
 

Parameters:
val bool indicating whether this is an interval

Definition at line 252 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 170 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 156 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 128 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 163 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 177 of file OWBI1_CIMDateTime.cpp.

References m_rep.

CIMDateTime & OWBI1::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 121 of file OWBI1_CIMDateTime.cpp.

References m_rep.

DateTime OWBI1::CIMDateTime::toDateTime  )  const
 

Returns:
a DateTime object that corresponds to this CIMDateTime.

Definition at line 208 of file OWBI1_CIMDateTime.cpp.

References toString().

String OWBI1::CIMDateTime::toString  )  const
 

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

Definition at line 202 of file OWBI1_CIMDateTime.cpp.

References m_rep.

Referenced by OWBI1::operator<<(), and toDateTime().

void OWBI1::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

OWBI1_OWBI1PROVIFC_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 267 of file OWBI1_CIMDateTime.cpp.

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

Definition at line 262 of file OWBI1_CIMDateTime.cpp.


Member Data Documentation

detail::CIMDateTimeRepRef OWBI1::CIMDateTime::m_rep [private]
 

Definition at line 325 of file OWBI1_CIMDateTime.hpp.

Referenced by equal(), getDay(), getDays(), getHours(), getMicroSeconds(), getMinutes(), getMonth(), getRep(), getSeconds(), getUtc(), getYear(), isInterval(), operator safe_bool(), operator!(), OWBI1::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:18:03 2006 for openwbem by  doxygen 1.4.6