JobCInput Class Reference

#include <JobCInput.h>

Inheritance diagram for JobCInput:
JobCInputModule JobCModule

List of all members.

Public Member Functions

 JobCInput ()
virtual ~JobCInput ()
JobCResult Get ()
JobCResult Next (int n=1)
JobCResult Prev (int n=1)
JobCResult GoTo (int runNumber, int snarlNumber, int searchDir=0)
JobCResult GoTo (const VldContext &vld)
Int_t GetCurrentRun () const
Int_t GetLastRun () const
const char * GetCurrentFile (const char *streamname="*") const
const char * GetLastFile (const char *streamname="*") const
Int_t GetCurrentSnarl () const
void List (const char *streamlist="*") const
void AddFile (const char *filename, const char *streamlist="*", int at=-1)
void RemoveFile (const char *filename, const char *streamlist="*")
void DefineStream (const char *stream, const char *tree)
void Select (const char *stream, const char *cut, bool isrequired=false)
void SetSequenceMode (const char *stream, Per::ESequenceMode seqmode=Per::kKey)
void SetTestMode (const char *stream, bool testmode)
void SetPerOwnedDisabled (const char *stream, bool perowneddisabled=true)
void SetWindow (const char *stream, double lower, double upper)
void SetMaxFileRepeat (const char *stream, int numRepeat)
void SetMeanMom (const char *stream, double mean)
void SetPushRandom (const char *stream, bool setRandom)
void SetRandomSeed (int rSeed)
JobCResult NextFile (int n=1, const char *streamlist="*")
JobCResult PrevFile (int n=1, const char *streamlist="*")
JobCResult GoToFile (int i=0, const char *streamlist="*")
JobCResult GoToFile (const char *filename, const char *streamlist="*")
void Use (const char *name)
void BeginJob ()
void EndJob ()
void BeginFile ()
void EndFile ()
void BeginRun ()
void EndRun ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
RegistryGetConfig ()
void Cmd (const char *command)
void HandleCommand (JobCommand *command)
void Help ()
void Report ()
void Reset ()

Public Attributes

SigC::Signal0PlaceHolder SigGet
SigC::Signal0PlaceHolder SigNext
SigC::Signal0PlaceHolder SigPrev
SigC::Signal0PlaceHolder SigGoTo

Private Member Functions

int CheckImpl () const
virtual JobCResult Get (MomNavigator *)

Private Attributes

JobCInputModulefImpl

Detailed Description

Definition at line 61 of file JobCInput.h.


Constructor & Destructor Documentation

JobCInput::JobCInput (  ) 

Definition at line 23 of file JobCInput.cxx.

00023 : fImpl(0) { }

JobCInput::~JobCInput (  )  [virtual]

Definition at line 27 of file JobCInput.cxx.

References JobCModule::EndJob(), and fImpl.

00028 { 
00029   if (fImpl) { 
00030     fImpl->EndJob();
00031     delete fImpl; fImpl = 0; 
00032   }
00033 }


Member Function Documentation

void JobCInput::AddFile ( const char *  filename,
const char *  streamlist = "*",
int  at = -1 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 160 of file JobCInput.cxx.

References JobCInputModule::AddFile(), CheckImpl(), and fImpl.

Referenced by main(), merge_configure(), PageDisplay::OpenFile(), and SetupInput().

00161 {
00162   if (this->CheckImpl()) fImpl->AddFile(filename,streamlist,at);
00163 }

void JobCInput::BeginFile (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 359 of file JobCInput.cxx.

References IMP.

00359 { IMP(BeginFile) }

void JobCInput::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 357 of file JobCInput.cxx.

References IMP.

00357 { IMP(BeginJob)  }

void JobCInput::BeginRun (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 361 of file JobCInput.cxx.

References IMP.

00361 { IMP(BeginRun)  }

int JobCInput::CheckImpl (  )  const [private]

Definition at line 381 of file JobCInput.cxx.

References fImpl, Msg::kWarning, and MSG.

Referenced by AddFile(), DefaultConfig(), DefineStream(), Get(), GetConfig(), GetCurrentFile(), GetCurrentRun(), GetCurrentSnarl(), GetLastFile(), GetLastRun(), GoTo(), GoToFile(), List(), Next(), NextFile(), Prev(), PrevFile(), RemoveFile(), Select(), SetMaxFileRepeat(), SetMeanMom(), SetPerOwnedDisabled(), SetPushRandom(), SetRandomSeed(), SetSequenceMode(), SetTestMode(), and SetWindow().

00382 {
00383 //======================================================================
00384 // Check if we have a valid pointer to an input module
00385 //======================================================================
00386   if (fImpl==0) {
00387     MSG("JobC",Msg::kWarning) <<
00388       "No implementation provided for Input module. Try this:"
00389       " Input.Use(\"Input\")" << std::endl;
00390     return 0;
00391   }
00392   return 1;
00393 }

void JobCInput::Cmd ( const char *  command  )  [virtual]

Implement to handle a command

Reimplemented from JobCModule.

Definition at line 373 of file JobCInput.cxx.

References IMP.

00373 { IMP(Cmd,c)    }

void JobCInput::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 372 of file JobCInput.cxx.

References IMP.

00372 { IMP(Config,r) }

const Registry & JobCInput::DefaultConfig ( void   )  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 323 of file JobCInput.cxx.

References CheckImpl(), JobCModule::DefaultConfig(), fImpl, Msg::kDebug, and MSG.

00324 {
00325   MSG("JobC",Msg::kDebug) << "JobCInput::DefaultConfig()\n";
00326 
00327   if (this->CheckImpl()) return fImpl->DefaultConfig();
00328 
00329   MSG("JobC",Msg::kDebug) << "Using dummy config!\n";
00330   static Registry r; // A dummy config...
00331   return r;
00332 }

void JobCInput::DefineStream ( const char *  stream,
const char *  tree 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 237 of file JobCInput.cxx.

References CheckImpl(), JobCInputModule::DefineStream(), and fImpl.

Referenced by merge_configure().

00238 {
00239   if (this->CheckImpl()) fImpl->DefineStream(stream,tree);
00240 }

void JobCInput::EndFile (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 360 of file JobCInput.cxx.

References IMP.

00360 { IMP(EndFile)   }

void JobCInput::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 358 of file JobCInput.cxx.

References IMP.

00358 { IMP(EndJob)    }

void JobCInput::EndRun (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 362 of file JobCInput.cxx.

References IMP.

00362 { IMP(EndRun)    }

virtual JobCResult JobCInput::Get ( MomNavigator mom  )  [inline, private, virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCInputModule.

Definition at line 168 of file JobCInput.h.

References JobCResult::kFatal.

00168 { assert(0); return JobCResult::kFatal; }

JobCResult JobCInput::Get (  )  [virtual]

Reimplemented from JobCInputModule.

Definition at line 37 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCInputModule::Get(), JobCResult::kEndOfInputStream, and SigGet.

00038 { 
00039   if (this->CheckImpl()) {
00040     JobCResult r = fImpl->Get();
00041 #ifdef SITE_HAS_SIGC
00042     this->SigGet();
00043 #endif
00044     return r;
00045   }
00046   return JobCResult::kEndOfInputStream;
00047 }

Registry & JobCInput::GetConfig (  )  [virtual]

Reimplemented from JobCModule.

Definition at line 336 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCModule::GetConfig(), Msg::kDebug, and MSG.

00337 {
00338 //======================================================================
00339 // To make the JobCInput fit transparently over the module that
00340 // actually implements the input module we don't ever want to talk to
00341 // JobCInput::fConfig we want to talk to fImpl->fConfig. JobCModule
00342 // has been written very carefully to never reference fConfig directly
00343 // but only through this method...
00344 //======================================================================
00345   if (this->CheckImpl()) return fImpl->GetConfig();
00346   
00347   MSG("JobC",Msg::kDebug) << "Returning dummy config!\n";
00348   static Registry r; // A dummy config...
00349   return r;
00350 }

const char * JobCInput::GetCurrentFile ( const char *  streamname = "*"  )  const [virtual]

Return the currently opened input file. This should not be overridden. Use this in BeginFile().

Reimplemented from JobCInputModule.

Definition at line 112 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::GetCurrentFile().

00113 {
00114     if (this->CheckImpl()) 
00115         return fImpl->GetCurrentFile(streamname);
00116     return 0;
00117 }

Int_t JobCInput::GetCurrentRun (  )  const [virtual]

Return the current run #. This should not be overridden. Use this in BeginRun().

Reimplemented from JobCInputModule.

Definition at line 94 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::GetCurrentRun().

00095 {
00096  if (this->CheckImpl()) 
00097    return fImpl->GetCurrentRun();
00098  return -1;
00099 }

Int_t JobCInput::GetCurrentSnarl (  )  const [virtual]

Reimplemented from JobCInputModule.

Definition at line 130 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::GetCurrentSnarl().

00131 {
00132  if (this->CheckImpl()) 
00133    return fImpl->GetCurrentSnarl();
00134  return -1;
00135 }

const char * JobCInput::GetLastFile ( const char *  streamname = "*"  )  const [virtual]

Return the previously opened input file. This should not be overridden. Use this in EndFile().

Reimplemented from JobCInputModule.

Definition at line 121 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::GetLastFile().

00122 {
00123     if (this->CheckImpl()) 
00124         return fImpl->GetLastFile(streamname);
00125     return 0;
00126 }

Int_t JobCInput::GetLastRun (  )  const [virtual]

Return the previous run #. This should not be overridden. Use this in EndRun().

Reimplemented from JobCInputModule.

Definition at line 103 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::GetLastRun().

00104 {
00105  if (this->CheckImpl()) 
00106    return fImpl->GetLastRun();
00107  return -1;
00108 }

JobCResult JobCInput::GoTo ( const VldContext vld  )  [virtual]

Reimplemented from JobCInputModule.

Definition at line 139 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCInputModule::GoTo(), JobCResult::kError, and SigGoTo.

00140 {
00141   if (this->CheckImpl()) {
00142     JobCResult r = fImpl->GoTo(vld);
00143 #ifdef SITE_HAS_SIGC
00144     this->SigGoTo();
00145 #endif
00146     return r;
00147   }
00148   return JobCResult::kError;
00149 }

JobCResult JobCInput::GoTo ( int  runNumber,
int  snarlNumber,
int  searchDir = 0 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 79 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCInputModule::GoTo(), JobCResult::kError, and SigGoTo.

Referenced by Jint::GoTo().

00080 {
00081   if (this->CheckImpl()) {
00082     JobCResult re = fImpl->GoTo(r,s,d); 
00083 #ifdef SITE_HAS_SIGC
00084     this->SigGoTo();
00085 #endif
00086     return re;
00087   }
00088   return JobCResult::kError;
00089 }

JobCResult JobCInput::GoToFile ( const char *  filename,
const char *  streamlist = "*" 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 268 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCInputModule::GoToFile(), and JobCResult::kError.

00269 {
00270   if (this->CheckImpl()) return fImpl->GoToFile(filename, streamlist);
00271   return JobCResult::kError;
00272 }

JobCResult JobCInput::GoToFile ( int  i = 0,
const char *  streamlist = "*" 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 260 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCInputModule::GoToFile(), and JobCResult::kError.

00261 {
00262   if (this->CheckImpl())  return fImpl->GoToFile(i, streamlist);
00263   return JobCResult::kError;
00264 }

void JobCInput::HandleCommand ( JobCommand command  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 374 of file JobCInput.cxx.

References IMP.

00374 { IMP(HandleCommand,c) }

void JobCInput::Help (  )  [virtual]

Implement to spew some useful help to cout

Reimplemented from JobCModule.

Definition at line 363 of file JobCInput.cxx.

References IMP.

00363 { IMP(Help)      }

void JobCInput::List ( const char *  streamlist = "*"  )  const [virtual]

Reimplemented from JobCInputModule.

Definition at line 153 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::List().

00154 {
00155   if (this->CheckImpl()) fImpl->List(streamlist);
00156 }

JobCResult JobCInput::Next ( int  n = 1  )  [virtual]

Reimplemented from JobCInputModule.

Definition at line 51 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCResult::kError, JobCInputModule::Next(), and SigNext.

Referenced by Jint::Next(), and run().

00052 {
00053   if (this->CheckImpl()) {
00054     JobCResult r = fImpl->Next(n); 
00055 #ifdef SITE_HAS_SIGC
00056     this->SigNext();
00057 #endif
00058     return r;
00059   }
00060   return JobCResult::kError;
00061 }

JobCResult JobCInput::NextFile ( int  n = 1,
const char *  streamlist = "*" 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 244 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCResult::kError, and JobCInputModule::NextFile().

00245 {
00246   if (this->CheckImpl()) return fImpl->NextFile(n,streamlist);
00247   return JobCResult::kError;
00248 }

JobCResult JobCInput::Prev ( int  n = 1  )  [virtual]

Reimplemented from JobCInputModule.

Definition at line 65 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCResult::kError, JobCInputModule::Prev(), and SigPrev.

Referenced by MadBase::GetEntry(), and Jint::Prev().

00066 {
00067   if (this->CheckImpl()){
00068     JobCResult r = fImpl->Prev(n); 
00069 #ifdef SITE_HAS_SIGC
00070     this->SigPrev();
00071 #endif
00072     return r;
00073   }
00074   return JobCResult::kError;
00075 }

JobCResult JobCInput::PrevFile ( int  n = 1,
const char *  streamlist = "*" 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 252 of file JobCInput.cxx.

References CheckImpl(), fImpl, JobCResult::kError, and JobCInputModule::PrevFile().

00253 {
00254   if (this->CheckImpl()) return fImpl->PrevFile(n, streamlist);
00255   return JobCResult::kError;
00256 }

void JobCInput::RemoveFile ( const char *  filename,
const char *  streamlist = "*" 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 167 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::RemoveFile().

00168 {
00169   if (this->CheckImpl()) fImpl->RemoveFile(filename,streamlist);
00170 }

void JobCInput::Report (  )  [virtual]

Implement to spew end of running report

Reimplemented from JobCModule.

Definition at line 364 of file JobCInput.cxx.

References IMP.

00364 { IMP(Report)    }

void JobCInput::Reset (  )  [virtual]

Implement to reset oneself

Reimplemented from JobCModule.

Definition at line 365 of file JobCInput.cxx.

References IMP.

00365 { IMP(Reset)     }

void JobCInput::Select ( const char *  stream,
const char *  cut,
bool  isrequired = false 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 174 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::Select().

00175 {
00176   if (this->CheckImpl()) fImpl->Select(stream,cut,isrequired);
00177 }

void JobCInput::SetMaxFileRepeat ( const char *  stream,
int  numRepeat 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 209 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetMaxFileRepeat().

Referenced by merge_configure().

00210 {
00211   if (this->CheckImpl()) fImpl->SetMaxFileRepeat(stream,numRepeat);
00212 }

void JobCInput::SetMeanMom ( const char *  stream,
double  mean 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 216 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetMeanMom().

Referenced by merge_configure().

00217 {
00218   if (this->CheckImpl()) fImpl->SetMeanMom(stream,mean);
00219 }

void JobCInput::SetPerOwnedDisabled ( const char *  stream,
bool  perowneddisabled = true 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 188 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetPerOwnedDisabled().

00189 {
00190   if (this->CheckImpl()) fImpl->SetPerOwnedDisabled(stream,perowneddisabled);
00191 }

void JobCInput::SetPushRandom ( const char *  stream,
bool  setRandom 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 223 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetPushRandom().

Referenced by merge_configure().

00224 {
00225   if (this->CheckImpl()) fImpl->SetPushRandom(stream,setRandom);
00226 }

void JobCInput::SetRandomSeed ( int  rSeed  )  [virtual]

Reimplemented from JobCInputModule.

Definition at line 230 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetRandomSeed().

00231 {
00232   if (this->CheckImpl()) fImpl->SetRandomSeed(rSeed);
00233 }

void JobCInput::SetSequenceMode ( const char *  stream,
Per::ESequenceMode  seqmode = Per::kKey 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 181 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetSequenceMode().

Referenced by merge_configure(), and set_input_data().

00182 {
00183   if (this->CheckImpl()) fImpl->SetSequenceMode(stream,seqmode);
00184 }

void JobCInput::SetTestMode ( const char *  stream,
bool  testmode 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 195 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetTestMode().

00196 {
00197   if (this->CheckImpl()) fImpl->SetTestMode(stream,testmode);
00198 }

void JobCInput::SetWindow ( const char *  stream,
double  lower,
double  upper 
) [virtual]

Reimplemented from JobCInputModule.

Definition at line 202 of file JobCInput.cxx.

References CheckImpl(), fImpl, and JobCInputModule::SetWindow().

00203 {
00204   if (this->CheckImpl()) fImpl->SetWindow(stream,lower,upper);
00205 }

void JobCInput::Use ( const char *  name  ) 

Definition at line 276 of file JobCInput.cxx.

References JobCModule::BeginJob(), JobCModuleProxy::CreateModule(), JobCModule::EndJob(), fImpl, JobCInputModule::GetMom(), JobCModuleProxy::GetName(), JobCModuleRegistry::Instance(), Msg::kError, Msg::kWarning, JobCModuleRegistry::LookUp(), Munits::m, MSG, and JobCInputModule::SetMom().

Referenced by JobC::Init(), and SetupInput().

00277 {
00278 //======================================================================
00279 // Set the input module to implement this class
00280 //======================================================================
00281 
00282   // Use the name to lookup the proxy
00283   JobCModuleProxy* jmp = JobCModuleRegistry::Instance().LookUp(name);
00284   if (jmp==0) {
00285     MSG("JobC",Msg::kWarning) <<
00286       "No module '"<< name <<"' has been linked in." << std::endl;
00287     return;
00288   }
00289 
00290   // Use the proxy to instantiate a module
00291   JobCModule* m = jmp->CreateModule();
00292   if (m==0) {
00293     MSG("JobC",Msg::kWarning) <<
00294       "CreateModule(" << jmp->GetName() << ")" << std::endl;
00295     return;
00296   }
00297 
00298   // Try to cast the module as an input module
00299   JobCInputModule* inmod = dynamic_cast<JobCInputModule*>(m);
00300   if (inmod==0) {
00301     MSG("JobC",Msg::kError) << 
00302       "Module '" << jmp->GetName() << 
00303       "' cannot be used as an input module." << std::endl;
00304     delete m; m = 0;
00305     return;
00306   }
00307 
00308   // Switch to the new implementation
00309   if (fImpl) { 
00310     fImpl->EndJob();
00311     delete fImpl; fImpl = 0; 
00312   }
00313   fImpl = inmod;
00314 
00315   // Set up the new module
00316   assert(this->GetMom());
00317   fImpl->SetMom(this->GetMom());
00318   fImpl->BeginJob();
00319 }


Member Data Documentation

Definition at line 155 of file JobCInput.h.

Referenced by Get(), and Jint::Jint().

Definition at line 158 of file JobCInput.h.

Referenced by GoTo(), and Jint::Jint().

Definition at line 156 of file JobCInput.h.

Referenced by Jint::Jint(), and Next().

Definition at line 157 of file JobCInput.h.

Referenced by Jint::Jint(), and Prev().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1