2007-07-16 17:30:04 +00:00
|
|
|
/* +------------------------------------+
|
|
|
|
* | Inspire Internet Relay Chat Daemon |
|
|
|
|
* +------------------------------------+
|
|
|
|
*
|
2009-01-02 18:16:05 +00:00
|
|
|
* InspIRCd: (C) 2002-2009 InspIRCd Development Team
|
2009-03-15 12:42:35 +00:00
|
|
|
* See: http://wiki.inspircd.org/Credits
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
|
|
|
* This program is free but copyrighted software; see
|
|
|
|
* the file COPYING for details.
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CULLLIST_H__
|
|
|
|
#define __CULLLIST_H__
|
|
|
|
|
2009-09-02 00:50:12 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
2009-09-21 13:26:31 +00:00
|
|
|
class CoreExport CullList
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
2009-09-21 13:26:31 +00:00
|
|
|
std::set<classbase*> list;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
public:
|
2009-09-02 00:50:12 +00:00
|
|
|
/** Adds an item to the cull list
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
2009-09-21 13:26:31 +00:00
|
|
|
void AddItem(classbase* item) { list.insert(item); }
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2009-09-02 00:50:12 +00:00
|
|
|
/** Applies the cull list (deletes the contents)
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
2009-04-17 21:47:30 +00:00
|
|
|
void Apply();
|
2007-07-16 17:30:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|