]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/cull_list.h
Merge pull request #70 from Shawn-Smith/insp20+chancreatefix
[user/henk/code/inspircd.git] / include / cull_list.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef CULL_LIST_H
15 #define CULL_LIST_H
16
17 /**
18  * The CullList class is used to delete objects at the end of the main loop to
19  * avoid problems with references to deleted pointers if an object were deleted
20  * during execution.
21  */
22 class CoreExport CullList
23 {
24         std::vector<classbase*> list;
25         std::vector<LocalUser*> SQlist;
26
27  public:
28         /** Adds an item to the cull list
29          */
30         void AddItem(classbase* item) { list.push_back(item); }
31         void AddSQItem(LocalUser* item) { SQlist.push_back(item); }
32
33         /** Applies the cull list (deletes the contents)
34          */
35         void Apply();
36 };
37
38 class CoreExport ActionList
39 {
40         std::vector<HandlerBase0<void>*> list;
41
42  public:
43         /** Adds an item to the list
44          */
45         void AddAction(HandlerBase0<void>* item) { list.push_back(item); }
46
47         /** Runs the items
48          */
49         void Run();
50
51 };
52
53 #endif
54