common: compile libcompat as C++
[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
740da7d5
SM
14#ifdef __cplusplus
15extern "C" {
16#endif
17
1aa9c49c 18struct lttng_bytecode;
6a751b95 19struct mi_writer;
1aa9c49c 20
48c47564
PP
21struct lttng_event_expr {
22 enum lttng_event_expr_type type;
23};
24
25/*
26 * `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD` and
27 * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`.
28 */
29struct lttng_event_expr_field {
30 struct lttng_event_expr parent;
31 char *name;
32};
33
34/* `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD` */
35struct lttng_event_expr_app_specific_context_field {
36 struct lttng_event_expr parent;
37 char *provider_name;
38 char *type_name;
39};
40
41/* `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT` */
42struct lttng_event_expr_array_field_element {
43 struct lttng_event_expr parent;
44
45 /* Owned by this */
46 struct lttng_event_expr *array_field_expr;
47
48 unsigned int index;
49};
50
51/*
52 * Returns whether or not `expr` is an l-value (locator value).
53 */
54static inline
55bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr)
56{
a0377dfe 57 LTTNG_ASSERT(expr);
48c47564
PP
58 return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD ||
59 expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD ||
60 expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD ||
61 expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT;
62}
63
1aa9c49c
JR
64int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
65 struct lttng_bytecode **bytecode_out);
66
6a751b95
JR
67enum lttng_error_code lttng_event_expr_mi_serialize(
68 const struct lttng_event_expr *expression,
69 struct mi_writer *writer);
70
740da7d5
SM
71#ifdef __cplusplus
72}
73#endif
74
48c47564 75#endif /* LTTNG_EVENT_EXPR_INTERNAL_H */
This page took 0.026414 seconds and 4 git commands to generate.