~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/src/common/logger/LogHandlerList.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

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