DemoInputModule Class Reference

#include <DemoInputModule.h>

List of all members.

Public Member Functions

 DemoInputModule ()
virtual ~DemoInputModule ()
bool IsBegin () const
bool IsEnd () const
std::ostream & Print (std::ostream &ms) const
void BeginJob ()
void EndJob ()
bool BeginFile (std::string streamname, std::string fullfilepathname, Per::EAccessMode=Per::kRead)
void EndFile (std::string streamname="*")
Int_t Next (MomNavigator *mom, Int_t advanceby=1)
Int_t Previous (MomNavigator *mom, Int_t rewindby=1)

Private Attributes

PerInputStreamManager fInputStreamManager

Detailed Description

Definition at line 25 of file DemoInputModule.h.


Constructor & Destructor Documentation

DemoInputModule::DemoInputModule (  )  [inline]

Definition at line 30 of file DemoInputModule.h.

00030 {}

virtual DemoInputModule::~DemoInputModule (  )  [inline, virtual]

Definition at line 31 of file DemoInputModule.h.

00031 {}


Member Function Documentation

bool DemoInputModule::BeginFile ( std::string  streamname,
std::string  fullfilepathname,
Per::EAccessMode  accessmode = Per::kRead 
)

Definition at line 31 of file DemoInputModule.cc.

References fInputStreamManager, and PerInputStreamManager::SetFile().

Referenced by main().

00033                                                            {
00034   //
00035   //  Purpose:  Begin new file for stream streamname.
00036   //
00037   //  Argument: streamname        streamname on which to begin new file.
00038   //                              if streamname = "*", set new file on
00039   //                              all managed streams. 
00040   //            fullfilepathname  full file path name of output file
00041   //            accessmode        accessmode in which file is to be opened
00042   //                              (either kRead or kUpdate) (default = kRead)
00043   //
00044   //  Return:  return true if successfully opened file for all managed
00045   //                       streams.
00046   //
00047   //  Contact:   S. Kasahara
00048   //
00049 
00050 
00051   bool openok = fInputStreamManager.SetFile(streamname,fullfilepathname,accessmode);
00052   return openok;
00053 
00054 }

void DemoInputModule::BeginJob ( void   ) 

Definition at line 56 of file DemoInputModule.cc.

References fInputStreamManager, and PerInputStreamManager::OpenStream().

Referenced by main().

00056                                {
00057   //
00058   // Purpose: Perform initialization of streams required at job startup.
00059   //
00060   // Arguments: none.
00061   //
00062   // Return: none.
00063   //
00064   // Contact:  S. Kasahara
00065   //
00066 
00067   PerInputStream* instream;
00068   // Open raw data streams (note that streamname need not be same as 
00069   // treename, although they can be)
00070   instream = fInputStreamManager.OpenStream("DaqSnarl","DaqSnarl");
00071 
00072   // Set selection string for this stream.  This specifies the cut that the
00073   // user would like to apply to data members of the object (RawRecord)
00074   // stored on this stream.  See PerInputStream::SetSelection for more info.
00075   // instream->SetSelection("((RawDaqSnarlHeader*)fHeader) -> GetSnarl() % 10 == 0"); 
00076   
00077 }

void DemoInputModule::EndFile ( std::string  streamname = "*"  ) 

Definition at line 79 of file DemoInputModule.cc.

References PerInputStreamManager::CloseFile(), and fInputStreamManager.

Referenced by main().

00079                                                   {
00080   //
00081   //  Purpose:  Close current file for specified stream.
00082   //
00083   //  Argument: streamname   string  if streamname="*", close file on all
00084   //                                 managed streams. 
00085   //
00086   //  Return:  none.
00087   //
00088   //  Contact:   S. Kasahara
00089   //
00090 
00091   fInputStreamManager.CloseFile(streamname);
00092 
00093   return;
00094 
00095 }

void DemoInputModule::EndJob (  ) 

Definition at line 97 of file DemoInputModule.cc.

References PerInputStreamManager::CloseStream(), and fInputStreamManager.

Referenced by main().

00097                              {
00098   // 
00099   // Purpose: Close all streams at job end.
00100   //
00101   // Arguments: none.
00102   //
00103   // Return: none.
00104   //
00105   // Contact:  S. Kasahara
00106   //
00107 
00108   fInputStreamManager.CloseStream();
00109 
00110 }

bool DemoInputModule::IsBegin (  )  const

Definition at line 112 of file DemoInputModule.cc.

References fInputStreamManager, and PerInputStreamManager::IsBegin().

00112                                     {
00113   // 
00114   // Purpose: Check to see if all managed streams have reached beginning of
00115   //          current set of streams.
00116   //
00117   // Arguments: none.
00118   //
00119   // Return: none.
00120   //
00121   // Contact:  S. Kasahara
00122   //
00123 
00124   bool isbegin = false;
00125   if (fInputStreamManager.IsBegin())
00126     isbegin = true;
00127 
00128   return isbegin;
00129 
00130 }

bool DemoInputModule::IsEnd (  )  const

Definition at line 132 of file DemoInputModule.cc.

References fInputStreamManager, and PerInputStreamManager::IsEnd().

Referenced by main().

00132                                   {
00133   // 
00134   // Purpose: Check to see if all managed streams have reached end of
00135   //          current tree.
00136   //
00137   // Arguments: none.
00138   //
00139   // Return: none.
00140   //
00141   // Contact:  S. Kasahara
00142   //
00143 
00144   bool isend = false;
00145   if (fInputStreamManager.IsEnd())
00146     isend = true;
00147 
00148   return isend;
00149 
00150 }

Int_t DemoInputModule::Next ( MomNavigator mom,
Int_t  advanceby = 1 
)

Definition at line 152 of file DemoInputModule.cc.

References fInputStreamManager, and PerInputStreamManager::Next().

Referenced by main().

00152                                                              {
00153   //  Purpose:  Retrieve next entry from managed streams satisfying user's
00154   //            selection string (if specified).  The objects are
00155   //            extracted from the input streams and loaded into the
00156   //            input MomNavigator object.
00157   //
00158   //  Argument: mom  pointer to MomNavigator
00159   //            advanceby  number of records to move ahead (default=1)
00160   //
00161   //  Return:  returns the number of records retrieved.  
00162   //
00163   //  Contact:   S. Kasahara
00164   //
00165 
00166   Int_t nobject = fInputStreamManager.Next(mom,advanceby);
00167   return nobject;
00168 
00169 }

Int_t DemoInputModule::Previous ( MomNavigator mom,
Int_t  rewindby = 1 
)

Definition at line 171 of file DemoInputModule.cc.

References fInputStreamManager, and PerInputStreamManager::Previous().

00171                                                                 {
00172   //  Purpose:  Retrieve previous entry from managed streams satisfying user's
00173   //            selection string (if specified).  The objects are
00174   //            extracted from the input streams and loaded into the
00175   //            input MomNavigator object.
00176   //
00177   //  Argument: mom  pointer to MomNavigator
00178   //            rewindby  number of records to move back by (default=1)
00179   //
00180   //  Return:  returns the number of records retrieved.  
00181   //
00182   //  Contact:   S. Kasahara
00183   //
00184 
00185   Int_t nobject = fInputStreamManager.Previous(mom,rewindby);
00186   return nobject;
00187 
00188 }

std::ostream & DemoInputModule::Print ( std::ostream &  ms  )  const

Definition at line 190 of file DemoInputModule.cc.

References fInputStreamManager, and PerInputStreamManager::Print().

Referenced by operator<<().

00190                                                        {
00191   // Purpose:  Print status of demo input model on std::ostream.
00192   //
00193   // Arguments: ms std::ostream to display on.
00194   //
00195   // Return: std::ostream reference.
00196   //
00197   // Contact: S. Kasahara
00198   //
00199 
00200   fInputStreamManager.Print(ms);
00201 
00202   return ms;
00203 
00204 }


Member Data Documentation

Definition at line 51 of file DemoInputModule.h.

Referenced by BeginFile(), BeginJob(), EndFile(), EndJob(), IsBegin(), IsEnd(), Next(), Previous(), and Print().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1