summaryrefslogtreecommitdiff
path: root/include/cull_list.h
blob: 8c38276429c15490be501f93093754528848acf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*       +------------------------------------+
 *       | Inspire Internet Relay Chat Daemon |
 *       +------------------------------------+
 *
 *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
 * See: http://wiki.inspircd.org/Credits
 *
 * This program is free but copyrighted software; see
 *            the file COPYING for details.
 *
 * ---------------------------------------------------
 */

#ifndef __CULLLIST_H__
#define __CULLLIST_H__

/**
 * The CullList class is used to delete objects at the end of the main loop to
 * avoid problems with references to deleted pointers if an object were deleted
 * during execution.
 */
class CoreExport CullList : public classbase
{
 private:
	std::vector<classbase*> list;

 public:
	CullList() {}

	/** Adds an item to the cull list
	 */
	void AddItem(classbase* item) { list.push_back(item); }

	/** Applies the cull list (deletes the contents)
	 */
	void Apply();
};

#endif