mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 00:50:42 +02:00
format + exception.cpp
This commit is contained in:
parent
f0f97f265a
commit
3962714b48
@ -1282,7 +1282,8 @@ int Module::getADC(dacIndex index) {
|
||||
slsDetectorDefs::externalSignalFlag
|
||||
Module::setExternalSignalFlags(externalSignalFlag pol) {
|
||||
LOG(logDEBUG1) << "Setting signal flag to " << pol;
|
||||
return sendToDetector<slsDetectorDefs::externalSignalFlag>(F_SET_EXTERNAL_SIGNAL_FLAG, pol);
|
||||
return sendToDetector<slsDetectorDefs::externalSignalFlag>(
|
||||
F_SET_EXTERNAL_SIGNAL_FLAG, pol);
|
||||
}
|
||||
|
||||
void Module::setParallelMode(const bool enable) {
|
||||
@ -1835,7 +1836,8 @@ std::string Module::getAdditionalJsonParameter(const std::string &key) {
|
||||
}
|
||||
|
||||
int64_t Module::setReceiverUDPSocketBufferSize(int64_t udpsockbufsize) {
|
||||
return sendToReceiver<int64_t>(F_RECEIVER_UDP_SOCK_BUF_SIZE, udpsockbufsize);
|
||||
return sendToReceiver<int64_t>(F_RECEIVER_UDP_SOCK_BUF_SIZE,
|
||||
udpsockbufsize);
|
||||
}
|
||||
|
||||
int64_t Module::getReceiverUDPSocketBufferSize() {
|
||||
@ -2216,7 +2218,8 @@ bool Module::getDeactivatedRxrPaddingMode() {
|
||||
}
|
||||
|
||||
void Module::setDeactivatedRxrPaddingMode(bool padding) {
|
||||
sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING, static_cast<int>(padding), nullptr);
|
||||
sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING,
|
||||
static_cast<int>(padding), nullptr);
|
||||
}
|
||||
|
||||
bool Module::getFlippedDataX() {
|
||||
@ -2656,7 +2659,7 @@ int64_t Module::getFramesCaughtByReceiver() const {
|
||||
}
|
||||
|
||||
std::vector<uint64_t> Module::getNumMissingPackets() const {
|
||||
//TODO!(Erik) Refactor
|
||||
// TODO!(Erik) Refactor
|
||||
LOG(logDEBUG1) << "Getting num missing packets";
|
||||
if (shm()->useReceiverFlag) {
|
||||
int fnum = F_GET_NUM_MISSING_PACKETS;
|
||||
@ -2701,7 +2704,8 @@ bool Module::getFileWrite() {
|
||||
}
|
||||
|
||||
void Module::setMasterFileWrite(bool value) {
|
||||
sendToReceiver(F_SET_RECEIVER_MASTER_FILE_WRITE, static_cast<int>(value), nullptr);
|
||||
sendToReceiver(F_SET_RECEIVER_MASTER_FILE_WRITE, static_cast<int>(value),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
bool Module::getMasterFileWrite() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "catch.hpp"
|
||||
|
||||
using dt = slsDetectorDefs::detectorType;
|
||||
TEST_CASE("Construction with a defined detector type") {
|
||||
TEST_CASE("Construction with a defined detector type") {
|
||||
sls::Module m(dt::EIGER);
|
||||
REQUIRE(m.getDetectorType() == dt::EIGER);
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
* binary */
|
||||
#include "Receiver.h"
|
||||
#include "container_utils.h"
|
||||
#include "logger.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <csignal> //SIGINT
|
||||
|
@ -9,13 +9,13 @@ set(SOURCES
|
||||
src/network_utils.cpp
|
||||
src/ZmqSocket.cpp
|
||||
src/UdpRxSocket.cpp
|
||||
src/sls_detector_exceptions.cpp
|
||||
)
|
||||
|
||||
set(HEADERS
|
||||
)
|
||||
|
||||
set(PUBLICHEADERS
|
||||
include/ansi.h
|
||||
include/sls_detector_defs.h
|
||||
include/sls_detector_funcs.h
|
||||
include/versionAPI.h
|
||||
@ -23,7 +23,6 @@ set(PUBLICHEADERS
|
||||
include/file_utils.h
|
||||
include/container_utils.h
|
||||
include/string_utils.h
|
||||
include/logger.h
|
||||
include/ClientSocket.h
|
||||
include/DataSocket.h
|
||||
include/ServerSocket.h
|
||||
|
@ -7,12 +7,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FixedCapacityContainer.h"
|
||||
#include "TimeHelper.h"
|
||||
#include "TypeTraits.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "string_utils.h"
|
||||
#include "FixedCapacityContainer.h"
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
@ -40,8 +40,9 @@ std::string ToString(const defs::timingSourceType s);
|
||||
std::string ToString(const slsDetectorDefs::ROI &roi);
|
||||
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi);
|
||||
|
||||
template<typename T, size_t Capacity>
|
||||
std::ostream &operator<<(std::ostream &os, const sls::FixedCapacityContainer<T, Capacity>& c){
|
||||
template <typename T, size_t Capacity>
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const sls::FixedCapacityContainer<T, Capacity> &c) {
|
||||
return os << ToString(c);
|
||||
}
|
||||
|
||||
|
@ -1,55 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include "logger.h"
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace sls {
|
||||
|
||||
struct RuntimeError : public std::runtime_error {
|
||||
public:
|
||||
RuntimeError() : runtime_error("SLS Detector Package Failed") {
|
||||
LOG(logERROR) << "SLS Detector Package Failed";
|
||||
}
|
||||
RuntimeError(const std::string &msg) : runtime_error(msg) {
|
||||
LOG(logERROR) << msg;
|
||||
}
|
||||
RuntimeError(const char *msg) : runtime_error(msg) { LOG(logERROR) << msg; }
|
||||
RuntimeError();
|
||||
RuntimeError(const std::string &msg);
|
||||
RuntimeError(const char *msg);
|
||||
};
|
||||
|
||||
struct SharedMemoryError : public RuntimeError {
|
||||
public:
|
||||
SharedMemoryError(const std::string &msg) : RuntimeError(msg) {}
|
||||
SharedMemoryError(const std::string &msg);
|
||||
};
|
||||
|
||||
struct SocketError : public RuntimeError {
|
||||
public:
|
||||
SocketError(const std::string &msg) : RuntimeError(msg) {}
|
||||
SocketError(const std::string &msg);
|
||||
};
|
||||
|
||||
struct ZmqSocketError : public RuntimeError {
|
||||
public:
|
||||
ZmqSocketError(const std::string &msg) : RuntimeError(msg) {}
|
||||
ZmqSocketError(const std::string &msg);
|
||||
};
|
||||
|
||||
struct NotImplementedError : public RuntimeError {
|
||||
public:
|
||||
NotImplementedError(const std::string &msg) : RuntimeError(msg) {}
|
||||
NotImplementedError(const std::string &msg);
|
||||
};
|
||||
|
||||
struct DetectorError : public RuntimeError {
|
||||
public:
|
||||
DetectorError(const std::string &msg) : RuntimeError(msg) {}
|
||||
DetectorError(const std::string &msg);
|
||||
};
|
||||
|
||||
struct ReceiverError : public RuntimeError {
|
||||
public:
|
||||
ReceiverError(const std::string &msg) : RuntimeError(msg) {}
|
||||
ReceiverError(const std::string &msg);
|
||||
};
|
||||
|
||||
struct GuiError : public RuntimeError {
|
||||
public:
|
||||
GuiError(const std::string &msg) : RuntimeError(msg) {}
|
||||
GuiError(const std::string &msg);
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
|
@ -10,4 +10,4 @@
|
||||
#define APIJUNGFRAU 0x200508
|
||||
#define APIMYTHEN3 0x200508
|
||||
#define APIMOENCH 0x200508
|
||||
#define APIEIGER 0x200513
|
||||
#define APIEIGER 0x200513
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "ServerInterface.h"
|
||||
#include "logger.h"
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
namespace sls {
|
||||
|
||||
std::string ToString(const slsDetectorDefs::ROI& roi){
|
||||
std::string ToString(const slsDetectorDefs::ROI &roi) {
|
||||
std::ostringstream oss;
|
||||
oss << '[' << roi.xmin << ", " << roi.xmax << ']';
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::ostream&operator<<(std::ostream &os, const slsDetectorDefs::ROI& roi){
|
||||
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi) {
|
||||
return os << ToString(roi);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "UdpRxSocket.h"
|
||||
#include "logger.h"
|
||||
#include "network_utils.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include <cstdint>
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "ZmqSocket.h"
|
||||
#include "logger.h"
|
||||
#include <arpa/inet.h> //inet_ntoa
|
||||
#include <errno.h>
|
||||
#include <iostream>
|
||||
|
23
slsSupportLib/src/sls_detector_exceptions.cpp
Normal file
23
slsSupportLib/src/sls_detector_exceptions.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "logger.h"
|
||||
namespace sls {
|
||||
RuntimeError::RuntimeError() : runtime_error("SLS Detector Package Failed") {
|
||||
LOG(logERROR) << "SLS Detector Package Failed";
|
||||
}
|
||||
RuntimeError::RuntimeError(const std::string &msg) : runtime_error(msg) {
|
||||
LOG(logERROR) << msg;
|
||||
}
|
||||
RuntimeError::RuntimeError(const char *msg) : runtime_error(msg) {
|
||||
LOG(logERROR) << msg;
|
||||
}
|
||||
SharedMemoryError::SharedMemoryError(const std::string &msg)
|
||||
: RuntimeError(msg) {}
|
||||
SocketError::SocketError(const std::string &msg) : RuntimeError(msg) {}
|
||||
ZmqSocketError::ZmqSocketError(const std::string &msg) : RuntimeError(msg) {}
|
||||
NotImplementedError::NotImplementedError(const std::string &msg)
|
||||
: RuntimeError(msg) {}
|
||||
DetectorError::DetectorError(const std::string &msg) : RuntimeError(msg) {}
|
||||
ReceiverError::ReceiverError(const std::string &msg) : RuntimeError(msg) {}
|
||||
GuiError::GuiError(const std::string &msg) : RuntimeError(msg) {}
|
||||
|
||||
} // namespace sls
|
@ -5,8 +5,8 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
// using namespace sls;
|
||||
using sls::defs;
|
||||
@ -219,28 +219,27 @@ TEST_CASE("Detector type") {
|
||||
REQUIRE(StringTo<defs::detectorType>("Eiger") == dt);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Formatting slsDetectorDefs::ROI"){
|
||||
slsDetectorDefs::ROI roi{5,159};
|
||||
TEST_CASE("Formatting slsDetectorDefs::ROI") {
|
||||
slsDetectorDefs::ROI roi{5, 159};
|
||||
REQUIRE(ToString(roi) == "[5, 159]");
|
||||
}
|
||||
|
||||
TEST_CASE("Streaming of slsDetectorDefs::ROI"){
|
||||
TEST_CASE("Streaming of slsDetectorDefs::ROI") {
|
||||
using namespace sls;
|
||||
slsDetectorDefs::ROI roi{-10,1};
|
||||
slsDetectorDefs::ROI roi{-10, 1};
|
||||
std::ostringstream oss;
|
||||
oss << roi;
|
||||
REQUIRE(oss.str() == "[-10, 1]");
|
||||
}
|
||||
|
||||
TEST_CASE("sls::FixedCapacityContainer"){
|
||||
TEST_CASE("sls::FixedCapacityContainer") {
|
||||
sls::FixedCapacityContainer<int, 5> vec;
|
||||
vec.push_back(3);
|
||||
vec.push_back(8);
|
||||
REQUIRE(ToString(vec) == "[3, 8]");
|
||||
}
|
||||
|
||||
TEST_CASE("sls::FixedCapacityContainer stream"){
|
||||
TEST_CASE("sls::FixedCapacityContainer stream") {
|
||||
sls::FixedCapacityContainer<int, 5> vec;
|
||||
vec.push_back(33);
|
||||
vec.push_back(85667);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "catch.hpp"
|
||||
#include "network_utils.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "sls_detector_exceptions.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user