mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-20 18:45:27 +01:00
clang format
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "sls/DataSocket.h"
|
||||
#include "sls/logger.h"
|
||||
#include "sls/sls_detector_funcs.h"
|
||||
#include "sls/sls_detector_exceptions.h"
|
||||
#include "sls/sls_detector_funcs.h"
|
||||
#include <algorithm>
|
||||
#include <arpa/inet.h>
|
||||
#include <cassert>
|
||||
@@ -44,9 +44,7 @@ DataSocket &DataSocket::operator=(DataSocket &&move) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void DataSocket::setFnum(const int fnum) {
|
||||
fnum_ = fnum;
|
||||
}
|
||||
void DataSocket::setFnum(const int fnum) { fnum_ = fnum; }
|
||||
|
||||
int DataSocket::Receive(void *buffer, size_t size) {
|
||||
// TODO!(Erik) Add sleep? how many reties?
|
||||
@@ -65,7 +63,8 @@ int DataSocket::Receive(void *buffer, size_t size) {
|
||||
} else {
|
||||
std::ostringstream ss;
|
||||
ss << "TCP socket read " << bytes_read << " bytes instead of "
|
||||
<< bytes_expected << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||
<< bytes_expected << " bytes ("
|
||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||
throw sls::SocketError(ss.str());
|
||||
}
|
||||
}
|
||||
@@ -90,7 +89,8 @@ int DataSocket::Send(const void *buffer, size_t size) {
|
||||
if (bytes_sent != data_size) {
|
||||
std::ostringstream ss;
|
||||
ss << "TCP socket sent " << bytes_sent << " bytes instead of "
|
||||
<< data_size << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||
<< data_size << " bytes ("
|
||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||
throw sls::SocketError(ss.str());
|
||||
}
|
||||
return bytes_sent;
|
||||
|
||||
@@ -252,7 +252,7 @@ std::string ToString(const defs::speedLevel s) {
|
||||
case defs::G2_108MHZ:
|
||||
return std::string("108");
|
||||
case defs::G2_144MHZ:
|
||||
return std::string("144");
|
||||
return std::string("144");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
|
||||
6
slsSupportLib/src/string_utils.cpp
Executable file → Normal file
6
slsSupportLib/src/string_utils.cpp
Executable file → Normal file
@@ -38,14 +38,14 @@ bool is_int(const std::string &s) {
|
||||
}) == s.end();
|
||||
}
|
||||
|
||||
bool replace_first(std::string *s, const std::string& substr, const std::string& repl){
|
||||
bool replace_first(std::string *s, const std::string &substr,
|
||||
const std::string &repl) {
|
||||
auto pos = s->find(substr);
|
||||
if (pos != std::string::npos){
|
||||
if (pos != std::string::npos) {
|
||||
s->replace(pos, substr.size(), repl);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}; // namespace sls
|
||||
Reference in New Issue
Block a user