Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

wall_clock.H

Go to the documentation of this file.
00001 #ifndef __WALL_CLOCK_H__
00002 #define __WALL_CLOCK_H__
00003 
00004 /*************************************************************************
00005  * Class:   Wall_clock
00006  * Purpose: This class creates a constant clock that can be used to 
00007  *          synchronize simulations running on a cluster.
00008  *************************************************************************/
00009 
00010 #include <dev/polled.H>
00011 #include <event/event.H>
00012 
00013 MAKE_PTR_SUBC(EVENTWallClockmsg, EVENT);
00014 class EVENTWallClockmsg : public EVENT {
00015 protected:
00016   double _msg_time;
00017 
00018   /* ------- EVENT methods ----------- */ 
00019   virtual bool compare(cEVENTptr &e) const { return EVENTWallClockmsg::isa(e); }
00020   
00021 public:
00022   EVENTWallClockmsg( double t=0, cEVENTsource *s=0 ): EVENT(s), _msg_time(t) {}
00023 
00024   virtual void debug(ostream &o)     const { o << class_name() 
00025                            << "(" << _msg_time << ")"; }
00026   
00027   double msg_time() const { return _msg_time; }
00028 
00029   /* ------- TYPEDOBJ methods ----------- */ 
00030   DEFINE_DERIVED_TYPE(EVENTWallClockmsg, EVENT, cEVENTptr);
00031   static cEVENTWallClockmsgptr cast(cEVENTptr &e) { return EVENTWallClockmsg::isa(e) ? 
00032                           (EVENTWallClockmsg *)&*e : 0; }
00033 };
00034 
00035 
00036 
00037 
00038 
00039 
00040 class DEV_Wall_clock : public DEVpolled
00041 {
00042 private:
00043   static DEV_Wall_clock *_instance;
00044 protected:
00045   double _instance_epoch;
00046 
00047   EVENTsource *_wall_clock_source;
00048 public:
00049   DEV_Wall_clock( Cstr_ptr &name = "DEV_Wall_clock" );
00050   virtual ~DEV_Wall_clock();
00051 
00052   void do_poll();
00053   void terminate();
00054   
00055  
00056 };
00057 
00058 
00059 #endif
00060 

Generated on Mon Sep 15 16:25:57 2003 for gluebase by doxygen1.2.18