00001 /* 00002 * StringQueueAppender.hh 00003 * 00004 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2000, Bastiaan Bakker. All rights reserved. 00006 * 00007 * See the COPYING file for the terms of usage and distribution. 00008 */ 00009 00010 #ifndef _LOG4CPP_STRINGQUEUEAPPENDER_HH 00011 #define _LOG4CPP_STRINGQUEUEAPPENDER_HH 00012 00013 #include <log4cpp/Portability.hh> 00014 #include <string> 00015 #include <queue> 00016 #include <log4cpp/LayoutAppender.hh> 00017 00018 LOG4CPP_NS_BEGIN 00019 00026 class LOG4CPP_EXPORT StringQueueAppender : public LayoutAppender { 00027 public: 00028 00029 StringQueueAppender(const std::string& name); 00030 virtual ~StringQueueAppender(); 00031 00032 virtual bool reopen(); 00033 virtual void close(); 00034 00040 virtual size_t queueSize() const; 00041 00046 virtual std::queue<std::string>& getQueue(); 00047 00052 virtual const std::queue<std::string>& getQueue() const; 00053 00058 virtual std::string popMessage(); 00059 00060 protected: 00061 00066 virtual void _append(const LoggingEvent& event); 00067 00068 std::queue<std::string> _queue; 00069 }; 00070 LOG4CPP_NS_END 00071 00072 00073 #endif // _LOG4CPP_STRINGQUEUEAPPENDER_HH