mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix cppcheck errors
This commit is contained in:
parent
31925ebc5a
commit
69e60b26c0
4 changed files with 23 additions and 15 deletions
|
@ -35,9 +35,9 @@ protected:
|
|||
uint64_t warningCounter;
|
||||
|
||||
public:
|
||||
Dumper(const std::string socketNameIn);
|
||||
Dumper(const std::string &socketNameIn);
|
||||
~Dumper();
|
||||
int openSocket(std::string socketNameIn);
|
||||
int openSocket();
|
||||
void closeSocket();
|
||||
void writeData(uint len, double *yData, double *xData = nullptr);
|
||||
};
|
||||
|
|
|
@ -30,23 +30,21 @@
|
|||
using namespace villas;
|
||||
using namespace villas::node;
|
||||
|
||||
Dumper::Dumper(const std::string socketNameIn) :
|
||||
socketName(""),
|
||||
Dumper::Dumper(const std::string &socketNameIn) :
|
||||
socketName(socketNameIn),
|
||||
supressRepeatedWarning(true),
|
||||
warningCounter(0)
|
||||
{
|
||||
openSocket(socketNameIn);
|
||||
openSocket();
|
||||
}
|
||||
|
||||
Dumper::~Dumper() {
|
||||
closeSocket();
|
||||
}
|
||||
|
||||
int Dumper::openSocket(std::string socketNameIn)
|
||||
int Dumper::openSocket()
|
||||
{
|
||||
socketName = socketNameIn;
|
||||
|
||||
socketFd = socket(AF_LOCAL,SOCK_STREAM, 0);
|
||||
socketFd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (socketFd < 0) {
|
||||
info("Error creating socket %s", socketName.c_str());
|
||||
return -1;
|
||||
|
@ -64,15 +62,14 @@ int Dumper::openSocket(std::string socketNameIn)
|
|||
|
||||
void Dumper::closeSocket()
|
||||
{
|
||||
info("Remove socket");
|
||||
close(socketFd);
|
||||
}
|
||||
|
||||
void Dumper::writeData(uint len, double *yData, double *xData)
|
||||
void Dumper::writeData(unsigned len, double *yData, double *xData)
|
||||
{
|
||||
ssize_t bytesWritten;
|
||||
|
||||
for (uint i = 0; i<len; i++) {
|
||||
for (unsigned i = 0; i<len; i++) {
|
||||
std::string str = std::to_string(yData[i]);
|
||||
if(xData != nullptr)
|
||||
str+= ";" + std::to_string(xData[i]);
|
||||
|
|
|
@ -60,8 +60,8 @@ protected:
|
|||
Dumper *phasorAmplitude;
|
||||
Dumper *phasorFreq;
|
||||
|
||||
WindowType windowType;
|
||||
PaddingType paddingType;
|
||||
enum WindowType windowType;
|
||||
enum PaddingType paddingType;
|
||||
|
||||
struct format_type *format;
|
||||
|
||||
|
@ -89,7 +89,7 @@ protected:
|
|||
std::complex<double> omega;
|
||||
|
||||
double windowCorretionFactor;
|
||||
timespec lastDftCal;
|
||||
struct timespec lastDftCal;
|
||||
|
||||
int *signalIndex; /**< A list of signalIndex to do dft on */
|
||||
unsigned signalCnt; /**< Number of signalIndex given by config file */
|
||||
|
@ -99,6 +99,12 @@ public:
|
|||
Hook(p, n, fl, prio, en),
|
||||
windowType(WindowType::NONE),
|
||||
paddingType(PaddingType::ZERO),
|
||||
smpMemory(nullptr),
|
||||
dftMatrix(nullptr),
|
||||
dftResults(nullptr),
|
||||
filterWindowCoefficents(nullptr),
|
||||
absDftResults(nullptr),
|
||||
absDftFreqs(nullptr),
|
||||
dftCalcCnt(0),
|
||||
sampleRate(0),
|
||||
startFreqency(0),
|
||||
|
@ -113,6 +119,7 @@ public:
|
|||
lastSequence(0),
|
||||
windowCorretionFactor(0),
|
||||
lastDftCal({0, 0}),
|
||||
signalIndex(nullptr),
|
||||
signalCnt(0)
|
||||
{
|
||||
format = format_type_lookup("villas.human");
|
||||
|
|
|
@ -67,8 +67,12 @@ public:
|
|||
isSynced(false),
|
||||
isLocked(false),
|
||||
timeErr(0.0),
|
||||
periodEst(0.0),
|
||||
periodErrComp(0.0),
|
||||
period(0.0),
|
||||
cntEdges(0),
|
||||
cntSmps(0),
|
||||
cntSmpsTotal(0),
|
||||
horizonComp(10),
|
||||
horizonEst(10),
|
||||
filtLen(horizonEst + 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue