mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00

* WIP * first test * format * test frames * also 0: * WIP * WIP * first test * format * test frames * also 0: * test and less local * pass ret by value * level * WIP * WIP * cleaning up interface * removed ref * another * updated api version * cleanup * cleanup * WIP * fixes * fixed tests
44 lines
970 B
C++
44 lines
970 B
C++
#pragma once
|
|
|
|
#include "DataSocket.h"
|
|
namespace sls {
|
|
class ServerInterface2;
|
|
}
|
|
|
|
#include "ServerSocket.h"
|
|
#include "sls_detector_defs.h"
|
|
namespace sls {
|
|
|
|
class ServerInterface2 : public DataSocket {
|
|
using defs = slsDetectorDefs;
|
|
|
|
public:
|
|
ServerInterface2(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) {
|
|
sendData(defs::OK);
|
|
sendData(retval);
|
|
return defs::OK;
|
|
}
|
|
|
|
int receiveArg(void *arg, int sizeofArg);
|
|
|
|
template <typename T> int receiveArg(T &arg) {
|
|
return receiveArg(&arg, sizeof(arg));
|
|
}
|
|
template <typename T> T receive() {
|
|
T arg;
|
|
receiveArg(&arg, sizeof(arg));
|
|
return arg;
|
|
}
|
|
|
|
private:
|
|
};
|
|
|
|
} // namespace sls
|