Add `src/cpp-common/bt2/internal/utils.hpp` (validateCreatedObjPtr())
[babeltrace.git] / src / cpp-common / bt2 / internal / utils.hpp
1 /*
2 * Copyright 2019-2020 (c) Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef BABELTRACE_CPP_COMMON_BT2_INTERNAL_UTILS_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_INTERNAL_UTILS_HPP
9
10 #include <type_traits>
11
12 #include "../lib-error.hpp"
13
14 namespace bt2 {
15 namespace internal {
16
17 template <typename LibObjPtrT>
18 void validateCreatedObjPtr(const LibObjPtrT libOjbPtr)
19 {
20 if (!libOjbPtr) {
21 throw LibMemoryError {};
22 }
23 }
24
25 } // namespace internal
26 } // namespace bt2
27
28 #endif // BABELTRACE_CPP_COMMON_BT2_INTERNAL_UTILS_HPP
This page took 0.03003 seconds and 4 git commands to generate.