Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JFilenameSupportkit.hh
Go to the documentation of this file.
1 #ifndef __JSUPPORT__JFILENAMESUPPORTTOOLKIT__
2 #define __JSUPPORT__JFILENAMESUPPORTTOOLKIT__
3 
4 #include <string>
5 #include "Jeep/JeepToolkit.hh"
6 
7 
8 /**
9  * \file
10  * Specifications of file name extensions.
11  * \author mdejong
12  */
13 namespace JSUPPORT {}
14 namespace JPP { using namespace JSUPPORT; }
15 
16 namespace JSUPPORT {
17 
19 
20 
21  static const char* const ROOT_FILE_FORMAT = "root"; //!< ROOT file name extension
22  static const char* const DAQ_FILE_FORMAT = "dat"; //!< DAQ binary file name extension
23  static const char* const MONTE_CARLO_FILE_FORMAT = "evt"; //!< ASCII file name extension
24  static const char* const GZIP_FILE_FORMAT = "gz"; //!< gzip file name extension
25 
26 
27  /**
28  * Check file format.
29  *
30  * \return true if ROOT format; else false
31  */
32  inline bool isROOTFile(const char* file_name)
33  {
34  return getFilenameExtension(file_name) == ROOT_FILE_FORMAT;
35  }
36 
37 
38  /**
39  * Check file format.
40  *
41  * \return true if DAQ format; else false
42  */
43  inline bool isDAQFile(const char* file_name)
44  {
45  return getFilenameExtension(file_name) == DAQ_FILE_FORMAT;
46  }
47 
48 
49  /**
50  * Check file format.
51  *
52  * \return true if MONTE CARLO format; else false
53  */
54  inline bool isMonteCarloFile(const char* file_name)
55  {
56  return getFilenameExtension(file_name) == MONTE_CARLO_FILE_FORMAT;
57  }
58 
59 
60  /**
61  * Check file format.
62  *
63  * \return true if gzip format; else false
64  */
65  inline bool isGzipFile(const char* file_name)
66  {
67  return getFilenameExtension(file_name) == GZIP_FILE_FORMAT;
68  }
69 }
70 
71 #endif
static const char *const GZIP_FILE_FORMAT
gzip file name extension
bool isDAQFile(const char *file_name)
Check file format.
static const char *const MONTE_CARLO_FILE_FORMAT
ASCII file name extension.
bool isGzipFile(const char *file_name)
Check file format.
bool isROOTFile(const char *file_name)
Check file format.
static const char *const DAQ_FILE_FORMAT
DAQ binary file name extension.
Auxiliary methods for handling file names, type names and environment.
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
Definition: JeepToolkit.hh:69
bool isMonteCarloFile(const char *file_name)
Check file format.
static const char *const ROOT_FILE_FORMAT
ROOT file name extension.