mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-07 04:02:27 +02:00
added slsWarnings and c++17 compiler option
This commit is contained in:
@@ -38,15 +38,24 @@ template <typename DerivedDetectorServer> class DetectorServer {
|
||||
|
||||
std::unique_ptr<DetectorServerImpl> impl;
|
||||
|
||||
auto *const getDerivedImpl() const {
|
||||
return static_cast<typename DerivedDetectorServer::ImplType *const>(
|
||||
auto *getDerivedImpl() {
|
||||
return static_cast<typename DerivedDetectorServer::ImplType *>(
|
||||
impl.get());
|
||||
}
|
||||
|
||||
const auto *getDerivedImpl() const {
|
||||
return static_cast<const typename DerivedDetectorServer::ImplType *>(
|
||||
impl.get());
|
||||
}
|
||||
|
||||
private:
|
||||
/// @brief get derived class
|
||||
DerivedDetectorServer *const getDerived() {
|
||||
return static_cast<DerivedDetectorServer *const>(this);
|
||||
DerivedDetectorServer *getDerived() {
|
||||
return static_cast<DerivedDetectorServer *>(this);
|
||||
}
|
||||
|
||||
const DerivedDetectorServer *getDerived() const {
|
||||
return static_cast<const DerivedDetectorServer *>(this);
|
||||
}
|
||||
|
||||
ProcessedResult processFunction(const detFuncs function_id,
|
||||
@@ -423,7 +432,8 @@ ProcessedResult DetectorServer<DerivedDetectorServer>::get_version(
|
||||
->get_server_version(); // TODO: get Impl from derived server
|
||||
|
||||
char version_cstr[MAX_STR_LENGTH]{};
|
||||
strncpy(version_cstr, version.c_str(), version.size());
|
||||
std::snprintf(version_cstr, sizeof(version_cstr), "%s",
|
||||
version.c_str()); // ensures temination
|
||||
LOG(TLogLevel::logDEBUG) << "Server Version: " << version;
|
||||
return ProcessedResult{static_cast<ReturnCode>(socket.sendResult(
|
||||
version_cstr))}; // TODO: check what would be possible return codes!!!
|
||||
|
||||
@@ -35,7 +35,7 @@ template <typename T>
|
||||
void setRegisterField(uint32_t ®istervalue, const RegisterField ®_field,
|
||||
T field_value) {
|
||||
|
||||
if (field_value > reg_field.bitmask) {
|
||||
if (field_value > static_cast<T>(reg_field.bitmask)) {
|
||||
throw std::invalid_argument(
|
||||
fmt::format("Value {} cannot fit in field with bitmask {}",
|
||||
field_value, reg_field.bitmask));
|
||||
|
||||
Reference in New Issue
Block a user