IoInputModuleValidate Class Reference

#include <IoInputModuleValidate.h>

List of all members.

Public Member Functions

 IoInputModuleValidate (int nfiles, const char *const *files)
 ~IoInputModuleValidate ()
bool RunAllTests ()

Private Member Functions

bool TestAdd ()
bool TestRemove ()
bool TestNextFile ()
bool TestPrevFile ()
bool TestGoToFile ()
bool TestNext ()
bool TestPrev ()
bool TestSetFormat ()
bool TestGet ()
bool TestStreams ()
bool TestGoToEOF ()

Private Attributes

int fNfiles
const char *const * fFileName
IoInputModule fIoModule

Detailed Description

Definition at line 10 of file IoInputModuleValidate.h.


Constructor & Destructor Documentation

IoInputModuleValidate::IoInputModuleValidate ( int  nfiles,
const char *const *  files 
)

Definition at line 17 of file IoInputModuleValidate.cxx.

References IoInputModule::Config(), IoInputModule::DefaultConfig(), fIoModule, fNfiles, MsgService::Instance(), Msg::kVerbose, and Dbi::SetLogLevel().

00018                                                                        :
00019   fNfiles(nfiles),fFileName(files)
00020 {
00021 //======================================================================
00022 // Purpose: Create the validation class using several test files
00023 //
00024 // nfiles - number of files to use in test
00025 // files  - list of file names
00026 //======================================================================
00027   MsgService::Instance() -> GetStream("Io") -> SetLogLevel(Msg::kVerbose);
00028   MsgService::Instance() -> GetStream("Per") -> SetLogLevel(Msg::kVerbose);
00029   fIoModule.Config(fIoModule.DefaultConfig());
00030   cout << "nfiles = " << fNfiles << endl;
00031 
00032 }

IoInputModuleValidate::~IoInputModuleValidate (  ) 

Definition at line 36 of file IoInputModuleValidate.cxx.

00036 {}


Member Function Documentation

bool IoInputModuleValidate::RunAllTests ( void   ) 

Definition at line 174 of file IoInputModuleValidate.cxx.

References fIoModule, JobCInputModule::GetMom(), JobCInputModule::SetMom(), TestAdd(), TestGet(), TestGoToEOF(), TestGoToFile(), TestNext(), TestNextFile(), TestPrev(), TestPrevFile(), TestRemove(), and TestStreams().

Referenced by main().

00175 {
00176   bool passed;
00177   MomNavigator* mom = new MomNavigator();
00178   fIoModule.SetMom(mom);
00179   passed  = this->TestAdd();
00180   passed &= this->TestRemove();
00181   passed &= this->TestNextFile();
00182   passed &= this->TestPrevFile();
00183   passed &= this->TestGoToFile();
00184   passed &= this->TestStreams();
00185   passed &= this->TestNext();
00186   passed &= this->TestGoToEOF();
00187   passed &= this->TestPrev();
00188   passed &= this->TestGet();
00189   mom = fIoModule.GetMom();
00190   if ( mom ) delete mom; mom = 0;
00191  
00192   return passed;
00193 }

bool IoInputModuleValidate::TestAdd (  )  [private]

Definition at line 40 of file IoInputModuleValidate.cxx.

References IoInputModule::AddFile(), fFileName, fIoModule, fNfiles, Msg::kDebug, IoInputModule::List(), MSG, and s().

Referenced by RunAllTests().

00041 {
00042 //======================================================================
00043 // Purpose: Test the "Add" command to add a file to the list of input
00044 // files
00045 //======================================================================
00046   MSG("Io",Msg::kDebug) << "TestAdd -- \n";
00047   MSG("Io",Msg::kDebug) << " Before:" << endl;
00048   
00049   fIoModule.List();
00050   for (int i=0; i<fNfiles; ++i) {
00051     string s(fFileName[i]);
00052     fIoModule.AddFile(s.c_str());
00053   }
00054   MSG("Io",Msg::kDebug) << " After:" << endl;
00055   fIoModule.List();
00056   return true;
00057 }

bool IoInputModuleValidate::TestGet (  )  [private]

Definition at line 152 of file IoInputModuleValidate.cxx.

References JobCResult::EndOfInputStream(), fIoModule, IoInputModule::Get(), Msg::kDebug, Msg::kInfo, MSG, and IoInputModule::Next().

Referenced by RunAllTests().

00153 {
00154   MSG("Io",Msg::kDebug) << "Test Get" << endl;
00155   int i;
00156   MomNavigator mom;
00157   MsgFormat fmt("%4d");
00158   JobCResult r;
00159   for (i=0; r.EndOfInputStream() == false; ++i) {
00160     fIoModule.Get();
00161     
00162     MSG("Io",Msg::kInfo) << fmt(i);
00163     if (i%15 == 14) MSG("Io",Msg::kInfo) << endl;
00164     
00165     r = fIoModule.Next();
00166   }
00167   MSG("Io",Msg::kInfo) << endl;
00168   MSG("Io",Msg::kInfo) << "Read " << i << " events from file list" << endl;
00169   return true;
00170 }

bool IoInputModuleValidate::TestGoToEOF (  )  [private]

Definition at line 137 of file IoInputModuleValidate.cxx.

References fIoModule, Per::GetVldEnd(), IoInputModule::GoTo(), Msg::kDebug, IoInputModule::List(), and MSG.

Referenced by RunAllTests().

00138 {
00139   MSG("Io",Msg::kDebug) << "Test GoToEOF" << endl;
00140   fIoModule.GoTo(Per::GetVldEnd());
00141   fIoModule.List();
00142   return true;
00143 }

bool IoInputModuleValidate::TestGoToFile (  )  [private]

Definition at line 97 of file IoInputModuleValidate.cxx.

References fIoModule, IoInputModule::GoToFile(), Msg::kDebug, IoInputModule::List(), and MSG.

Referenced by RunAllTests().

00098 {
00099   MSG("Io",Msg::kDebug) << "Test GoToFile 2" << endl;
00100   fIoModule.GoToFile(2);
00101   fIoModule.List();
00102   return true;
00103 }

bool IoInputModuleValidate::TestNext (  )  [private]

Definition at line 107 of file IoInputModuleValidate.cxx.

References fIoModule, Msg::kDebug, IoInputModule::List(), MSG, and IoInputModule::Next().

Referenced by RunAllTests().

00108 {
00109   MSG("Io",Msg::kDebug) << "Test Next by 10" << endl;
00110   fIoModule.Next(10);
00111   fIoModule.List();
00112   return true;
00113 }

bool IoInputModuleValidate::TestNextFile (  )  [private]

Definition at line 77 of file IoInputModuleValidate.cxx.

References fIoModule, Msg::kDebug, IoInputModule::List(), MSG, and IoInputModule::NextFile().

Referenced by RunAllTests().

00078 {
00079   MSG("Io",Msg::kDebug) << "Test NextFile by 3" << endl;
00080   fIoModule.NextFile(3);
00081   fIoModule.List();
00082   return true;
00083 }

bool IoInputModuleValidate::TestPrev (  )  [private]

Definition at line 117 of file IoInputModuleValidate.cxx.

References fIoModule, Msg::kDebug, MSG, and IoInputModule::Prev().

Referenced by RunAllTests().

00118 {
00119   MSG("Io",Msg::kDebug) << "Test Prev by 10" << endl;
00120   fIoModule.Prev(10);
00121   return true;
00122 }

bool IoInputModuleValidate::TestPrevFile (  )  [private]

Definition at line 87 of file IoInputModuleValidate.cxx.

References fIoModule, Msg::kDebug, IoInputModule::List(), MSG, and IoInputModule::PrevFile().

Referenced by RunAllTests().

00088 {
00089   MSG("Io",Msg::kDebug) << "Test PrevFile by 2" << endl;
00090   fIoModule.PrevFile(2);
00091   fIoModule.List();
00092   return true;
00093 }

bool IoInputModuleValidate::TestRemove (  )  [private]

Definition at line 61 of file IoInputModuleValidate.cxx.

References fFileName, fIoModule, fNfiles, Msg::kDebug, IoInputModule::List(), MSG, IoInputModule::RemoveFile(), and s().

Referenced by RunAllTests().

00062 {
00063   MSG("Io",Msg::kDebug) << "TestRemove every other file -- \n";
00064   MSG("Io",Msg::kDebug) << " Before:" << endl;
00065   fIoModule.List();
00066   for (int i=1; i<fNfiles; i += 2) {
00067     string s(fFileName[i]);
00068     fIoModule.RemoveFile(s.c_str());
00069   }
00070   MSG("Io",Msg::kDebug) << " After:" << endl;
00071   fIoModule.List();
00072   return true;
00073 }

bool IoInputModuleValidate::TestSetFormat (  )  [private]

Definition at line 147 of file IoInputModuleValidate.cxx.

00148 {
00149   return true;
00150 }

bool IoInputModuleValidate::TestStreams (  )  [private]

Definition at line 127 of file IoInputModuleValidate.cxx.

References fIoModule, Msg::kDebug, IoInputModule::List(), MSG, and JobCModule::Set().

Referenced by RunAllTests().

00128 {
00129   MSG("Io",Msg::kDebug) << "Test Streams" << endl;
00130   fIoModule.Set("Streams=DaqSnarl,LightInjection");
00131   fIoModule.List();
00132   return true;
00133 }


Member Data Documentation

const char* const* IoInputModuleValidate::fFileName [private]

Definition at line 32 of file IoInputModuleValidate.h.

Referenced by TestAdd(), and TestRemove().

Definition at line 31 of file IoInputModuleValidate.h.

Referenced by IoInputModuleValidate(), TestAdd(), and TestRemove().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1