BmnRoot
Loading...
Searching...
No Matches
BmnFunctionSet.h
Go to the documentation of this file.
1#ifndef BMNFUNCTIONSET_H
2#define BMNFUNCTIONSET_H 1
3
4// STL
5#include <chrono>
6#include <string>
7// ROOT
8#include "TDatime.h"
9#include "TString.h"
10#include "TSystem.h"
11#include "TTimeStamp.h"
12
13using SysClock = std::chrono::system_clock;
14using SysPoint = std::chrono::time_point<SysClock>;
15
18{
19 public:
20 // check whether path is a directory
21 static bool isDirectory(TString path);
22 // check whether file exists: 1 - exists, 0 - not exists, -1 - exists but cannot access with the mode (default:
23 // kFileExists) fileName: file path; iVerbose: 0 - no output, 1 - print errors; mode: check for 'kFileExists', or
24 // has 'kExecutePermission', 'kWritePermission' or 'kReadPermission'
25 static int CheckFileExist(TString& fileName, int iVerbose = 0, EAccessMode mode = kFileExists);
26 // check whether directory exists: 1 - exists, 0 - not exists, -1 - exists but cannot access with the mode (default:
27 // kFileExists)
28 static int CheckDirectoryExist(TString& fileName, int iVerbose = 0, EAccessMode mode = kFileExists);
29 // create directory tree for the file name if not exists: 1 - exists, 0 - created
30 // error codes: -1 - exists but cannot access with the mode (default: kWritePermission), -2 - cannot be created, -3
31 // - empty file name
32 static int CreateDirectoryTree(TString& fileName, int iVerbose = 0, EAccessMode mode = kWritePermission);
33
34 // define whether ROOT file contains simulation data: 1 - true, 0 - false (experimental data), <0 - some errors
35 // occured if filename is not set then the function checks the current processing
36 static int isSimulationFile(TString fileName = "");
37
38 static TTimeStamp TimePoint2TS(SysPoint p);
39 static SysPoint TimeStamp2TP(TTimeStamp p);
40 static void PrintTimePoint(SysPoint p);
41 static std::string TimePoint2String(SysPoint p);
42 static SysPoint TDatime2GMT(TDatime& tdatime, Int_t timezoneOffsetHours = 0);
43
44 private:
47
48 ClassDef(BmnFunctionSet, 1)
49};
50
51#endif
std::chrono::system_clock SysClock
std::chrono::time_point< SysClock > SysPoint
static void PrintTimePoint(SysPoint p)
static int CreateDirectoryTree(TString &fileName, int iVerbose=0, EAccessMode mode=kWritePermission)
static SysPoint TDatime2GMT(TDatime &tdatime, Int_t timezoneOffsetHours=0)
static int CheckDirectoryExist(TString &fileName, int iVerbose=0, EAccessMode mode=kFileExists)
static std::string TimePoint2String(SysPoint p)
static int isSimulationFile(TString fileName="")
static SysPoint TimeStamp2TP(TTimeStamp p)
static bool isDirectory(TString path)
static TTimeStamp TimePoint2TS(SysPoint p)
static int CheckFileExist(TString &fileName, int iVerbose=0, EAccessMode mode=kFileExists)
std::chrono::time_point< SysClock > SysPoint