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/exec.hpp

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

63 lines
1.3 KiB
C++
Raw Permalink Normal View History

/* Node-type for exec node-types.
2019-06-05 18:59:45 +02: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-06-05 18:59:45 +02:00
#pragma once
#include <villas/format.hpp>
#include <villas/node.hpp>
2019-06-05 18:59:45 +02:00
#include <villas/popen.hpp>
namespace villas {
namespace node {
// Forward declarations
struct Sample;
class ExecNode : public Node {
2019-06-05 18:59:45 +02:00
protected:
std::unique_ptr<villas::utils::Popen> proc;
std::unique_ptr<Format> formatter;
FILE *stream_in, *stream_out;
2019-06-05 18:59:45 +02:00
bool flush;
bool shell;
std::string working_dir;
std::string command;
villas::utils::Popen::arg_list arguments;
villas::utils::Popen::env_map environment;
2021-05-10 00:12:30 +02:00
virtual int _read(struct Sample *smps[], unsigned cnt);
virtual int _write(struct Sample *smps[], unsigned cnt);
public:
ExecNode(const uuid_t &id = {}, const std::string &name = "")
: Node(id, name), stream_in(nullptr), stream_out(nullptr), flush(true),
shell(false) {}
2019-06-05 18:59:45 +02:00
virtual ~ExecNode();
2019-06-05 18:59:45 +02:00
virtual const std::string &getDetails();
2019-06-05 18:59:45 +02:00
virtual int start();
2019-06-05 18:59:45 +02:00
virtual int stop();
2019-06-05 18:59:45 +02:00
virtual int prepare();
2019-06-05 18:59:45 +02:00
virtual int parse(json_t *json);
virtual std::vector<int> getPollFDs();
};
2019-06-05 18:59:45 +02:00
} // namespace node
} // namespace villas