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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
842 B
C++
Raw Permalink Normal View History

/* Dump hook.
2019-01-30 01:53:52 +01:00
*
* Author: Steffen Vogel <post@steffenvogel.de>
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-License-Identifier: Apache-2.0
*/
2019-01-30 01:53:52 +01:00
2019-03-26 15:33:47 +01:00
#include <villas/hook.hpp>
#include <villas/sample.hpp>
2019-01-30 01:53:52 +01:00
2019-03-26 15:33:47 +01:00
namespace villas {
namespace node {
class DumpHook : public Hook {
public:
using Hook::Hook;
2019-03-26 15:33:47 +01:00
virtual Hook::Reason process(struct Sample *smp) {
assert(state == State::STARTED);
2019-03-26 15:33:47 +01:00
sample_dump(logger, smp);
2019-03-26 15:33:47 +01:00
return Reason::OK;
}
2019-01-30 01:53:52 +01:00
};
// Register hook
static char n[] = "dump";
static char d[] = "Dump data to stdout";
static HookPlugin<DumpHook, n, d,
(int)Hook::Flags::NODE_READ | (int)Hook::Flags::NODE_WRITE |
(int)Hook::Flags::PATH,
1>
p;
} // namespace node
} // namespace villas