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

TimerTest.cpp

Go to the documentation of this file.
00001 #include <spectrodaq.h>
00002 #include <CTimer.h>
00003 #include <CTimedEvent.h>
00004 #include <iostream.h>
00005 #include <string>
00006 #include <unistd.h>
00007 
00008 class CPing : public CTimedEvent
00009 {
00010   string m_sMessage;
00011 public:
00012   CPing(const string& msg, int nms) :
00013     CTimedEvent(nms),
00014     m_sMessage(msg) { }
00015 
00016   virtual void operator()() {
00017     cerr << "Timer: " << m_sMessage << endl;
00018   }
00019 };
00020 
00021 class App : public DAQROCNode
00022 {
00023   int operator()(int argc, char** argv) {
00024     CPing ping(string("Ping"), 2000);
00025     CPing pong(string("Pong"), 3000);
00026     CTimer MyTimer;
00027 
00028     MyTimer.EstablishEvent(ping);
00029     MyTimer.EstablishEvent(pong);
00030 
00031     MyTimer.Start(100);
00032 
00033     while(1) {
00034       cerr << "Main sleeping 5sec\n";
00035       sleep(5);
00036     }
00037   }
00038 };
00039 
00040 App MyApp;

Generated on Fri Nov 8 13:36:51 2002 for Event Readout system. by doxygen1.2.16