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

44 lines
943 B
C++
Raw Permalink Normal View History

/** Dump fields and values in a socket to plot them with villasDump.py.
*
* @file
* @author Manuel Pitz <manuel.pitz@eonerc.rwth-aachen.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
*********************************************************************************/
2021-02-16 14:41:55 +01:00
#pragma once
2021-02-16 14:15:14 +01:00
#include <villas/log.hpp>
#include <string>
namespace villas {
namespace node {
class Dumper {
2020-11-03 18:56:07 +01:00
protected:
bool active;
2020-11-03 18:56:07 +01:00
int socketFd;
std::string socketPath;
2020-11-03 18:56:07 +01:00
bool supressRepeatedWarning;
uint64_t warningCounter;
2021-02-16 14:15:14 +01:00
Logger logger;
2020-11-03 18:56:07 +01:00
public:
Dumper();
2020-11-03 18:56:07 +01:00
~Dumper();
2021-02-16 14:41:55 +01:00
2021-02-16 13:25:37 +01:00
int openSocket();
2021-02-16 14:41:55 +01:00
int closeSocket();
bool isActive();
int setActive();
2021-02-16 14:41:55 +01:00
int setPath(const std::string &socketPathIn);
void writeDataCSV(unsigned len, double *yData, double *xData = nullptr);
void writeDataBinary(unsigned len, double *yData, double *xData = nullptr);
2020-11-03 18:56:07 +01:00
};
2020-10-14 11:37:37 +02:00
} /* namespace node */
2020-11-03 18:56:07 +01:00
} /* namespace villas */