#include <WOscTimeTag.h>
Inherited by WOscBundle, and WOscQueueItem.
Public Types | |
enum | Constants { TIME_TAG_SIZE = 8 } |
Public Member Functions | |
WOscTimeTag () | |
WOscTimeTag (const char *rawTimeTag) | |
WOscTimeTag (const WOscTimeTag &rhs) | |
void | SetToCurrentTime (const WOscSystemTime *systemTime=NULL) |
void | SetToImmediateTime () |
void | SetToLargestTimeTag () |
void | SetToSmallestTimeTag () |
WOscTimeTag | operator+ (const WOscTimeTag &rhs) const |
WOscTimeTag | operator+= (const WOscTimeTag &rhs) |
WOscTimeTag | operator= (const WOscTimeTag &rhs) |
WOscTimeTag | operator- (const WOscTimeTag &rhs) const |
WOscTimeTag | operator-= (const WOscTimeTag &rhs) |
bool | operator< (const WOscTimeTag &rhs) const |
bool | operator<= (const WOscTimeTag &rhs) const |
bool | operator== (const WOscTimeTag &rhs) const |
bool | operator!= (const WOscTimeTag &rhs) const |
bool | operator> (const WOscTimeTag &rhs) const |
bool | operator>= (const WOscTimeTag &rhs) const |
const char * | ToCharArray () const |
void | WriteToCharArray (char *buffer) const |
void | InitFromCharArray (const char *buffer) |
uint64_t | GetRawTimeTag () const |
Static Public Member Functions | |
static WOscTimeTag | GetCurrentTime (const WOscSystemTime *systemTime=NULL) |
static WOscTimeTag | GetImmediateTime () |
static WOscTimeTag | GetLargestTimeTag () |
static WOscTimeTag | GetSmallestTimeTag () |
Friends | |
class | WOscSystemTime |
Definition of time in an OSC system. The OSC-specification ( OSC specifications ) states: Time tags are represented by a 64 bit fixed point number. The first 32 bits specify the number of seconds since midnight on January 1, 1900, and the last 32 bits specify fractional parts of a second to a precision of about 200 picoseconds. This is the rep- resentation used by Internet NTP timestamps. The time tag value consisting of 63 zero bits followed by a one in the least signifigant bit is a special case meaning "immediately."
WOscClient.cpp, and WOscServer.cpp.
Definition at line 87 of file WOscTimeTag.h.
Time-tag related constants.
Reimplemented in WOscBundle.
Definition at line 126 of file WOscTimeTag.h.
00127 { 00128 TIME_TAG_SIZE = 8, /**< buffer size for char-arrayed timetags.*/ 00129 };
WOscTimeTag::WOscTimeTag | ( | ) |
Constructor Initializes the time-tag to immediate time.
Definition at line 96 of file WOscTimeTag.cpp.
WOscTimeTag::WOscTimeTag | ( | const char * | rawTimeTag | ) |
Construct an OSC-time tag from a raw OSC (network) byte- stream (buffer). The OSC (network) buffer has to be big-endian
rawTimeTag | Buffer containing the raw time-tag |
Definition at line 113 of file WOscTimeTag.cpp.
References InitFromCharArray().
00114 { 00115 InitFromCharArray(rawTimeTag); 00116 }
WOscTimeTag::WOscTimeTag | ( | const WOscTimeTag & | rhs | ) |
Copy constructor. Initializes the current time-tag with the data from the referenced.
rhs | Reference of time-tag to be copied. |
Definition at line 124 of file WOscTimeTag.cpp.
WOscTimeTag WOscTimeTag::GetCurrentTime | ( | const WOscSystemTime * | systemTime = NULL |
) | [static] |
Returns the current system time. A optional system-time object can be passed, which implements the system specific system-time-query.
systemTime | Pointer to system time object (optional). If not specified, The system time gets initialized with the library default system time. |
Definition at line 141 of file WOscTimeTag.cpp.
References WOscSystemTime::GetSystemTime().
Referenced by WOscReceiver::ManagePriorityQueue().
00141 { 00142 if ( systemTime == NULL ){ 00143 /* get library default */ 00144 WOscSystemTime time; 00145 return time.GetSystemTime(); 00146 }else 00147 return systemTime->GetSystemTime(); 00148 }
WOscTimeTag WOscTimeTag::GetImmediateTime | ( | ) | [static] |
Returns the "immediate" time-tag. Immediate implies the LSB set to one.
Definition at line 157 of file WOscTimeTag.cpp.
Referenced by GetSmallestTimeTag(), WOscBundleParser::GetTimeTag(), and SetToImmediateTime().
00158 { 00159 WOscTimeTag retTag; 00160 retTag.m_timeTag = 1; 00161 return retTag; 00162 }
WOscTimeTag WOscTimeTag::GetLargestTimeTag | ( | ) | [static] |
Returns the largest possible time-tag. I.e. all bits set to one.
Definition at line 171 of file WOscTimeTag.cpp.
Referenced by WOscPriorityQueue::GetEarliestTimeTag(), WOscSystemTime::GetSystemTime(), and SetToLargestTimeTag().
00172 { 00173 WOscTimeTag retTag; 00174 retTag.m_timeTag = ULONG_LONG_MAX; 00175 return retTag; 00176 }
WOscTimeTag WOscTimeTag::GetSmallestTimeTag | ( | ) | [static] |
Returns the "immediate" time-tag. Immediate implies the LSB set to one.
Definition at line 185 of file WOscTimeTag.cpp.
References GetImmediateTime().
Referenced by SetToSmallestTimeTag().
00186 { 00187 return GetImmediateTime(); 00188 }
void WOscTimeTag::InitFromCharArray | ( | const char * | buffer | ) |
Initializes an OSC time tag from a byte stream (big endian ordered). The byte stream buffer has to have a minimum length of TIME_TAG_SIZE.
buffer | Pointer to buffer with initialization data. |
Definition at line 479 of file WOscTimeTag.cpp.
Referenced by WOscTimeTag().
bool WOscTimeTag::operator!= | ( | const WOscTimeTag & | rhs | ) | const |
Is not equal operator. Returns true if the right time-tag is different from the left.
rhs | Right-hand side. |
Definition at line 391 of file WOscTimeTag.cpp.
WOscTimeTag WOscTimeTag::operator+ | ( | const WOscTimeTag & | rhs | ) | const |
Add operator. Adds the right-hand time-tag to the left-hand time-tag and returns the result without modifying the left-hand time-tag.
rhs | Right-hand time-tag reference to be added to the left one. |
Definition at line 252 of file WOscTimeTag.cpp.
00253 { 00254 WOscTimeTag retTag; 00255 retTag.m_timeTag = m_timeTag + rhs.m_timeTag; 00256 return retTag; 00257 }
WOscTimeTag WOscTimeTag::operator+= | ( | const WOscTimeTag & | rhs | ) |
Add and assign operator. Adds the right-hand time-tag to the left-hand time-tag, stores the result in the left-hand time-tag and returns the result.
rhs | Right-hand time-tag reference to be added to the left one. |
Definition at line 288 of file WOscTimeTag.cpp.
WOscTimeTag WOscTimeTag::operator- | ( | const WOscTimeTag & | rhs | ) | const |
Subtract operator. Subtracts the right-hand time-tag from the left-hand time-tag and returns the result without modifying the left-hand time-tag.
rhs | Right-hand time-tag reference to be subtracted from the left one. |
Definition at line 305 of file WOscTimeTag.cpp.
00306 { 00307 WOscTimeTag retTag; 00308 retTag.m_timeTag = m_timeTag - rhs.m_timeTag; 00309 return retTag; 00310 }
WOscTimeTag WOscTimeTag::operator-= | ( | const WOscTimeTag & | rhs | ) |
Subtract and assign operator. Subtracts the right-hand time-tag from the left-hand time-tag, stores the result in the left-hand time-tag and returns the result.
rhs | Right-hand time-tag reference to be subtracted from the left one. |
Definition at line 324 of file WOscTimeTag.cpp.
bool WOscTimeTag::operator< | ( | const WOscTimeTag & | rhs | ) | const |
Smaller or equal comparison operator. Returns true if the left time-tag is smaller (older) than the right.
rhs | Right-hand side. |
Definition at line 342 of file WOscTimeTag.cpp.
bool WOscTimeTag::operator<= | ( | const WOscTimeTag & | rhs | ) | const |
Smaller or equal comparison operator. Returns true if the left time-tag is smaller (older) or equal (same time) than the right.
rhs | Right-hand side. |
Definition at line 359 of file WOscTimeTag.cpp.
WOscTimeTag WOscTimeTag::operator= | ( | const WOscTimeTag & | rhs | ) |
Assignment operator. Assigns the right-hand time-tag to the left-hand time-tag and returns it.
rhs | Right-hand time-tag reference to be assigned to the left one. |
Definition at line 270 of file WOscTimeTag.cpp.
bool WOscTimeTag::operator== | ( | const WOscTimeTag & | rhs | ) | const |
Is equal operator. Returns true if the right time-tag is equal to the left.
rhs | Right-hand side. |
Definition at line 375 of file WOscTimeTag.cpp.
bool WOscTimeTag::operator> | ( | const WOscTimeTag & | rhs | ) | const |
Bigger comparison operator. Returns true if the right time-tag is smaller (older) than the left.
rhs | Right-hand side. |
Definition at line 408 of file WOscTimeTag.cpp.
bool WOscTimeTag::operator>= | ( | const WOscTimeTag & | rhs | ) | const |
Bigger or equal comparison operator. Returns true if the right time-tag is smaller (older) or equal (same time) than the left.
rhs | Right-hand side. |
Definition at line 425 of file WOscTimeTag.cpp.
void WOscTimeTag::SetToCurrentTime | ( | const WOscSystemTime * | systemTime = NULL |
) |
Sets this time-tag to the current system time. A optional system-time object can be passed, which implements the system specific system-time-query.
systemTime | Pointer to system time object (optional). If not specified, The system time gets initialized with the library default system time. |
Definition at line 203 of file WOscTimeTag.cpp.
References WOscSystemTime::GetSystemTime().
00204 { 00205 *this = systemTime->GetSystemTime(); 00206 }
void WOscTimeTag::SetToImmediateTime | ( | ) |
Sets this time tag to immediate time.
Definition at line 214 of file WOscTimeTag.cpp.
References GetImmediateTime().
00215 { 00216 *this = GetImmediateTime(); 00217 }
void WOscTimeTag::SetToLargestTimeTag | ( | ) |
Sets this time tag to the biggest time-tag possible.
Definition at line 225 of file WOscTimeTag.cpp.
References GetLargestTimeTag().
00226 { 00227 *this = GetLargestTimeTag(); 00228 }
void WOscTimeTag::SetToSmallestTimeTag | ( | ) |
Sets this time tag to the smallest time-tag possible.
Definition at line 236 of file WOscTimeTag.cpp.
References GetSmallestTimeTag().
00237 { 00238 *this = GetSmallestTimeTag(); 00239 }
const char * WOscTimeTag::ToCharArray | ( | ) | const |
Returns a new char array of size TIME_TAG_SIZE filled with the network aligned (big endian) timetag.
The caller has to free the allocated memory.
Definition at line 444 of file WOscTimeTag.cpp.
void WOscTimeTag::WriteToCharArray | ( | char * | buffer | ) | const |
Fill the given buffer with the network char array representation of an OSC time tag.
buffer | Caller supplied buffer with a minimum size of TIME_TAG_SIZE. |
Definition at line 461 of file WOscTimeTag.cpp.