Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

TimeInterval Class Reference

Class for measuring time intervals. More...

#include <timeinterval.hpp>

List of all members.

Public Member Functions

 TimeInterval ()
 Default construtor.
 TimeInterval (const timespec a, const timespec b)
 Constructor with the timestamps a and b.
void setInterval (const timespec a, const timespec b)
 Set the timespecs of an interval.
void getInterval (timespec &a, timespec &b) const
 Get the timespecs of an interval.
void measureA ()
 Measures the first timestamp of the interval.
void measureB ()
 Measures the second timestamp of the interval.
timespec getDifference () const
 Calculates delta between two timespecs.
int compareDifference (const timespec &a) const
 Compares TimeInterval's delta with a timespec.
string toString () const
 Converts a TimeInterval to a string.

Static Public Member Functions

int compareTimespecs (const timespec &a, const timespec &b)
 Compares two timespecs.
timespec addTimespecs (const timespec &a, const timespec &b)
 Add two timespecs.
timespec subTimespecs (const timespec &a, const timespec &b)
 Subtracts two timespecs.
string timespecToString (const timespec &a)
 Converts a timespec to a string.

Protected Attributes

timespec interval [2]


Detailed Description

Class for measuring time intervals.

This is the basic method of measuring time for events in PTF.

Definition at line 30 of file timeinterval.hpp.


Constructor & Destructor Documentation

TimeInterval::TimeInterval  ) 
 

Default construtor.

Definition at line 35 of file timeinterval.cpp.

References interval.

TimeInterval::TimeInterval const timespec  a,
const timespec  b
 

Constructor with the timestamps a and b.

Definition at line 27 of file timeinterval.cpp.

References interval.


Member Function Documentation

timespec TimeInterval::addTimespecs const timespec &  a,
const timespec &  b
[static]
 

Add two timespecs.

Returns:
added timespecs
Definition at line 125 of file timeinterval.cpp.

Referenced by SimpleReactionHandler::handle().

int TimeInterval::compareDifference const timespec &  a  )  const
 

Compares TimeInterval's delta with a timespec.

Returns:
given timespec less (-1), equal (0) or greater (1) compared to TimeInterval's delta
Definition at line 96 of file timeinterval.cpp.

References getDifference().

Referenced by Parallel::output(), and Scheduler::wait().

Here is the call graph for this function:

int TimeInterval::compareTimespecs const timespec &  a,
const timespec &  b
[static]
 

Compares two timespecs.

Returns:
a = b (0), a < b (-1), a > b (1)
Definition at line 111 of file timeinterval.cpp.

Referenced by SimpleReactionHandler::handle().

timespec TimeInterval::getDifference  )  const
 

Calculates delta between two timespecs.

Returns:
delta of the interval
Definition at line 78 of file timeinterval.cpp.

References interval.

Referenced by compareDifference(), and Scheduler::schedule().

void TimeInterval::getInterval timespec &  a,
timespec &  b
const
 

Get the timespecs of an interval.

Parameters:
a start of the interval,
b end of the interval
Definition at line 55 of file timeinterval.cpp.

References interval.

Referenced by SimpleReactionHandler::handle(), and Task::Task().

void TimeInterval::measureA  ) 
 

Measures the first timestamp of the interval.

Definition at line 63 of file timeinterval.cpp.

References Clock::getClock(), Singleton< Clock >::getSingleton(), and interval.

Referenced by Parallel::output(), SimulatedInputDevice::run(), InputDevice::run(), Scheduler::schedule(), and Scheduler::wait().

Here is the call graph for this function:

void TimeInterval::measureB  ) 
 

Measures the second timestamp of the interval.

Definition at line 70 of file timeinterval.cpp.

References Clock::getClock(), Singleton< Clock >::getSingleton(), and interval.

Referenced by Parallel::output(), SimulatedInputDevice::run(), InputDevice::run(), Scheduler::schedule(), and Scheduler::wait().

Here is the call graph for this function:

void TimeInterval::setInterval const timespec  a,
const timespec  b
 

Set the timespecs of an interval.

Parameters:
a start of the interval,
b end of the interval
Definition at line 45 of file timeinterval.cpp.

References interval.

Referenced by Task::setReactionWindow(), and Task::Task().

timespec TimeInterval::subTimespecs const timespec &  a,
const timespec &  b
[static]
 

Subtracts two timespecs.

Returns:
subtracted timespecs
Definition at line 136 of file timeinterval.cpp.

Referenced by SimpleReactionHandler::handle().

string TimeInterval::timespecToString const timespec &  a  )  [static]
 

Converts a timespec to a string.

Parameters:
a timespec
Returns:
string
Definition at line 154 of file timeinterval.cpp.

Referenced by toString().

string TimeInterval::toString  )  const
 

Converts a TimeInterval to a string.

Returns:
string with time interval
Definition at line 164 of file timeinterval.cpp.

References interval, and timespecToString().

Referenced by SimpleReactionHandler::handle(), InputDevice::run(), and Scheduler::schedule().

Here is the call graph for this function:


Member Data Documentation

timespec TimeInterval::interval[2] [protected]
 

Definition at line 32 of file timeinterval.hpp.

Referenced by getDifference(), getInterval(), measureA(), measureB(), setInterval(), TimeInterval(), and toString().


The documentation for this class was generated from the following files:
Generated on Fri Dec 17 14:54:32 2004 for Psychological Test Framework by doxygen 1.3.8