KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVAvailableRunsFile.h
Go to the documentation of this file.
1 /*
2 $Id: KVAvailableRunsFile.h,v 1.5 2008/02/07 09:25:39 franklan Exp $
3 $Revision: 1.5 $
4 $Date: 2008/02/07 09:25:39 $
5 */
6 
9 
10 #ifndef __KVAVAILABLERUNSFILE_H
11 #define __KVAVAILABLERUNSFILE_H
12 
13 #include <KVBase.h>
14 #include "Riostream.h"
15 
16 #include "TDatime.h"
17 #include "TString.h"
18 #include "KVNumberList.h"
19 #include "KVLockfile.h"
20 #include "KVDatime.h"
21 #include "KVDataSet.h"
22 #include "KVList.h"
23 #include "KVHashList.h"
24 #include "KVNameValueList.h"
25 
26 class KVDBSystem;
27 class TList;
28 
46 class KVAvailableRunsFile: public KVBase {
47 
49 
50 protected:
51  std::ifstream fRunlist;
53 
56  void ReadFile();
57  KVNameValueList* RunHasFileWithDateAndName(Int_t run, const Char_t* filename, TDatime modtime, Int_t& OccNum);
58 
59  const Char_t* GetFileName() const;
60  const Char_t* GetFilePath() const;
63  virtual Bool_t OpenAvailableRunsFile();
64  virtual void CloseAvailableRunsFile();
65 
67  {
68  return fRunlist.is_open();
69  };
70 
71 public:
72 
74  KVAvailableRunsFile(const Char_t* type);
75  KVAvailableRunsFile(const Char_t* type, const KVDataSet* parent);
77 
79  {
81  }
82 
83  const Char_t* GetDataType() const
84  {
85  return GetName();
86  }
87  Int_t IsRunFileName(const Char_t* filename);
88  static Int_t IsRunFileName(const KVString& fmt, const Char_t* filename, Int_t index_multiplier = 10, const Char_t* separators = ".");
89  Bool_t ExtractDateFromFileName(const Char_t* name, KVDatime& date);
90  static Bool_t ExtractDateFromFileName(const TString& fmt, const Char_t* name, KVDatime& date);
91  virtual void Update(Bool_t no_existing_file = kFALSE);
92  virtual Bool_t CheckAvailable(Int_t run);
93  virtual Int_t Count(Int_t run);
94  virtual Bool_t GetRunInfo(Int_t run, TDatime& modtime,
95  TString& filename);
96  virtual void GetRunInfos(Int_t run, KVList* dates, KVList* names);
97  const Char_t* GetFileName(Int_t run);
98  virtual TList* GetListOfAvailableSystems(const KVDBSystem* systol = 0);
99  virtual KVNumberList GetRunList(const KVDBSystem* system = 0);
100 
101  virtual void Remove(Int_t run, const Char_t* filename = "");
102  virtual void UpdateInfos(Int_t run, const Char_t* filename, const Char_t* kvversion, const Char_t* username);
103  virtual Bool_t InfosNeedUpdate(Int_t run, const Char_t* filename);
104  virtual void Add(Int_t run, const Char_t* filename);
105  const KVDataSet* GetDataSet() const
106  {
108  return fDataSet;
109  }
110 
111  void SetDataSet(const KVDataSet* d)
112  {
114  fDataSet = d;
115  }
116 
118  void RemoveDuplicateLines(KVNumberList lines_to_be_removed);
119 
120  ClassDef(KVAvailableRunsFile, 1) //Handles text files containing list of available runs for different datasets and types of data
121 };
122 
123 #endif
int Int_t
#define d(i)
char Char_t
bool Bool_t
#define ClassDef(name, id)
R__EXTERN TSystem * gSystem
Handles lists of available runs for different datasets and types of data.
virtual void CloseAvailableRunsFile()
Bool_t CheckDirectoryForAvailableRunsFile()
Bool_t FileExists() const
virtual void Add(Int_t run, const Char_t *filename)
virtual Bool_t GetRunInfo(Int_t run, TDatime &modtime, TString &filename)
Bool_t ExtractDateFromFileName(const Char_t *name, KVDatime &date)
const Char_t * GetDataType() const
void SetDataSet(const KVDataSet *d)
KVNumberList CheckMultiRunfiles()
Returns a list with all runs which occur more than once in the available runs file.
const KVDataSet * fDataSet
dataset to which this file belongs
virtual Bool_t CheckAvailable(Int_t run)
virtual void Update(Bool_t no_existing_file=kFALSE)
virtual ~ KVAvailableRunsFile()
KVHashList * fAvailableRuns
temporary list used to store infos when updating
virtual KVNumberList GetRunList(const KVDBSystem *system=0)
const Char_t * GetFileName() const
const KVDataSet * GetDataSet() const
KVLockfile runlist_lock
for locking runlist file
KVNameValueList * RunHasFileWithDateAndName(Int_t run, const Char_t *filename, TDatime modtime, Int_t &OccNum)
virtual TList * GetListOfAvailableSystems(const KVDBSystem *systol=0)
virtual Int_t Count(Int_t run)
static KVString date_read_from_filename
virtual void UpdateInfos(Int_t run, const Char_t *filename, const Char_t *kvversion, const Char_t *username)
const Char_t * GetFullPathToAvailableRunsFile() const
virtual void Remove(Int_t run, const Char_t *filename="")
KVAvailableRunsFile()
Default ctor.
virtual void GetRunInfos(Int_t run, KVList *dates, KVList *names)
virtual Bool_t InfosNeedUpdate(Int_t run, const Char_t *filename)
std::ifstream fRunlist
for reading runlist file
Int_t IsRunFileName(const Char_t *filename)
virtual Bool_t OpenAvailableRunsFile()
const Char_t * GetFilePath() const
void RemoveDuplicateLines(KVNumberList lines_to_be_removed)
Base class for KaliVeda framework.
Definition: KVBase.h:141
Database class used to store information on different colliding systems studied during an experiment.
Definition: KVDBSystem.h:51
Manage an experimental dataset corresponding to a given experiment or campaign.
Definition: KVDataSet.h:207
Extension of TDatime to handle various useful date formats.
Definition: KVDatime.h:32
Extended version of ROOT THashList.
Definition: KVHashList.h:28
Extended TList class which owns its objects by default.
Definition: KVList.h:27
Interface to (Linux) system lockfile command.
Definition: KVLockfile.h:69
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:83
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
virtual const char * GetName() const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)