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