cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
[babeltrace.git] / src / cpp-common / bt2 / internal / utils.hpp
CommitLineData
dcfc2f5c
PP
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
8047a175
PP
10#include <type_traits>
11
12#include <babeltrace2/babeltrace.h>
13
9a8d4dcc 14#include "cpp-common/bt2/exc.hpp"
dcfc2f5c
PP
15
16namespace bt2 {
8047a175
PP
17
18template <typename>
19class CommonMapValue;
20
21template <typename>
22class CommonFieldClass;
23
24template <typename>
25class CommonPacket;
26
27template <typename>
28class CommonStream;
29
dcfc2f5c
PP
30namespace internal {
31
32template <typename LibObjPtrT>
33void validateCreatedObjPtr(const LibObjPtrT libOjbPtr)
34{
35 if (!libOjbPtr) {
39278ebc 36 throw MemoryError {};
dcfc2f5c
PP
37 }
38}
39
8047a175
PP
40template <typename LibObjT, typename DepObjT, typename ConstDepObjT>
41using DepType =
42 typename std::conditional<std::is_const<LibObjT>::value, ConstDepObjT, DepObjT>::type;
43
44template <typename LibObjT>
45using DepUserAttrs = DepType<LibObjT, CommonMapValue<bt_value>, CommonMapValue<const bt_value>>;
46
47template <typename LibObjT>
48using DepFc =
49 DepType<LibObjT, CommonFieldClass<bt_field_class>, CommonFieldClass<const bt_field_class>>;
50
51template <typename LibObjT>
52using DepPacket = DepType<LibObjT, CommonPacket<bt_packet>, CommonPacket<const bt_packet>>;
53
54template <typename LibObjT>
55using DepStream = DepType<LibObjT, CommonStream<bt_stream>, CommonStream<const bt_stream>>;
56
4927bae7
PP
57template <typename ObjT>
58struct TypeDescr;
59
b5f55e9f
PP
60} /* namespace internal */
61} /* namespace bt2 */
dcfc2f5c 62
b5f55e9f 63#endif /* BABELTRACE_CPP_COMMON_BT2_INTERNAL_UTILS_HPP */
This page took 0.042098 seconds and 4 git commands to generate.