Kea  2.5.3
lease_mgr_factory.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2023 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 
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 
89  static void recreate(const std::string& dbaccess,
90  bool preserve_callbacks = true);
91 
99  static TrackingLeaseMgr& instance();
100 
104  static bool haveInstance();
105 
106 private:
112  static boost::scoped_ptr<TrackingLeaseMgr>& getLeaseMgrPtr();
113 
114 };
115 
116 } // end of isc::dhcp namespace
117 } // end of isc namespace
118 
119 #endif // LEASE_MGR_FACTORY_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Lease Manager Factory.
static void create(const std::string &dbaccess)
Create an instance of a lease manager.
static TrackingLeaseMgr & instance()
Return current lease manager.
static void destroy()
Destroy lease manager.
static bool haveInstance()
Indicates if the lease manager has been instantiated.
static void recreate(const std::string &dbaccess, bool preserve_callbacks=true)
Recreate an instance of a lease manager with optionally preserving registered callbacks.
No lease manager exception.
NoLeaseManager(const char *file, size_t line, const char *what)
Introduces callbacks into the LeaseMgr.
Defines the logger used by the top-level component of kea-lfc.