![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /Framework/src/AppStreamsOutputModule.cc
Go to the documentation of this file.00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: AppStreamsOutputModule.cc,v 1.3 2000/05/01 22:21:46 desilva Exp $ 00004 // 00005 // Description: 00006 // Class AppStreamsOutputModule. This is the abstract streams output module 00007 // for the BaBar framework. 00008 // 00009 // Environment: 00010 // Software developed for the BaBar Detector at the SLAC B-Factory. 00011 // 00012 // Author List: 00013 // David R. Quarrie Original Author 00014 // Bob Jacobsen Started AbsEvent dbio mods 00015 // Marc Turcotte Modified for new style begin/end 00016 // Marc Turcotte Modified for new style event. 00017 // Marc Turcotte Merged in R.Kapur's TK interface 00018 // Marc Turcotte Modified for FNAL sigs 6/24/98 00019 // 00020 // Copyright Information: 00021 // Copyright (C) 1994, 1995 Lawrence Berkeley Laboratory 00022 // Copyright (C) 1998 University of Texas at Dallas 00023 // 00024 //------------------------------------------------------------------------ 00025 #include "Experiment/Experiment.hh" 00026 00027 //----------------------- 00028 // This Class's Header -- 00029 //----------------------- 00030 #include "Framework/AppStreamsOutputModule.hh" 00031 00032 //------------- 00033 // C Headers -- 00034 //------------- 00035 #include <assert.h> 00036 #include <string.h> 00037 00038 //------------------------------- 00039 // Collaborating Class Headers -- 00040 //------------------------------- 00041 #include "Framework/APPJob.hh" 00042 #include "Framework/AppFileStream.hh" 00043 #include "Framework/AppFileOutputCommand.hh" 00044 00045 class AbsEvent; 00046 #include "FrameUtil/APPList.hh" 00047 #include "FrameUtil/APPListIterator.hh" 00048 00049 //---------------------------------- 00050 // Templated Function realization -- 00051 //---------------------------------- 00052 //template void F_createTree(DATFileNode*& newNode); 00053 00054 // ---------------------------------------- 00055 // -- Public Function Member Definitions -- 00056 // ---------------------------------------- 00057 00058 //---------------- 00059 // Constructors -- 00060 //---------------- 00061 00062 AppStreamsOutputModule::AppStreamsOutputModule( const char* const theName, 00063 const char* const theDescription ) 00064 : APPOutputModule( theName, theDescription ), 00065 _theEvent ( NULL ), 00066 _outputCmd( NULL ), 00067 _outCmd ( NULL ) 00068 { 00069 _streams = new APPList< AppStream* >; 00070 } 00071 00072 //-------------- 00073 // Destructor -- 00074 //-------------- 00075 00076 AppStreamsOutputModule::~AppStreamsOutputModule( ) 00077 { 00078 APPListDeleteAll(*_streams); 00079 delete _streams; 00080 if ( NULL != _outputCmd ) { 00081 delete _outputCmd; 00082 } 00083 if ( NULL != _outCmd ) { 00084 delete _outCmd; 00085 } 00086 } 00087 00088 //-------------- 00089 // Operations -- 00090 //-------------- 00091 00092 AppResult 00093 AppStreamsOutputModule::beginJob( AbsEvent* anEvent ) { 00094 return AppResult::OK; 00095 } 00096 00097 AppResult 00098 AppStreamsOutputModule::beginRun( AbsEvent* anEvent ) 00099 { 00100 AppStream** theStream; 00101 bool status; 00102 00103 APPListIterator<AppStream*> theIterator( *streams( ) ); 00104 while ( theStream = theIterator( ) ) { 00105 if ( (*theStream)->isEnabled( ) && ! (*theStream)->isOpen( ) ) { 00106 status = (*theStream)->open( ); 00107 } 00108 } 00109 if ( NULL != anEvent ) { 00110 // Decide what to do when a real new run starts 00111 } 00112 00113 return AppResult::OK; 00114 00115 } 00116 00117 AppResult 00118 AppStreamsOutputModule::outputEvent( AbsEvent* anEvent ) 00119 { 00120 AppStream** theStream; 00121 bool status; 00122 00123 APPListIterator<AppStream*> theIterator( *streams( ) ); 00124 while ( theStream = theIterator( ) ) { 00125 status = (*theStream)->write( anEvent ); 00126 } 00127 return AppResult::OK; 00128 00129 } 00130 00131 AppResult 00132 AppStreamsOutputModule::outputFrame( AppFrame* aFrame ) { 00133 return AppResult::OK; 00134 } 00135 00136 00137 AppResult 00138 AppStreamsOutputModule::endRun( AbsEvent* anEvent ) { 00139 return AppResult::OK; 00140 } 00141 00142 AppResult 00143 AppStreamsOutputModule::endJob( AbsEvent* anEvent ) 00144 { 00145 AppStream** theStream; 00146 00147 APPListIterator<AppStream*> theIterator( *streams( ) ); 00148 while ( theStream = theIterator( ) ) { 00149 (*theStream)->close( ); 00150 } 00151 return AppResult::OK; 00152 } 00153 00154 AppResult 00155 AppStreamsOutputModule::abortJob( AbsEvent* anEvent) 00156 { 00157 AppStream** theStream; 00158 00159 APPListIterator<AppStream*> theIterator( *streams( ) ); 00160 while ( theStream = theIterator( ) ) { 00161 (*theStream)->close( ); 00162 } 00163 return AppResult::OK; 00164 } 00165 00166 void 00167 AppStreamsOutputModule::help(int argc, char** argv ) 00168 { 00169 APPOutputModule::help(argc, argv); 00170 } 00171 00172 AppStream* 00173 AppStreamsOutputModule::fetch( const char* const theName ) const 00174 { 00175 AppStream** theStream = NULL; 00176 00177 APPListIterator<AppStream*> theIterator( *streams( ) ); 00178 while ( theStream = theIterator( ) ) { 00179 if ( 0 == strcmp( (*theStream)->name( ), theName ) ) { 00180 break; 00181 } 00182 } 00183 return *theStream; 00184 } 00185 00186 bool 00187 AppStreamsOutputModule::has( const char* const theName ) const 00188 { 00189 AppStream** theStream; 00190 bool result = false; 00191 00192 APPListIterator<AppStream*> theIterator( *streams( ) ); 00193 while ( theStream = theIterator( ) ) { 00194 if ( 0 == strcmp( (*theStream)->name( ), theName ) ) { 00195 result = true; 00196 break; 00197 } 00198 } 00199 return result; 00200 } 00201 00202 //------------- 00203 // Selectors -- 00204 //------------- 00205 00206 APPList< AppStream* >* 00207 AppStreamsOutputModule::streams( ) const 00208 { 00209 return _streams; 00210 } 00211 00212 //------------- 00213 // Modifiers -- 00214 //------------- 00215 00216 void 00217 AppStreamsOutputModule::append( const AppStream* const theStream ) 00218 { 00219 assert( NULL != theStream ); 00220 00221 _streams->append( (AppStream*)theStream ); 00222 } 00223 00224 void 00225 AppStreamsOutputModule::remove( const AppStream* const theStream ) 00226 { 00227 assert( NULL != theStream ); 00228 00229 _streams->remove( (AppStream*)theStream ); 00230 } 00231 00232 void 00233 AppStreamsOutputModule::remove( const char* const theName ) 00234 { 00235 AppStream** theStream; 00236 00237 assert( NULL != theName ); 00238 00239 APPListIterator<AppStream*> theIterator( *streams( ) ); 00240 while ( theStream = theIterator( ) ) { 00241 if ( 0 == strcmp( (*theStream)->name( ), theName ) ) { 00242 _streams->remove( *theStream ); 00243 break; 00244 } 00245 } 00246 } 00247 00248 void 00249 AppStreamsOutputModule::wipeout( ) 00250 { 00251 APPListDeleteAll( *streams( ) ); 00252 }
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002