Kea  2.3.4-git
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 
10 namespace isc {
11 namespace util {
12 
26 template<typename T>
27 inline bool equalValues(const T& ptr1, const T& ptr2) {
28  return (ptr1 && ptr2 && (*ptr1 == *ptr2));
29 }
30 
41 template<typename T>
42 inline 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 equalValues(const T &ptr1, const T &ptr2)
This function checks if two pointers are non-null and values are equal.
Definition: pointer_util.h:27
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...
Definition: pointer_util.h:42
Defines the logger used by the top-level component of kea-lfc.