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

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

79 lines
1.6 KiB
C++
Raw Permalink 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.
*
2022-03-15 09:18:01 -04:00
* Author: Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
2022-07-04 18:20:03 +02:00
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
2022-04-01 14:55:08 +02:00
#include <villas/node.hpp>
#include <villas/node/config.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
// Settings
int setting1;
2022-04-01 14:55:08 +02:00
std::string setting2;
2022-04-01 14:55:08 +02:00
// States
int state1;
struct timespec start_time;
virtual int _read(struct Sample *smps[], unsigned cnt);
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 = "");
/* All of the following virtual-declared functions are optional.
* Have a look at node.hpp/node.cpp for the default behaviour.
*/
virtual ~ExampleNode();
virtual int prepare();
virtual int parse(json_t *json);
virtual int check();
virtual int start();
// virtual int stop();
// virtual int pause();
2020-01-21 14:26:56 +01:00
// virtual int resume();
2020-01-21 14:26:56 +01:00
// virtual int restart();
// virtual int reverse();
// virtual std::vector<int> getPollFDs();
// virtual std::vector<int> getNetemFDs();
2022-04-01 14:55:08 +02:00
// virtual struct villas::node::memory::Type *getMemoryType();
2022-04-01 14:55:08 +02:00
virtual const std::string &getDetails();
2022-04-01 14:55:08 +02:00
};
} // namespace node
} // namespace villas