1 /* 2 Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License, version 2.0, 6 as published by the Free Software Foundation. 7 8 This program is also distributed with certain software (including 9 but not limited to OpenSSL) that is licensed under separate terms, 10 as designated in a particular file or component or in included license 11 documentation. The authors of MySQL hereby grant you an additional 12 permission to link the program and your derivative works with the 13 separately licensed software that they have included with MySQL. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License, version 2.0, for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 #ifndef LOGHANDLERLIST_H 26 #define LOGHANDLERLIST_H 27 28 class LogHandler; 29 #include <ndb_global.h> 30 31 /** 32 * Provides a simple linked list of log handlers. 33 * 34 * @see LogHandler 35 * @version #@ $Id: LogHandlerList.hpp,v 1.2 2002/03/14 13:07:21 eyualex Exp $ 36 */ 37 class LogHandlerList 38 { 39 public: 40 /** 41 * Default Constructor. 42 */ 43 LogHandlerList(); 44 45 /** 46 * Destructor. 47 */ 48 ~LogHandlerList(); 49 50 /** 51 * Adds a new log handler. 52 * 53 * @param pNewHandler log handler. 54 */ 55 bool add(LogHandler* pNewHandler); 56 57 /** 58 * Removes a log handler from the list and call its destructor. 59 * 60 * @param pRemoveHandler the handler to remove 61 */ 62 bool remove(LogHandler* pRemoveHandler); 63 64 /** 65 * Removes all log handlers. 66 */ 67 void removeAll(); 68 69 /** 70 * Returns the next log handler in the list. 71 * returns a log handler or NULL. 72 */ 73 LogHandler* next(); 74 75 /** 76 * Returns the size of the list. 77 */ 78 int size() const; 79 private: 80 /** List node */ 81 struct LogHandlerNode 82 { 83 LogHandlerNode* pPrev; 84 LogHandlerNode* pNext; 85 LogHandler* pHandler; 86 }; 87 88 LogHandlerNode* next(LogHandlerNode* pNode); 89 LogHandlerNode* prev(LogHandlerNode* pNode); 90 91 void removeNode(LogHandlerNode* pNode); 92 93 int m_size; 94 95 LogHandlerNode* m_pHeadNode; 96 LogHandlerNode* m_pTailNode; 97 LogHandlerNode* m_pCurrNode; 98 }; 99 100 #endif 101 102 103