2023-09-04 12:21:37 +02:00
|
|
|
/* Node direction.
|
2021-08-10 10:12:48 -04:00
|
|
|
*
|
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
|
2021-08-10 10:12:48 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <jansson.h>
|
|
|
|
|
|
|
|
#include <villas/common.hpp>
|
2023-09-07 11:46:39 +02:00
|
|
|
#include <villas/hook_list.hpp>
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/list.hpp>
|
|
|
|
#include <villas/signal_list.hpp>
|
|
|
|
|
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
|
|
|
// Forward declarations
|
|
|
|
class Node;
|
|
|
|
class Path;
|
|
|
|
|
|
|
|
class NodeDirection {
|
2023-09-07 11:46:39 +02:00
|
|
|
friend Node;
|
2021-08-10 10:12:48 -04:00
|
|
|
|
|
|
|
public:
|
2023-09-07 11:46:39 +02:00
|
|
|
enum class Direction {
|
|
|
|
IN, // VILLASnode is receiving/reading
|
|
|
|
OUT // VILLASnode is sending/writing
|
|
|
|
} direction;
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
/* The path which uses this node as a source/destination.
|
2024-02-29 21:47:13 +01:00
|
|
|
*
|
|
|
|
* Usually every node should be used only by a single path as destination.
|
|
|
|
* Otherwise samples from different paths would be interleaved.
|
|
|
|
*/
|
2023-09-07 11:46:39 +02:00
|
|
|
Path *path;
|
|
|
|
Node *node;
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
int enabled;
|
|
|
|
int builtin; // This node should use built-in hooks by default.
|
|
|
|
unsigned
|
|
|
|
vectorize; // Number of messages to send / recv at once (scatter / gather)
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
HookList hooks; // List of read / write hooks (struct hook).
|
|
|
|
SignalList::Ptr signals; // Signal description.
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
json_t *config; // A JSON object containing the configuration of the node.
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
NodeDirection(enum NodeDirection::Direction dir, Node *n);
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
int parse(json_t *json);
|
|
|
|
void check();
|
|
|
|
int prepare();
|
|
|
|
int start();
|
|
|
|
int stop();
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
SignalList::Ptr getSignals(int after_hooks = true) const;
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
unsigned getSignalsMaxCount() const;
|
2021-08-10 10:12:48 -04:00
|
|
|
};
|
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|