Kea: pointer_util.h Source File

| Kea 3.0.2-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
10namespace isc {
11namespace util {
12
26template<typename T>
27 inline bool equalValues(const T& ptr1, const T& ptr2) {
28 return (ptr1 && ptr2 && (*ptr1 == *ptr2));
29}
30
41template<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
isc::util
Definition time_utils.cc:43
isc::util::nullOrEqualValues
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
isc::util::equalValues
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
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148