Interface for a stimulus listener. More...
#include <Psycho/StimListener.H>
Public Member Functions | |
StimListener () | |
constructor | |
virtual | ~StimListener () |
destructor | |
void | setBuffer (const rutz::shared_ptr< SharedBuffer< StimData > > &buffer) |
set the buffer from a shared pointer | |
void | setEventLog (const nub::soft_ref< EventLog > &log) |
set the log file from a shared pointer | |
virtual void | start () |
any pre listening initialization should go here | |
virtual void | stop () |
clean things up after listening is over | |
virtual bool | sendMessage (const unsigned char *msg)=0 |
virtual bool | listen ()=0 |
listen for stimulus codes, Default is Empty. | |
virtual void | run () |
From Jobserver::Job. | |
virtual const char * | jobType () const |
return the job name | |
virtual int | priority () const |
return the priority, 0 for highest | |
Protected Member Functions | |
void | pushEvent (const std::string &msg, const bool &uselinfo=false) |
push an event to the log, if uselinfo is true also display to the screen | |
void | addData (const StimData &const data) |
push data onto the shared buffer |
Interface for a stimulus listener.
A StimListener can listen for stimulus commands from connected hosts and places them in a shared buffer. This buffer can then be read by other components to actually render the requested stimuli on the screen. This class is a JobServer::Job, which should be used with a JobServer derivitive. When queued this job will listen for commands in its own thread.
Definition at line 61 of file StimListener.H.
StimListener::StimListener | ( | ) |
constructor
Definition at line 45 of file StimListener.C.
StimListener::~StimListener | ( | ) | [virtual] |
destructor
Definition at line 49 of file StimListener.C.
void StimListener::addData | ( | const StimData &const | data | ) | [protected] |
push data onto the shared buffer
Referenced by StimListenerDML::listen().
const char * StimListener::jobType | ( | ) | const [virtual] |
return the job name
Implements JobServer::Job.
Reimplemented in StimListenerDML.
Definition at line 101 of file StimListener.C.
virtual bool StimListener::listen | ( | ) | [pure virtual] |
int StimListener::priority | ( | ) | const [virtual] |
return the priority, 0 for highest
Reimplemented from JobServer::Job.
Definition at line 107 of file StimListener.C.
void StimListener::pushEvent | ( | const std::string & | msg, | |
const bool & | uselinfo = false | |||
) | [protected] |
push an event to the log, if uselinfo is true also display to the screen
Definition at line 64 of file StimListener.C.
Referenced by StimListenerDML::listen(), StimListenerDML::sendMessage(), StimListenerDML::setHostName(), and StimListenerDML::start().
void StimListener::run | ( | ) | [virtual] |
From Jobserver::Job.
the actual work, called by JobServer after being queued
Implements JobServer::Job.
Definition at line 95 of file StimListener.C.
References listen().
virtual bool StimListener::sendMessage | ( | const unsigned char * | msg | ) | [pure virtual] |
send a message, usually back to the sender. Derived classes need to implement this.
Implemented in StimListenerDML.
void StimListener::setBuffer | ( | const rutz::shared_ptr< SharedBuffer< StimData > > & | buffer | ) |
set the buffer from a shared pointer
Definition at line 52 of file StimListener.C.
void StimListener::setEventLog | ( | const nub::soft_ref< EventLog > & | log | ) |
set the log file from a shared pointer
Definition at line 58 of file StimListener.C.
void StimListener::start | ( | ) | [virtual] |
any pre listening initialization should go here
Reimplemented in StimListenerDML.
Definition at line 81 of file StimListener.C.
References rutz::shared_ptr< T >::is_valid().
void StimListener::stop | ( | ) | [virtual] |
clean things up after listening is over
Reimplemented in StimListenerDML.
Definition at line 89 of file StimListener.C.