CARMA C++
SyslogMMAPOperator.h
Go to the documentation of this file.
1 #ifndef CARMA_DBMS_SYSLOGMMAPOPERATOR_H
2 #define CARMA_DBMS_SYSLOGMMAPOPERATOR_H
3 
5 #include <string>
6 #include <map>
7 
8 #include <sys/types.h>
9 #include <regex.h>
10 
17 namespace carma
18 {
19  namespace dbms
20  {
21 
28  {
29  public:
30 
37 
40 
41  void setWayBackMachine( double mjd );
42  void resetWayBackMachine();
43  SyslogMessage *nextMessage();
44  int messagesWaiting()
45  {
46  int adj = 0;
47 
48  if ( _pos > _cpos )
49  adj = _pos;
50 
51  return ( (_cpos + adj) - _pos );
52  };
53 
54  void setFilter( ::std::string &myFilter );
55  ::std::string::size_type instantSetSize() { return _setSize; };
56 
57  ::std::string toString();
58 
59  bool hasFilter() { return _hasFilter; };
60  void resetFilter();
61  bool doesMatch( SyslogMessage *msg );
62 
63  ::std::string getFilter() { return _filter; };
64 
65  typedef enum
66  {
67  ALL,
68  PROGRAM,
69  LOGNAME,
70  NDC,
71  MESSAGE
72  } fieldList;
73 
74  private:
75  SyslogMMAPFile &_smapf;
76  ::std::string _filter;
77  ::std::string::size_type _setSize;
78  ::std::string _mjdOffsetString;
79  ::std::string _opString;
80  bool _opGreater;
81  ::std::string _valString;
82  ::std::string _textString;
83  ::std::string _fieldString;
84  int _fieldCheck;
85  regex_t *_regex;
86 
87  int _prioInt;
88 
89  double _mjdOffset;
90  long _cpos, _pos;
91  bool _current;
92  bool _hasFilter;
93  };
94  }
95 }
96 
97 #endif // CARMA_DBMS_SYSLOGMMAPOPERATOR_H
This class is responsible for performing various operations on the syslog cache.
This class is responsible for opening/closing the syslog mmap file.
~SyslogMMAPOperator()
The destructor.
SyslogMMAPOperator(SyslogMMAPFile &smapf)
Constructor.