Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
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 */
13namespace JSUPPORT {}
14namespace JPP { using namespace JSUPPORT; }
15
16namespace 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 JPP_FILE_FORMAT = "jpp"; //!< file name extension Jpp binary format
25 static const char* const MONTE_CARLO_FILE_FORMAT = "evt"; //!< file name extension ASCII format
26 static const char* const GZIP_FILE_FORMAT = "gz"; //!< file name extension gzip format
27 static const char* const ASCII_FILE_FORMAT = "txt"; //!< file name extension ASCII format
28 static const char* const FILE_LIST_FORMAT = "files"; //!< file name extension ASCII format with list of file names
29
30
31 /**
32 * Check file format.
33 *
34 * \return true if ROOT format; else false
35 */
36 inline bool isROOTFile(const char* file_name)
37 {
38 return getFilenameExtension(file_name) == ROOT_FILE_FORMAT;
39 }
40
41
42 /**
43 * Check file format.
44 *
45 * \return true if ROOT format; else false
46 */
47 inline bool isJSONFile(const char* file_name)
48 {
49 return getFilenameExtension(file_name) == JSON_FILE_FORMAT;
50 }
51
52
53 /**
54 * Check file format.
55 *
56 * \return true if DAQ format; else false
57 */
58 inline bool isDAQFile(const char* file_name)
59 {
60 return getFilenameExtension(file_name) == DAQ_FILE_FORMAT;
61 }
62
63
64 /**
65 * Check file format.
66 *
67 * \return true if Jpp format; else false
68 */
69 inline bool isJppFile(const char* file_name)
70 {
71 return getFilenameExtension(file_name) == JPP_FILE_FORMAT;
72 }
73
74
75 /**
76 * Check file format.
77 *
78 * \return true if MONTE CARLO format; else false
79 */
80 inline bool isMonteCarloFile(const char* file_name)
81 {
82 return getFilenameExtension(file_name) == MONTE_CARLO_FILE_FORMAT;
83 }
84
85
86 /**
87 * Check file format.
88 *
89 * \return true if gzip format; else false
90 */
91 inline bool isGzipFile(const char* file_name)
92 {
93 return getFilenameExtension(file_name) == GZIP_FILE_FORMAT;
94 }
95}
96
97#endif
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Support classes and methods for experiment specific I/O.
static const char *const JSON_FILE_FORMAT
file name extension JSON format
static const char *const DAQ_FILE_FORMAT
file name extension DAQ binary format
bool isJSONFile(const char *file_name)
Check file format.
bool isROOTFile(const char *file_name)
Check file format.
static const char *const GZIP_FILE_FORMAT
file name extension gzip format
bool isGzipFile(const char *file_name)
Check file format.
static const char *const FILE_LIST_FORMAT
file name extension ASCII format with list of file names
static const char *const ASCII_FILE_FORMAT
file name extension ASCII format
bool isJppFile(const char *file_name)
Check file format.
static const char *const JPP_FILE_FORMAT
file name extension Jpp binary format
static const char *const ROOT_FILE_FORMAT
file name extension ROOT format
static const char *const MONTE_CARLO_FILE_FORMAT
file name extension ASCII format
bool isDAQFile(const char *file_name)
Check file format.
bool isMonteCarloFile(const char *file_name)
Check file format.