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

39 lines
No EOL
784 B
C

/** 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)
{
assert(j->smps);
for (int i = 0; i < j->cnt; i++)
sample_fprint(stdout, j->smps[i], SAMPLE_ALL);
return j->cnt;
}
static struct plugin p = {
.name = "print",
.description = "Print the message to stdout",
.type = PLUGIN_TYPE_HOOK,
.hook = {
.priority = 99,
.history = 0,
.cb = hook_print,
.type = HOOK_READ
}
};
REGISTER_PLUGIN(&p)
/** @} */