CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
evf::DirManager Class Reference

#include <DirManager.h>

Public Member Functions

bool checkDirEmpty (std::string &)
 
 DirManager (std::string &d)
 
unsigned int findHighestRun ()
 
std::string findHighestRunDir ()
 
std::string findRunDir (unsigned int)
 
virtual ~DirManager ()
 

Private Attributes

std::string dir_
 

Detailed Description

Definition at line 13 of file DirManager.h.

Constructor & Destructor Documentation

evf::DirManager::DirManager ( std::string &  d)
inline

Definition at line 16 of file DirManager.h.

virtual evf::DirManager::~DirManager ( )
inlinevirtual

Member Function Documentation

bool evf::DirManager::checkDirEmpty ( std::string &  d)

Definition at line 53 of file DirManager.cc.

References dir.

Referenced by ~DirManager().

54  {
55 
56  int filecount=0;
57  DIR *dir = opendir(d.c_str());
58  struct dirent *buf;
59  while((buf=readdir(dir))){
60  filecount++;
61  }
62  return (filecount==0);
63  }
dbl *** dir
Definition: mlp_gen.cc:35
unsigned int evf::DirManager::findHighestRun ( )

Definition at line 7 of file DirManager.cc.

References dir, dir_, maxrun, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~DirManager().

7  {
8  DIR *dir = opendir(dir_.c_str());
9  struct dirent *buf;
10  int maxrun = 0;
11  while((buf=readdir(dir))){
12  std::string dirnameNum = buf->d_name;
13  if (dirnameNum.find("run")!=std::string::npos)
14  dirnameNum=dirnameNum.substr(3,std::string::npos);
15  if(atoi(dirnameNum.c_str()) > maxrun){maxrun = atoi(dirnameNum.c_str());}
16  }
17  closedir(dir);
18  return maxrun;
19  }
Int_t maxrun
std::string dir_
Definition: DirManager.h:23
dbl *** dir
Definition: mlp_gen.cc:35
std::string evf::DirManager::findHighestRunDir ( )

Definition at line 20 of file DirManager.cc.

References dir, dir_, maxrun, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by evf::EvFDaqDirector::preBeginRun(), and ~DirManager().

20  {
21  std::string retval = dir_ + "/";
22  std::string tmpdir;
23  DIR *dir = opendir(dir_.c_str());
24  struct dirent *buf;
25  int maxrun = 0;
26  while((buf=readdir(dir))){
27  std::string dirnameNum = buf->d_name;
28  if (dirnameNum.find("run")!=std::string::npos)
29  dirnameNum=dirnameNum.substr(3,std::string::npos);
30  if(atoi(dirnameNum.c_str()) > maxrun){tmpdir = buf->d_name; maxrun = atoi(dirnameNum.c_str());}
31  }
32  closedir(dir);
33  retval += tmpdir;
34  return retval;
35  }
Int_t maxrun
std::string dir_
Definition: DirManager.h:23
dbl *** dir
Definition: mlp_gen.cc:35
std::string evf::DirManager::findRunDir ( unsigned int  run)

Definition at line 37 of file DirManager.cc.

References dir, dir_, Exception, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~DirManager().

37  {
38  std::string retval = dir_ + "/";
39  std::string tmpdir = "";
40  DIR *dir = opendir(dir_.c_str());
41  struct dirent *buf;
42  while((buf=readdir(dir))){
43  std::string dirnameNum = buf->d_name;
44  if (dirnameNum.find("run")!=std::string::npos)
45  dirnameNum=dirnameNum.substr(3,std::string::npos);
46  if((unsigned int)atoi(dirnameNum.c_str()) ==run){tmpdir = buf->d_name; break;}
47  }
48  closedir(dir);
49  if(tmpdir=="") throw cms::Exception("LogicError") << "Run Directory for Run " << run << " Not Found";
50  retval += tmpdir;
51  return retval;
52  }
std::string dir_
Definition: DirManager.h:23
dbl *** dir
Definition: mlp_gen.cc:35

Member Data Documentation

std::string evf::DirManager::dir_
private

Definition at line 23 of file DirManager.h.

Referenced by findHighestRun(), findHighestRunDir(), and findRunDir().