2017-07-14 13:12:32 +02:00
|
|
|
/* Node-type for loopback connections.
|
|
|
|
*
|
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
|
2017-07-14 13:12:32 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <jansson.h>
|
|
|
|
|
2018-02-06 21:26:12 +01:00
|
|
|
#include <villas/queue_signalled.h>
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
class LoopbackNode : public Node {
|
|
|
|
|
|
|
|
protected:
|
2023-09-07 11:46:39 +02:00
|
|
|
int queuelen;
|
|
|
|
struct CQueueSignalled queue;
|
|
|
|
enum QueueSignalledMode mode;
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int _write(struct Sample *smps[], unsigned cnt);
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int _read(struct Sample *smps[], unsigned cnt);
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
public:
|
2023-09-07 11:46:39 +02:00
|
|
|
LoopbackNode(const uuid_t &id = {}, const std::string &name = "");
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual ~LoopbackNode();
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int prepare();
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int stop();
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual std::vector<int> getPollFDs();
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual const std::string &getDetails();
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
virtual int parse(json_t *json);
|
2021-08-10 10:12:48 -04:00
|
|
|
};
|
2017-07-14 13:12:32 +02:00
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|