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

77 lines
1.3 KiB
C++
Raw Normal View History

2019-06-05 18:59:45 +02:00
/** Node-type for exec 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
2019-06-05 18:59:45 +02:00
*********************************************************************************/
#pragma once
#include <villas/node.hpp>
2019-06-05 18:59:45 +02:00
#include <villas/popen.hpp>
2021-05-10 00:12:30 +02:00
#include <villas/format.hpp>
2019-06-05 18:59:45 +02:00
namespace villas {
namespace node {
2019-06-05 18:59:45 +02:00
/* Forward declarations */
struct Sample;
class ExecNode : public Node {
2019-06-05 18:59:45 +02:00
protected:
2019-06-05 18:59:45 +02:00
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;
2019-06-05 18:59:45 +02:00
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