mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-06 16:22:25 +02:00
Build and Deploy on local RHEL9 / build (push) Successful in 2m4s
Build on RHEL9 docker image / build (push) Successful in 3m57s
Build on RHEL8 docker image / build (push) Successful in 5m6s
Build and Deploy on local RHEL8 / build (push) Successful in 5m9s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m7s
Run Simulator Tests on local RHEL8 / build (push) Successful in 23m40s
* templated variable vector size (sending/receive size before vector) in ClientSocket and Module:SendToReceiverVarVector * fix warnign * Another tcp function ironed out but for Detector * wip * fix * wip * wip * wip * wip * fix for execccomand * typo --------- Co-authored-by: AliceMazzoleni99 <alice.mazzoleni@psi.ch>
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
#pragma once
|
|
|
|
#include "sls/DataSocket.h"
|
|
#include "sls/logger.h"
|
|
|
|
namespace sls {
|
|
class ServerInterface;
|
|
}
|
|
|
|
#include "sls/ServerSocket.h"
|
|
#include "sls/sls_detector_defs.h"
|
|
namespace sls {
|
|
|
|
class ServerInterface : public DataSocket {
|
|
using defs = slsDetectorDefs;
|
|
|
|
public:
|
|
ServerInterface(int socketId) : DataSocket(socketId) {}
|
|
|
|
int sendResult(int ret, void *retval, int retvalSize, char *mess = nullptr);
|
|
|
|
template <typename T> int sendResult(int ret, T &retval) {
|
|
return sendResult(ret, &retval, sizeof(retval, nullptr));
|
|
}
|
|
|
|
template <typename T> int sendResult(T &&retval) {
|
|
Send(defs::OK);
|
|
Send(retval);
|
|
return defs::OK;
|
|
}
|
|
|
|
template <typename T> int sendVariableResult(T &&retval) {
|
|
int count = static_cast<int>(retval.size());
|
|
Send(defs::OK);
|
|
Send(count);
|
|
if (count > 0)
|
|
Send(retval);
|
|
return defs::OK;
|
|
}
|
|
|
|
template <typename T> T receiveVariableArgs() {
|
|
int count = 0;
|
|
Receive(count);
|
|
T retval(static_cast<typename T::size_type>(count));
|
|
if (count > 0) {
|
|
Receive(retval);
|
|
}
|
|
return retval;
|
|
}
|
|
};
|
|
|
|
} // namespace sls
|