LRAUV  revA
LoggerRules.h
Go to the documentation of this file.
1 
12 #ifndef LOGGERRULES_H_
13 #define LOGGERRULES_H_
14 
15 #include "DataEntry.h"
16 #include "EventEntry.h"
17 #include "SyslogEntry.h"
18 
26 class Rule
27 {
28 public:
30  virtual ~Rule( void )
31  {}
32  ;
33 
35  virtual bool check( const LogEntry *entry ) = 0;
36 
38  virtual Str toString( void ) = 0;
39 
40  virtual void activate();
41 
42  virtual void deactivate();
43 
44  virtual bool isActive();
45 
46 protected:
47 
49  Rule( void );
50 
51 private:
52  // Note that the copy constructor below is private and not given a body.
53  // Any attempt to call it will return a compiler error.
54  Rule( const Rule& old ); // disallow copy constructor
55 
56  bool active_;
57 
58 };
59 
65 class AndRule : public Rule
66 {
67 public:
68  AndRule( Rule *ruleOneIn,
69  Rule *ruleTwoIn,
70  Rule *ruleThreeIn = NULL,
71  Rule *ruleFourIn = NULL,
72  Rule *ruleFiveIn = NULL,
73  Rule *ruleSizIn = NULL,
74  Rule *ruleSevenIn = NULL );
75 
76  virtual ~AndRule( void );
77 
78  virtual bool check( const LogEntry *entry );
79 
80  virtual Str toString( void );
81 
82 private:
83  // Note that the copy constructor below is private and not given a body.
84  // Any attempt to call it will return a compiler error.
85  AndRule( const AndRule& old ); // disallow copy constructor
86 
88 };
89 
95 class OrRule : public Rule
96 {
97 public:
98  OrRule( Rule *ruleOneIn,
99  Rule *ruleTwoIn,
100  Rule *ruleThreeIn = NULL,
101  Rule *ruleFourIn = NULL,
102  Rule *ruleFiveIn = NULL );
103 
104  virtual ~OrRule( void );
105 
106  virtual bool check( const LogEntry *entry );
107 
108  virtual Str toString( void );
109 
110 private:
111  // Note that the copy constructor below is private and not given a body.
112  // Any attempt to call it will return a compiler error.
113  OrRule( const OrRule& old ); // disallow copy constructor
114 
116 };
117 
123 class NotRule : public Rule
124 {
125 public:
126  NotRule( Rule *ruleIn );
127 
128  virtual ~NotRule( void );
129 
130  virtual bool check( const LogEntry *entry );
131 
132  virtual Str toString( void );
133 
134 private:
135  // Note that the copy constructor below is private and not given a body.
136  // Any attempt to call it will return a compiler error.
137  NotRule( const NotRule& old ); // disallow copy constructor
138 
140 };
141 
147 class TypeRule : public Rule
148 {
149 public:
150  TypeRule( LogEntry::Type typeIn );
151 
152  virtual ~TypeRule( void );
153 
154  virtual bool check( const LogEntry *entry );
155 
156  virtual Str toString( void );
157 
158 private:
159 
162 };
163 
173 class EventTypeRule : public Rule
174 {
175 public:
177 
178  virtual ~EventTypeRule( void );
179 
180  virtual bool check( const LogEntry *entry );
181 
182  virtual Str toString( void );
183 
184 private:
185 
188 };
189 
200 class SyslogSeverityRule : public Rule
201 {
202 public:
203  SyslogSeverityRule( Syslog::Severity sev, bool orGreater = true );
204 
205  virtual ~SyslogSeverityRule( void );
206 
207  virtual bool check( const LogEntry *entry );
208 
209  virtual Str toString( void );
210 
211 private:
212 
216 };
217 
226 class SyslogStartRule : public Rule
227 {
228 public:
229  SyslogStartRule( const Str& start );
230 
231  virtual ~SyslogStartRule( void );
232 
233  virtual bool check( const LogEntry *entry );
234 
235  virtual Str toString( void );
236 
237 private:
238 
241 };
242 
256 class DataWriteRule : public Rule
258 {
259 public:
260  DataWriteRule( bool dataWrite );
261 
262  virtual ~DataWriteRule( void );
263 
264  virtual bool check( const LogEntry *entry );
265 
266  virtual Str toString( void );
267 
268 private:
269 
272 };
273 
290 class DataNameRule : public DataWriteRule
292 {
293 public:
294  DataNameRule( const Str& dataName, bool dataWrite = true );
295 
296  virtual ~DataNameRule( void );
297 
298  virtual bool check( const LogEntry *entry );
299 
300  virtual Str toString( void );
301 
302 private:
303 
304  const Str dataName_;
305  unsigned short code_;
306  unsigned int slateElementURICount_;
307 };
308 #endif /*LOGGERRULES_H_*/
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:80
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:301
virtual void activate()
Definition: LoggerRules.cpp:23
bool orGreater_
Definition: LoggerRules.h:215
AndRule(Rule *ruleOneIn, Rule *ruleTwoIn, Rule *ruleThreeIn=NULL, Rule *ruleFourIn=NULL, Rule *ruleFiveIn=NULL, Rule *ruleSizIn=NULL, Rule *ruleSevenIn=NULL)
Definition: LoggerRules.cpp:38
Str start_
The SyslogEntry start text we are looking for.
Definition: LoggerRules.h:240
EventEntry::EventType eventType_
The LogEntry type we're looking for.
Definition: LoggerRules.h:187
virtual ~NotRule(void)
Definition: LoggerRules.cpp:157
bool dataWrite_
The LogEntry type we're looking for.
Definition: LoggerRules.h:271
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:276
virtual ~OrRule(void)
Definition: LoggerRules.cpp:115
virtual ~SyslogSeverityRule(void)
Definition: LoggerRules.cpp:216
A logging Rule implementing a logical NOT() of another rules.
Definition: LoggerRules.h:123
Rule * ruleFour_
Definition: LoggerRules.h:115
Type
Defines an enum for "typing" the various LogEntries.
Definition: LogEntry.h:38
Rule * ruleSeven_
Definition: LoggerRules.h:87
Rule * ruleSix_
Definition: LoggerRules.h:87
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:254
EventType
Type of data event.
Definition: EventEntry.h:58
NotRule(Rule *ruleIn)
Definition: LoggerRules.cpp:152
EventTypeRule(EventEntry::EventType eventIn)
Definition: LoggerRules.cpp:189
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:162
A Logger Rule which matches against a given LogEvent::EventEntry.
Definition: LoggerRules.h:173
unsigned int slateElementURICount_
Definition: LoggerRules.h:306
Rule * ruleTwo_
Definition: LoggerRules.h:87
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:91
virtual ~AndRule(void)
Definition: LoggerRules.cpp:54
Rule * ruleFour_
Definition: LoggerRules.h:87
A logging Rule implementing a logical OR() between two other rules.
Definition: LoggerRules.h:95
TypeRule(LogEntry::Type typeIn)
Definition: LoggerRules.cpp:172
One "entry" in a LogQueue.
Definition: LogEntry.h:33
virtual ~DataWriteRule(void)
Definition: LoggerRules.cpp:273
A Logger Rule which specifies either data writes or data reads.
Definition: LoggerRules.h:257
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:219
virtual ~EventTypeRule(void)
Definition: LoggerRules.cpp:193
DataWriteRule(bool dataWrite)
Definition: LoggerRules.cpp:269
unsigned short code_
Definition: LoggerRules.h:305
virtual ~SyslogStartRule(void)
Definition: LoggerRules.cpp:251
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:206
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:242
DataNameRule(const Str &dataName, bool dataWrite=true)
Definition: LoggerRules.cpp:291
A logging Rule which matches against a given LogEntry::Type.
Definition: LoggerRules.h:147
Rule * ruleFive_
Definition: LoggerRules.h:115
Replacement for standard template class string.
Definition: Str.h:12
virtual ~Rule(void)
Destructor.
Definition: LoggerRules.h:30
SyslogStartRule(const Str &start)
Definition: LoggerRules.cpp:247
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:264
LogEntry::Type type_
The LogEntry type we're looking for.
Definition: LoggerRules.h:161
Rule * ruleThree_
Definition: LoggerRules.h:115
Abstract base class for classes that are used by LogEngine to determine which LogWriter(s) to use for...
Definition: LoggerRules.h:26
A Logger Rule which matches against the starting text of a SyslogEntry.
Definition: LoggerRules.h:226
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:328
Rule * ruleFive_
Definition: LoggerRules.h:87
Contains the DataEntry class definition.
virtual void deactivate()
Definition: LoggerRules.cpp:28
Rule * ruleTwo_
Definition: LoggerRules.h:115
A Logger Rule which specifies either data writes or data reads using an element with an ElementURI ma...
Definition: LoggerRules.h:291
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:167
Rule * ruleOne_
Definition: LoggerRules.h:87
Rule * ruleThree_
Definition: LoggerRules.h:87
virtual bool isActive()
Definition: LoggerRules.cpp:33
A Logger Rule which matches against a given SyslogSeverity If the SyslogEntry's severity equals or ex...
Definition: LoggerRules.h:200
Contains the SyslogEntry class definition.
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:142
SyslogSeverityRule(Syslog::Severity sev, bool orGreater=true)
Definition: LoggerRules.cpp:211
const Str dataName_
Definition: LoggerRules.h:304
virtual Str toString(void)=0
Serialize this Rule to a Str.
virtual bool check(const LogEntry *entry)=0
Does this rule match this LogEntry.
bool active_
Definition: LoggerRules.h:56
A logging Rule implementing a logical AND() between two other rules.
Definition: LoggerRules.h:65
virtual ~TypeRule(void)
Definition: LoggerRules.cpp:176
Severity
An attempt to define different levels of syslog severity.
Definition: Syslog.h:28
OrRule(Rule *ruleOneIn, Rule *ruleTwoIn, Rule *ruleThreeIn=NULL, Rule *ruleFourIn=NULL, Rule *ruleFiveIn=NULL)
Definition: LoggerRules.cpp:103
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:196
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:286
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:179
Rule * ruleOne_
Definition: LoggerRules.h:115
virtual ~DataNameRule(void)
Definition: LoggerRules.cpp:298
Rule * rule_
Definition: LoggerRules.h:139
virtual Str toString(void)
Serialize this Rule to a Str.
Definition: LoggerRules.cpp:184
virtual bool check(const LogEntry *entry)
Does this rule match this LogEntry.
Definition: LoggerRules.cpp:133
Contains the EventEntry class definition.
Syslog::Severity severity_
The LogEntry type we're looking for.
Definition: LoggerRules.h:214
Rule(void)
Protected constructor for pure virtual class.
Definition: LoggerRules.cpp:19