Kea  1.9.9-git
rdata_pimpl_holder.h
Go to the documentation of this file.
1 // Copyright (C) 2014-2015 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 DNS_RDATA_PIMPL_HOLDER_H
8 #define DNS_RDATA_PIMPL_HOLDER_H 1
9 
10 #include <boost/noncopyable.hpp>
11 
12 #include <cstddef> // for NULL
13 
14 namespace isc {
15 namespace dns {
16 namespace rdata {
17 
18 template <typename T>
19 class RdataPimplHolder : boost::noncopyable {
20 public:
21  RdataPimplHolder(T* obj = NULL) :
22  obj_(obj)
23  {}
24 
26  delete obj_;
27  }
28 
29  void reset(T* obj = NULL) {
30  delete obj_;
31  obj_ = obj;
32  }
33 
34  T* get() {
35  return (obj_);
36  }
37 
38  T* release() {
39  T* obj = obj_;
40  obj_ = NULL;
41  return (obj);
42  }
43 
44 private:
45  T* obj_;
46 };
47 
48 } // namespace rdata
49 } // namespace dns
50 } // namespace isc
51 
52 #endif // DNS_RDATA_PIMPL_HOLDER_H
Defines the logger used by the top-level component of kea-dhcp-ddns.