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

TRunTimeLimitCommand.cc

解説を見る。
00001 // =====================================================================
00002 //  $Id: TRunTimeLimitCommand.cc,v 1.4 2004/03/07 10:30:28 goiwai Exp $
00003 //  $Name: CLDAQ-1-14-03 $
00004 //  $Log: TRunTimeLimitCommand.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 "TRunTimeLimitCommand.hh"
00017 #include "TRunManager.hh"
00018 #include "TUserInterface.hh"
00019 
00020 static const Tstring _name = "/run/timelimit";
00021 static const Tstring _desc = "set time limit in second for a run scheduling.\nexample> /run/timelimit 3600 // an hour.";
00022 
00023 TRunTimeLimitCommand::TRunTimeLimitCommand( TRunManager* manager )
00024   : TCommand( manager, _name, _desc )
00025 {;}
00026 
00027 TRunTimeLimitCommand::~TRunTimeLimitCommand()
00028 {;}
00029 
00030 Tvoid TRunTimeLimitCommand::Execute( const TstringList& arguments )
00031 {
00032   static const Tstring head = "TRunTimeLimitCommand::Execute: ";
00033   TUserInterface* ui = theRunManager -> GetUserInterface();
00034 
00035   if ( arguments.empty() ) {
00036     TUint rest = alarm( alarm( 0 ) );
00037     if ( rest == 0 ) {
00038       Tcout << "this run is not scheduled by alarm." << Tendl;
00039     } else {
00040       ui -> ExecuteCommand( "/system/date" );
00041       Tcout << "this run is scheduled to stop after " << rest << " seconds." << Tendl;
00042     }
00043   } else if ( arguments.size() == 1 ) {
00044     TUint timesec = strtoul( arguments[ 0 ].c_str(), 0, 0 );
00045     TUint ret = alarm( timesec );
00046     if ( ret != 0 ) {
00047       ui -> ExecuteCommand( "/system/date" );
00048       Tcout << "this run was re-scheduled to stop after " << timesec << " seconds." << Tendl;
00049       Tcout << "last schedule is " << ret << " seconds, was removed." << Tendl;
00050     } else {
00051       Tcout << "this run was scheduled to stop after " << timesec << " seconds." << Tendl;
00052     }
00053   } else {
00054     ShowCommandDetail();
00055   }
00056 
00057   return;
00058 }
00059 
00060 #ifdef __CLDAQ_ROOT_DLL
00061     ClassImp(TRunTimeLimitCommand)
00062 #endif


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