Kea 2.2.0
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
14namespace isc {
15namespace dns {
16namespace rdata {
17
18template <typename T>
19class RdataPimplHolder : boost::noncopyable {
20public:
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
44private:
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-lfc.