Force usage of assert() condition when NDEBUG is defined
[lttng-tools.git] / include / lttng / event-expr-internal.h
CommitLineData
48c47564
PP
1/*
2 * Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_EVENT_EXPR_INTERNAL_H
9#define LTTNG_EVENT_EXPR_INTERNAL_H
10
1aa9c49c 11#include <common/macros.h>
48c47564
PP
12#include <lttng/event-expr.h>
13
1aa9c49c 14struct lttng_bytecode;
6a751b95 15struct mi_writer;
1aa9c49c 16
48c47564
PP
17struct lttng_event_expr {
18 enum lttng_event_expr_type type;
19};
20
21/*
22 * `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD` and
23 * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`.
24 */
25struct lttng_event_expr_field {
26 struct lttng_event_expr parent;
27 char *name;
28};
29
30/* `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD` */
31struct lttng_event_expr_app_specific_context_field {
32 struct lttng_event_expr parent;
33 char *provider_name;
34 char *type_name;
35};
36
37/* `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT` */
38struct lttng_event_expr_array_field_element {
39 struct lttng_event_expr parent;
40
41 /* Owned by this */
42 struct lttng_event_expr *array_field_expr;
43
44 unsigned int index;
45};
46
47/*
48 * Returns whether or not `expr` is an l-value (locator value).
49 */
50static inline
51bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr)
52{
a0377dfe 53 LTTNG_ASSERT(expr);
48c47564
PP
54 return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD ||
55 expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD ||
56 expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD ||
57 expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT;
58}
59
1aa9c49c
JR
60LTTNG_HIDDEN
61int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
62 struct lttng_bytecode **bytecode_out);
63
6a751b95
JR
64LTTNG_HIDDEN
65enum lttng_error_code lttng_event_expr_mi_serialize(
66 const struct lttng_event_expr *expression,
67 struct mi_writer *writer);
68
48c47564 69#endif /* LTTNG_EVENT_EXPR_INTERNAL_H */
This page took 0.026369 seconds and 4 git commands to generate.