format + exception.cpp

This commit is contained in:
Erik Frojdh
2020-05-13 14:48:52 +02:00
parent f0f97f265a
commit 3962714b48
14 changed files with 63 additions and 39 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -10,4 +10,4 @@
#define APIJUNGFRAU 0x200508
#define APIMYTHEN3 0x200508
#define APIMOENCH 0x200508
#define APIEIGER 0x200513
#define APIEIGER 0x200513