Jpp  15.0.5
the software that should make you happy
 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 JSON_FILE_FORMAT = "json"; //!< JSON file name extension
23  static const char* const DAQ_FILE_FORMAT = "dat"; //!< DAQ binary file name extension
24  static const char* const MONTE_CARLO_FILE_FORMAT = "evt"; //!< ASCII file name extension
25  static const char* const GZIP_FILE_FORMAT = "gz"; //!< gzip file name extension
26  static const char* const ASCII_FILE_FORMAT = "txt"; //!< ASCII file name extension
27 
28 
29  /**
30  * Check file format.
31  *
32  * \return true if ROOT format; else false
33  */
34  inline bool isROOTFile(const char* file_name)
35  {
36  return getFilenameExtension(file_name) == ROOT_FILE_FORMAT;
37  }
38 
39 
40  /**
41  * Check file format.
42  *
43  * \return true if ROOT format; else false
44  */
45  inline bool isJSONFile(const char* file_name)
46  {
47  return getFilenameExtension(file_name) == JSON_FILE_FORMAT;
48  }
49 
50 
51  /**
52  * Check file format.
53  *
54  * \return true if DAQ format; else false
55  */
56  inline bool isDAQFile(const char* file_name)
57  {
58  return getFilenameExtension(file_name) == DAQ_FILE_FORMAT;
59  }
60 
61 
62  /**
63  * Check file format.
64  *
65  * \return true if MONTE CARLO format; else false
66  */
67  inline bool isMonteCarloFile(const char* file_name)
68  {
69  return getFilenameExtension(file_name) == MONTE_CARLO_FILE_FORMAT;
70  }
71 
72 
73  /**
74  * Check file format.
75  *
76  * \return true if gzip format; else false
77  */
78  inline bool isGzipFile(const char* file_name)
79  {
80  return getFilenameExtension(file_name) == GZIP_FILE_FORMAT;
81  }
82 }
83 
84 #endif
static const char *const GZIP_FILE_FORMAT
gzip file name extension
static const char *const JSON_FILE_FORMAT
JSON 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.
static const char *const ASCII_FILE_FORMAT
ASCII file name extension.
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.
bool isJSONFile(const char *file_name)
Check file format.