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/include/villas/nodes/example.hpp

98 lines
1.7 KiB
C++
Raw Normal View History

/** An example get started with new implementations of new node-types
2022-04-01 14:55:08 +02:00
*
* This example does not do any particulary useful.
* It is just a skeleton to get you started with new node-types.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
2022-07-04 18:20:03 +02:00
* @license Apache 2.0
*********************************************************************************/
#pragma once
#include <villas/node/config.hpp>
2022-04-01 14:55:08 +02:00
#include <villas/node.hpp>
#include <villas/timing.hpp>
namespace villas {
namespace node {
2021-06-21 16:11:42 -04:00
/* Forward declarations */
2022-04-01 14:55:08 +02:00
struct Sample;
2021-06-21 16:11:42 -04:00
2022-04-01 14:55:08 +02:00
class ExampleNode : public Node {
2022-04-01 14:55:08 +02:00
protected:
/* Place any configuration and per-node state here */
2022-04-01 14:55:08 +02:00
/* Settings */
int setting1;
std::string setting2;
/* States */
int state1;
struct timespec start_time;
2022-04-01 14:55:08 +02:00
virtual
int _read(struct Sample *smps[], unsigned cnt);
2022-04-01 14:55:08 +02:00
virtual
int _write(struct Sample *smps[], unsigned cnt);
2022-04-01 14:55:08 +02:00
public:
ExampleNode(const uuid_t &id = {}, const std::string &name = "");
2022-04-01 14:55:08 +02:00
/* All of the following virtual-declared functions are optional.
* Have a look at node.hpp/node.cpp for the default behaviour.
*/
2022-04-01 14:55:08 +02:00
virtual
~ExampleNode();
2022-04-01 14:55:08 +02:00
virtual
int prepare();
2022-04-01 14:55:08 +02:00
virtual
int parse(json_t *json);
2022-04-01 14:55:08 +02:00
/** Validate node configuration. */
virtual
int check();
2022-04-01 14:55:08 +02:00
virtual
int start();
2022-04-01 14:55:08 +02:00
// virtual
// int stop();
2022-04-01 14:55:08 +02:00
// virtual
// int pause();
2020-01-21 14:26:56 +01:00
2022-04-01 14:55:08 +02:00
// virtual
// int resume();
2020-01-21 14:26:56 +01:00
2022-04-01 14:55:08 +02:00
// virtual
// int restart();
2022-04-01 14:55:08 +02:00
// virtual
// int reverse();
2022-04-01 14:55:08 +02:00
// virtual
// std::vector<int> getPollFDs();
2022-04-01 14:55:08 +02:00
// virtual
// std::vector<int> getNetemFDs();
// virtual
// struct villas::node::memory::Type * getMemoryType();
virtual
const std::string & getDetails();
};
} // namespace node
} // namespace villas