Kea 2.7.5
pointer_util.h
Go to the documentation of this file.
1// Copyright (C) 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 POINTER_UTIL_H
8#define POINTER_UTIL_H
9
10namespace isc {
11namespace util {
12
26template<typename T>
27inline bool equalValues(const T& ptr1, const T& ptr2) {
28 return (ptr1 && ptr2 && (*ptr1 == *ptr2));
29}
30
41template<typename T>
42inline bool nullOrEqualValues(const T& ptr1, const T& ptr2) {
43 return ((!ptr1 && !ptr2) || equalValues(ptr1, ptr2));
44}
45
46} // end of namespace isc::util
47} // end of namespace isc
48
49#endif
bool nullOrEqualValues(const T &ptr1, const T &ptr2)
This function checks if two pointers are both null or both are non-null and they point to equal value...
bool equalValues(const T &ptr1, const T &ptr2)
This function checks if two pointers are non-null and values are equal.
Defines the logger used by the top-level component of kea-lfc.