]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cull_list.cpp
Add explicit reference-counting base class
[user/henk/code/inspircd.git] / src / cull_list.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 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 #include "inspircd.h"
15 #include <typeinfo>
16
17 void CullList::Apply()
18 {
19         std::set<classbase*> gone;
20         for(unsigned int i=0; i < list.size(); i++)
21         {
22                 classbase* c = list[i];
23                 if (gone.insert(c).second)
24                 {
25                         ServerInstance->Logs->Log("CULLLIST", DEBUG, "Deleting %s @%p", typeid(*c).name(),
26                                 (void*)c);
27                         if (c->cull())
28                                 delete c;
29                 }
30                 else
31                 {
32                         ServerInstance->Logs->Log("CULLLIST",DEBUG, "WARNING: Object @%p culled twice!",
33                                 (void*)c);
34                 }
35         }
36 }
37