Jpp  18.2.1-ARCA-DF-PATCH
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAbstractFile.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JABSTRACTFILE__
2 #define __JLANG__JABSTRACTFILE__
3 
4 #include <stdio.h>
5 
6 #include "JLang/JComparable.hh"
7 
8 
9 /**
10  * \author mdejong
11  */
12 
13 namespace JLANG {}
14 namespace JPP { using namespace JLANG; }
15 
16 namespace JLANG {
17 
18 
19  /**
20  * The JAbstractFile class encapsulates the c-style file descriptor.
21  */
22  class JAbstractFile :
23  public JComparable<JAbstractFile>
24  {
25  public:
26 
27  static const int FILE_CLOSED = -1;
28 
29 
30  /**
31  * Default constructor.
32  */
35  {}
36 
37 
38  /**
39  * Constructor.
40  *
41  * \param file file descriptor
42  */
43  JAbstractFile(const int file) :
44  fileDescriptor(file)
45  {}
46 
47 
48  /**
49  * Constructor.
50  *
51  * \param stream file stream
52  */
53  JAbstractFile(FILE* stream) :
54  fileDescriptor(fileno(stream))
55  {}
56 
57 
58  /**
59  * Less than operation.
60  *
61  * \param file JAbstractFile to be compared
62  * \return true if this file descriptor is less; else false
63  */
64  bool less(const JAbstractFile& file) const
65  {
66  return getFileDescriptor() < file.getFileDescriptor();
67  }
68 
69 
70  /**
71  * Get file descriptor.
72  *
73  * \return file descriptor
74  */
75  int getFileDescriptor() const
76  {
77  return fileDescriptor;
78  }
79 
80 
81  /**
82  * Set file descriptor.
83  *
84  * \param file file descriptor
85  */
86  void setFileDescriptor(const int file)
87  {
89  }
90 
91 
92  /**
93  * Get open status.
94  */
95  bool is_open() const
96  {
97  return fileDescriptor != FILE_CLOSED;
98  }
99 
100 
101  protected:
103  };
104 }
105 
106 #endif
bool less(const JAbstractFile &file) const
Less than operation.
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
Definition: JDataQuality.sh:19
JAbstractFile(const int file)
Constructor.
JAbstractFile()
Default constructor.
int getFileDescriptor() const
Get file descriptor.
static const int FILE_CLOSED
bool is_open() const
Get open status.
The JAbstractFile class encapsulates the c-style file descriptor.
Template definition of auxiliary base class for comparison of data structures.
Definition: JComparable.hh:24
JAbstractFile(FILE *stream)
Constructor.
then FILE
void setFileDescriptor(const int file)
Set file descriptor.