LRAUV  revA
LogQueue.h
Go to the documentation of this file.
1 
10 #ifndef LOGQUEUE_H_
11 #define LOGQUEUE_H_
12 
13 #include "LogEntry.h"
14 #include "utils/Mutex.h"
15 #include "utils/RingBuffer.h"
16 
19 
24 class LogQueue
25 {
26 public:
27 
29  static LogQueue &Instance();
30 
32  ~LogQueue();
33 
35  LogEntry* push( LogEntry *entry );
36 
38  LogEntry* peek( void );
39 
41  LogEntry* pop( void );
42 
44  bool isEmpty( void );
45 
46  // Constructor (normally protected but there are cases where you make a
47  // supplemental LogQueue rather than the singleton)
48  LogQueue();
49 
50 protected:
51 
52  static void FlushQueues( bool andDelete = true );
53 
54 private:
57 
60 
62  //void clear( QueueSelect queueSelect, bool andDelete = false );
63  void clear( bool andDelete = false );
64 
67  {
68  public:
70  };
71 
74 
75 };
76 
77 #endif /*LOGQUEUE_H_*/
78 
79 
80 
~StaticDestructor()
static Destructor
Definition: LogQueue.cpp:28
Contains the RingBufferVoid and RingBuffer class declarations.
static LogQueue & Instance()
Function for accessing singleton.
Definition: LogQueue.cpp:17
static LogQueue::StaticDestructor StaticDestructor_
Static instance of StaticDestructor.
Definition: LogQueue.h:73
LogEntry * peek(void)
Examine queue, but do not pop element.
Definition: LogQueue.cpp:83
LogEntry * push(LogEntry *entry)
Push onto write queue.
Definition: LogQueue.cpp:61
One "entry" in a LogQueue.
Definition: LogEntry.h:33
static LogQueue * Instance_
Static instance of the singleton.
Definition: LogQueue.h:56
static void FlushQueues(bool andDelete=true)
Swap the two queues.
Definition: LogQueue.cpp:167
Contains the LogEntry class definition.
LogEntry * pop(void)
Pop out of read queue.
Definition: LogQueue.cpp:89
bool isEmpty(void)
Is read queue empty?
Definition: LogQueue.cpp:131
Contains the Mutex, ThreadCondition, and MutexLocker class declarations.
Makes sure that static objects are deleted on shutdown.
Definition: LogQueue.h:66
void clear(bool andDelete=false)
Clear either queue.
Definition: LogQueue.cpp:111
~LogQueue()
Destructor.
Definition: LogQueue.cpp:48
RingBuffer< LogEntry * > LogEntryQueue
Typedef for a queue of log entries.
Definition: LogQueue.h:18
LogQueue()
Definition: LogQueue.cpp:40
Singleton wrapper for queue.
Definition: LogQueue.h:24
LogEntryQueue queue_
The actual queues for LogEntry.
Definition: LogQueue.h:59