Kea  1.5.0
lease_mgr_factory.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef LEASE_MGR_FACTORY_H
8 #define LEASE_MGR_FACTORY_H
9 
11 #include <dhcpsrv/lease_mgr.h>
12 #include <exceptions/exceptions.h>
13 
14 #include <boost/scoped_ptr.hpp>
15 
16 #include <string>
17 
18 namespace isc {
19 namespace dhcp {
20 
21 
26 class NoLeaseManager : public Exception {
27 public:
28  NoLeaseManager(const char* file, size_t line, const char* what) :
29  isc::Exception(file, line, what) {}
30 };
31 
45 public:
70  static void create(const std::string& dbaccess);
71 
77  static void destroy();
78 
86  static LeaseMgr& instance();
87 
91  static bool haveInstance();
92 
93 private:
99  static boost::scoped_ptr<LeaseMgr>& getLeaseMgrPtr();
100 
101 };
102 
103 }; // end of isc::dhcp namespace
104 }; // end of isc namespace
105 
106 #endif // LEASE_MGR_FACTORY_H
isc::dhcp::LeaseMgr
Abstract Lease Manager.
Definition: lease_mgr.h:222
isc::dhcp::LeaseMgrFactory
Lease Manager Factory.
Definition: lease_mgr_factory.h:44
lease_mgr.h
An abstract API for lease database.
isc::dhcp::LeaseMgrFactory::instance
static LeaseMgr & instance()
Return current lease manager.
Definition: lease_mgr_factory.cc:111
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition: exceptions/exceptions.h:23
isc::dhcp::LeaseMgrFactory::destroy
static void destroy()
Destroy lease manager.
Definition: lease_mgr_factory.cc:95
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition: exceptions/exceptions.cc:32
isc::dhcp::NoLeaseManager
No lease manager exception.
Definition: lease_mgr_factory.h:26
isc::dhcp::LeaseMgrFactory::haveInstance
static bool haveInstance()
Indicates if the lease manager has been instantiated.
Definition: lease_mgr_factory.cc:106
isc::dhcp::NoLeaseManager::NoLeaseManager
NoLeaseManager(const char *file, size_t line, const char *what)
Definition: lease_mgr_factory.h:28
database_connection.h
isc::dhcp::LeaseMgrFactory::create
static void create(const std::string &dbaccess)
Create an instance of a lease manager.
Definition: lease_mgr_factory.cc:45
exceptions.h