1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-23 00:00:01 +01:00
VILLASnode/lib/hooks/print.c

38 lines
778 B
C
Raw Normal View History

/** Print hook.
*
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*********************************************************************************/
/** @addtogroup hooks Hook functions
* @{
*/
#include "hook.h"
#include "plugin.h"
#include "sample.h"
static int hook_print(struct hook *h, int when, struct hook_info *j)
{
2017-03-17 01:08:48 -03:00
assert(j->samples);
2017-03-17 01:08:48 -03:00
for (int i = 0; i < j->count; i++)
sample_fprint(stdout, j->samples[i], SAMPLE_ALL);
2017-03-17 01:08:48 -03:00
return j->count;
}
static struct plugin p = {
.name = "print",
.description = "Print the message to stdout",
.type = PLUGIN_TYPE_HOOK,
.hook = {
.priority = 99,
.cb = hook_print,
2017-03-17 01:08:48 -03:00
.when = HOOK_READ
}
};
REGISTER_PLUGIN(&p)
/** @} */