SleepModule Class Reference
[DataUtil]

A sleepy job module. More...

#include <SleepModule.h>

Inheritance diagram for SleepModule:

JobCModule List of all members.

Public Member Functions

 SleepModule ()
 ~SleepModule ()
void BeginRun ()
void EndRun ()
void BeginFile ()
void EndFile ()
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const

Detailed Description

A sleepy job module.

A module that will sleep in its Ana method for a configurable amount of time. The configuration parameter is "delay" and defaults to 1.0 seconds.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.2
Date:
Date
2005/04/15 14:50:02
Contact: bv@bnl.gov

Created on: Fri Apr 15 10:46:40 2005

Id
SleepModule.h,v 1.2 2005/04/15 14:50:02 bv Exp

Definition at line 33 of file SleepModule.h.


Constructor & Destructor Documentation

SleepModule::SleepModule (  ) 

Definition at line 19 of file SleepModule.cxx.

00020 {
00021 }

SleepModule::~SleepModule (  ) 

Definition at line 22 of file SleepModule.cxx.

00023 {
00024 }


Member Function Documentation

JobCResult SleepModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 50 of file SleepModule.cxx.

References Registry::Get(), JobCModule::GetConfig(), gSystem(), JobCResult::kAOK, Msg::kVerbose, Munits::millisecond, MSG, and timer().

00051 {
00052     double delay = 1.0;
00053     this->GetConfig().Get("delay",delay);
00054     
00055     MSG("Sleep",Msg::kVerbose)
00056         << "Sleeping for " << delay/Munits::millisecond << " msec\n";
00057     TStopwatch timer;
00058     timer.Start();    
00059     gSystem->Sleep((int)(delay/Munits::millisecond));
00060     timer.Stop();
00061     MSG("Sleep",Msg::kVerbose)
00062         << "Slept for: " << timer.RealTime() << endl;
00063     
00064     return JobCResult::kAOK;
00065 }

void SleepModule::BeginFile (  )  [virtual]

Implement for notification of begin of file. See GetCurrentFile().

Reimplemented from JobCModule.

Definition at line 35 of file SleepModule.cxx.

References JobCModule::GetCurrentFile(), Msg::kDebug, and MSG.

00036 {
00037     const char* file = this->GetCurrentFile();
00038     if (!file) file = "unknown";
00039     MSG("Sleep",Msg::kDebug)
00040         << " begin file:" << file << endl;
00041 }

void SleepModule::BeginRun (  )  [virtual]

Implement for notification of begin of run (meaningful for Daq data only). See GetCurrentRun().

Reimplemented from JobCModule.

Definition at line 26 of file SleepModule.cxx.

References Msg::kDebug, and MSG.

00027 {
00028     MSG("Sleep",Msg::kDebug) << " begin run \n";
00029 }

const Registry & SleepModule::DefaultConfig (  )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 66 of file SleepModule.cxx.

References Registry::Set(), and Registry::Size().

00067 {
00068     static Registry cfg;
00069     if (cfg.Size() == 0) {
00070         cfg.Set("delay",1.0);
00071     }
00072     return cfg;
00073 }

void SleepModule::EndFile (  )  [virtual]

Implement for notification of end of file. See GetLastFile().

Reimplemented from JobCModule.

Definition at line 42 of file SleepModule.cxx.

References JobCModule::GetCurrentFile(), Msg::kDebug, and MSG.

00043 {
00044     const char* file = this->GetCurrentFile();
00045     if (!file) file = "unknown";
00046     MSG("Sleep",Msg::kDebug)
00047         << " end file:" << file << endl;
00048 }

void SleepModule::EndRun (  )  [virtual]

Implement for notification of end of run (meaningful for Daq data only). See GetLastRun().

Reimplemented from JobCModule.

Definition at line 30 of file SleepModule.cxx.

References Msg::kDebug, and MSG.

00031 {
00032     MSG("Sleep",Msg::kDebug) << " end run \n";
00033 }


The documentation for this class was generated from the following files:
Generated on Thu Apr 10 23:03:44 2014 for loon by  doxygen 1.4.7