svcore  1.9
RealTime Struct Reference

RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions. More...

#include <RealTime.h>

Collaboration diagram for RealTime:

List of all members.

Public Member Functions

int usec () const
int msec () const
 RealTime ()
 RealTime (int s, int n)
 RealTime (const RealTime &r)
double toDouble () const
RealTimeoperator= (const RealTime &r)
RealTime operator+ (const RealTime &r) const
RealTime operator- (const RealTime &r) const
RealTime operator- () const
bool operator< (const RealTime &r) const
bool operator> (const RealTime &r) const
bool operator== (const RealTime &r) const
bool operator!= (const RealTime &r) const
bool operator>= (const RealTime &r) const
bool operator<= (const RealTime &r) const
RealTime operator* (int m) const
RealTime operator/ (int d) const
RealTime operator* (double m) const
RealTime operator/ (double d) const
double operator/ (const RealTime &r) const
 Return the ratio of two times.
std::string toString (bool align=false) const
 Return a human-readable debug-type string to full precision (probably not a format to show to a user directly).
std::string toText (bool fixedDp=false) const
 Return a user-readable string to the nearest millisecond, in a form like HH:MM:SS.mmm.
std::string toFrameText (int fps) const
 Return a user-readable string in which seconds are divided into frames (presumably at a lower frame rate than audio rate, e.g.
std::string toSecText () const
 Return a user-readable string to the nearest second, in a form like "6s" (for less than a minute) or "2:21" (for more).
std::string toXsdDuration () const
 Return a string in xsd:duration format.

Static Public Member Functions

static RealTime fromSeconds (double sec)
static RealTime fromMilliseconds (int msec)
static RealTime fromTimeval (const struct timeval &)
static RealTime fromXsdDuration (std::string xsdd)
static RealTime fromString (std::string)
 Convert a string as obtained from toString back to a RealTime object.
static long realTime2Frame (const RealTime &r, unsigned int sampleRate)
 Convert a RealTime into a sample frame at the given sample rate.
static RealTime frame2RealTime (long frame, unsigned int sampleRate)
 Convert a sample frame at the given sample rate into a RealTime.

Public Attributes

int sec
int nsec

Static Public Attributes

static const RealTime zeroTime

Detailed Description

RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions.

Definition at line 35 of file RealTime.h.


Constructor & Destructor Documentation

RealTime::RealTime ( int  s,
int  n 
)

Definition at line 44 of file RealTime.cpp.

References nsec, ONE_BILLION, and sec.

RealTime::RealTime ( const RealTime r) [inline]

Definition at line 46 of file RealTime.h.


Member Function Documentation

int RealTime::usec ( ) const [inline]

Definition at line 40 of file RealTime.h.

References nsec.

int RealTime::msec ( ) const [inline]

Definition at line 41 of file RealTime.h.

References nsec.

Referenced by toText().

RealTime RealTime::fromMilliseconds ( int  msec) [static]

Definition at line 66 of file RealTime.cpp.

References RealTime().

RealTime RealTime::fromTimeval ( const struct timeval &  tv) [static]

Definition at line 72 of file RealTime.cpp.

References RealTime().

Referenced by Profiler::end(), Profiler::Profiler(), and Profiler::update().

RealTime RealTime::fromXsdDuration ( std::string  xsdd) [static]
double RealTime::toDouble ( ) const

Definition at line 159 of file RealTime.cpp.

References nsec, ONE_BILLION, and sec.

Referenced by FeatureExtractionModelTransformer::addFeature().

RealTime& RealTime::operator= ( const RealTime r) [inline]

Definition at line 56 of file RealTime.h.

References nsec, and sec.

RealTime RealTime::operator+ ( const RealTime r) const [inline]

Definition at line 60 of file RealTime.h.

References nsec, RealTime(), and sec.

RealTime RealTime::operator- ( const RealTime r) const [inline]

Definition at line 63 of file RealTime.h.

References nsec, RealTime(), and sec.

RealTime RealTime::operator- ( ) const [inline]

Definition at line 66 of file RealTime.h.

References nsec, RealTime(), and sec.

bool RealTime::operator< ( const RealTime r) const [inline]

Definition at line 70 of file RealTime.h.

References nsec, and sec.

bool RealTime::operator> ( const RealTime r) const [inline]

Definition at line 75 of file RealTime.h.

References nsec, and sec.

bool RealTime::operator== ( const RealTime r) const [inline]

Definition at line 80 of file RealTime.h.

References nsec, and sec.

bool RealTime::operator!= ( const RealTime r) const [inline]

Definition at line 84 of file RealTime.h.

bool RealTime::operator>= ( const RealTime r) const [inline]

Definition at line 88 of file RealTime.h.

References nsec, and sec.

bool RealTime::operator<= ( const RealTime r) const [inline]

Definition at line 93 of file RealTime.h.

References nsec, and sec.

RealTime RealTime::operator* ( int  m) const

Definition at line 397 of file RealTime.cpp.

References fromSeconds(), nsec, ONE_BILLION, and sec.

RealTime RealTime::operator/ ( int  d) const

Definition at line 405 of file RealTime.cpp.

References nsec, ONE_BILLION, RealTime(), and sec.

RealTime RealTime::operator* ( double  m) const

Definition at line 416 of file RealTime.cpp.

References fromSeconds(), nsec, ONE_BILLION, and sec.

RealTime RealTime::operator/ ( double  d) const

Definition at line 424 of file RealTime.cpp.

References fromSeconds(), nsec, ONE_BILLION, and sec.

double RealTime::operator/ ( const RealTime r) const

Return the ratio of two times.

Definition at line 432 of file RealTime.cpp.

References nsec, ONE_BILLION, and sec.

std::string RealTime::toString ( bool  align = false) const

Return a human-readable debug-type string to full precision (probably not a format to show to a user directly).

If align is true, prepend " " to the start of positive values so that they line up with negative ones (which start with "-").

Definition at line 191 of file RealTime.cpp.

References zeroTime.

Referenced by SparseModel< RegionRec >::getData(), PathPoint::toDelimitedDataString(), OneDimensionalPoint::toDelimitedDataString(), TimeValuePoint::toDelimitedDataString(), TextPoint::toDelimitedDataString(), ImagePoint::toDelimitedDataString(), RegionRec::toDelimitedDataString(), Note::toDelimitedDataString(), FlexiNote::toDelimitedDataString(), Transform::toXml(), and toXsdDuration().

RealTime RealTime::fromString ( std::string  s) [static]

Convert a string as obtained from toString back to a RealTime object.

Definition at line 208 of file RealTime.cpp.

References nsec, RealTime(), and sec.

Referenced by Transform::setFromXmlAttributes().

std::string RealTime::toFrameText ( int  fps) const

Return a user-readable string in which seconds are divided into frames (presumably at a lower frame rate than audio rate, e.g.

24 or 25 video frames), in a form like HH:MM:SS:FF. fps gives the number of frames per second, and must be integral (29.97 not supported).

Definition at line 314 of file RealTime.cpp.

References nsec, ONE_BILLION, sec, and zeroTime.

Referenced by toText().

std::string RealTime::toSecText ( ) const

Return a user-readable string to the nearest second, in a form like "6s" (for less than a minute) or "2:21" (for more).

Definition at line 360 of file RealTime.cpp.

References sec, and zeroTime.

std::string RealTime::toXsdDuration ( ) const

Return a string in xsd:duration format.

Definition at line 390 of file RealTime.cpp.

References toString().

Referenced by RDFTransformFactoryImpl::writeTransformToRDF().

long RealTime::realTime2Frame ( const RealTime r,
unsigned int  sampleRate 
) [static]

Member Data Documentation


The documentation for this struct was generated from the following files: