Anope IRC Services  Version 2.0
base.cpp
Go to the documentation of this file.
1 /*
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  */
9 
10 #include "services.h"
11 #include "anope.h"
12 #include "service.h"
13 
14 std::map<Anope::string, std::map<Anope::string, Service *> > Service::Services;
15 std::map<Anope::string, std::map<Anope::string, Anope::string> > Service::Aliases;
16 
17 Base::Base() : references(NULL)
18 {
19 }
20 
22 {
23  if (this->references != NULL)
24  {
25  for (std::set<ReferenceBase *>::iterator it = this->references->begin(), it_end = this->references->end(); it != it_end; ++it)
26  (*it)->Invalidate();
27  delete this->references;
28  }
29 }
30 
32 {
33  if (this->references == NULL)
34  this->references = new std::set<ReferenceBase *>();
35  this->references->insert(r);
36 }
37 
39 {
40  if (this->references != NULL)
41  {
42  this->references->erase(r);
43  if (this->references->empty())
44  {
45  delete this->references;
46  this->references = NULL;
47  }
48  }
49 }
50 
static std::map< Anope::string, std::map< Anope::string, Service * > > Services
Definition: service.h:27
std::set< ReferenceBase * > * references
Definition: base.h:20
Base()
Definition: base.cpp:17
virtual ~Base()
Definition: base.cpp:21
static std::map< Anope::string, std::map< Anope::string, Anope::string > > Aliases
Definition: service.h:28
void DelReference(ReferenceBase *r)
Definition: base.cpp:38
void AddReference(ReferenceBase *r)
Definition: base.cpp:31