Commit e1c4e78b authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'develop' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop

parents 31541601 86039424
This diff is collapsed.
......@@ -13,6 +13,7 @@ struct filter {
} v;
int (*eval)(struct filter *this, event e);
void (*free)(struct filter *this);
};
/****************************************************************************/
......@@ -52,7 +53,23 @@ int eval_evarg(struct filter *f, event e)
}
/****************************************************************************/
/* filter construction functions */
/* free memory functions */
/****************************************************************************/
void free_op2(struct filter *f)
{
free_filter(f->v.op2.a);
free_filter(f->v.op2.b);
free(f);
}
void free_noop(struct filter *f)
{
free(f);
}
/****************************************************************************/
/* filter construction/destruction functions */
/****************************************************************************/
filter *filter_and(filter *a, filter *b)
......@@ -60,6 +77,7 @@ filter *filter_and(filter *a, filter *b)
struct filter *ret = calloc(1, sizeof(struct filter));
if (ret == NULL) abort();
ret->eval = eval_and;
ret->free = free_op2;
ret->v.op2.a = a;
ret->v.op2.b = b;
return ret;
......@@ -70,6 +88,7 @@ filter *filter_eq(filter *a, filter *b)
struct filter *ret = calloc(1, sizeof(struct filter));
if (ret == NULL) abort();
ret->eval = eval_eq;
ret->free = free_op2;
ret->v.op2.a = a;
ret->v.op2.b = b;
return ret;
......@@ -80,6 +99,7 @@ filter *filter_int(int v)
struct filter *ret = calloc(1, sizeof(struct filter));
if (ret == NULL) abort();
ret->eval = eval_int;
ret->free = free_noop;
ret->v.v = v;
return ret;
}
......@@ -97,6 +117,7 @@ filter *filter_evarg(void *database, char *event_name, char *varname)
f = get_format(database, event_id);
ret->eval = eval_evarg;
ret->free = free_noop;
ret->v.evarg.event_type = event_id;
ret->v.evarg.arg_index = -1;
......@@ -114,6 +135,14 @@ filter *filter_evarg(void *database, char *event_name, char *varname)
return ret;
}
void free_filter(filter *_f)
{
struct filter *f;
if (_f == NULL) return;
f = _f;
f->free(f);
}
/****************************************************************************/
/* eval function */
/****************************************************************************/
......
......@@ -12,4 +12,6 @@ filter *filter_evarg(void *database, char *event_name, char *varname);
int filter_eval(filter *f, event e);
void free_filter(filter *f);
#endif /* _FILTER_H_ */
......@@ -39,6 +39,7 @@ widget *new_space(gui *gui, int width, int height);
widget *new_image(gui *gui, unsigned char *data, int length);
void label_set_clickable(gui *gui, widget *label, int clickable);
void label_set_text(gui *gui, widget *label, char *text);
void container_set_child_growable(gui *_gui, widget *_this,
widget *child, int growable);
......@@ -49,6 +50,7 @@ void xy_plot_set_range(gui *gui, widget *this,
void xy_plot_set_points(gui *gui, widget *this,
int plot, int npoints, float *x, float *y);
void xy_plot_get_dimensions(gui *gui, widget *this, int *width, int *height);
void xy_plot_set_title(gui *gui, widget *this, char *label);
void textlist_add(gui *gui, widget *this, const char *text, int position,
int color);
......
......@@ -141,7 +141,7 @@ struct button_widget {
struct label_widget {
struct widget common;
const char *t;
char *t;
int color;
int width; /* as given by the graphic's backend */
int height; /* as given by the graphic's backend */
......
......@@ -81,3 +81,21 @@ void label_set_clickable(gui *_g, widget *_this, int clickable)
gunlock(g);
}
void label_set_text(gui *_g, widget *_this, char *text)
{
struct gui *g = _g;
struct label_widget *this = _this;
glock(g);
free(this->t);
this->t = strdup(text); if (this->t == NULL) OOM;
x_text_get_dimensions(g->x, DEFAULT_FONT, text,
&this->width, &this->height, &this->baseline);
send_event(g, REPACK, this->common.id);
gunlock(g);
}
......@@ -290,3 +290,22 @@ void xy_plot_get_dimensions(gui *_gui, widget *_this, int *width, int *height)
gunlock(g);
}
void xy_plot_set_title(gui *_gui, widget *_this, char *label)
{
struct gui *g = _gui;
struct xy_plot_widget *this = _this;
glock(g);
free(this->label);
this->label = strdup(label); if (this->label == NULL) OOM;
/* TODO: be sure calling X there is valid wrt "global model" (we are
* not in the "gui thread") */
x_text_get_dimensions(g->x, DEFAULT_FONT, label,
&this->label_width, &this->label_height, &this->label_baseline);
send_event(g, REPACK, this->common.id);
gunlock(g);
}
#include "logger.h"
#include "logger_defs.h"
#include "filter/filter.h"
#include <stdlib.h>
void logger_add_view(logger *_l, view *v)
......@@ -13,5 +14,6 @@ void logger_add_view(logger *_l, view *v)
void logger_set_filter(logger *_l, void *filter)
{
struct logger *l = _l;
free_filter(l->filter);
l->filter = filter;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment