メインページ   モジュール   名前空間一覧   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TReadFileCommand.cc

解説を見る。
00001 // =====================================================================
00002 //  $Id: TReadFileCommand.cc,v 1.4 2004/03/07 10:30:28 goiwai Exp $
00003 //  $Name: CLDAQ-1-14-03 $
00004 //  $Log: TReadFileCommand.cc,v $
00005 //  Revision 1.4  2004/03/07 10:30:28  goiwai
00006 //  ROOTに組みこむためのおまじないマクロを埋めこみました。
00007 //  全てにおいて完全に動作するわけではありません。
00008 //
00009 //  Revision 1.3  2003/10/06 17:02:37  goiwai
00010 //  *** empty log message ***
00011 //
00012 //  Revision 1.2  2003/07/30 16:17:32  goiwai
00013 //  ファイルにコミットログをつけることにしました.
00014 //
00015 // =====================================================================
00016 #include "TReadFileCommand.hh"
00017 #include "TInputObjectFile.hh"
00018 #include "TDataRecord.hh"
00019 
00020 static const Tstring _name = "/option/readfile";
00021 static const Tstring _desc = "open a object file, dump to screen.\nexample> /option/readfile filename.drec";
00022 
00023 TReadFileCommand::TReadFileCommand( TRunManager* manager )
00024   : TCommand( manager, _name, _desc )
00025 {;}
00026 
00027 TReadFileCommand::~TReadFileCommand()
00028 {;}
00029 
00030 Tvoid TReadFileCommand::Execute( const TstringList& arguments )
00031 {
00032   if ( arguments.size() != 1 ) {
00033     ShowCommandDetail();
00034     return;
00035   }
00036 
00037   const Tstring filename = arguments[ 0 ];
00038   TInputObjectFile* ifile = new TInputObjectFile( filename );
00039   Tint nevents = 0;
00040   Tint datasize = 0;
00041 
00042   TDataRecord record;
00043   while ( ( ifile -> Read( record ) ) != 0 ) {
00044     Tcout << record << Tendl;
00045     datasize += record.GetRecordSize();
00046     nevents ++;
00047   }
00048 
00049   Tcout << nevents << " events, ";
00050   Tcout << datasize << Tslash << ifile -> GetTotalDataSize();
00051   Tcout << " byte data has been read from " << filename << "." << Tendl;
00052 
00053   delete ifile;
00054 
00055   return;
00056 }
00057 
00058 #ifdef __CLDAQ_ROOT_DLL
00059     ClassImp(TReadFileCommand)
00060 #endif


CLDAQ - a Class Library for DataAcQuisition (Version 1.14.3)
Go IWAI -- goiwai at users.sourceforge.jp