mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-22 15:18:55 +01:00
exceptions TCP (#31)
* 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
This commit is contained in:
committed by
Dhanya Thattil
parent
a6144f658e
commit
1db7521cfa
@@ -13,16 +13,32 @@ class ServerInterface2 : public DataSocket {
|
||||
using defs = slsDetectorDefs;
|
||||
|
||||
public:
|
||||
ServerInterface2(int socketId) : DataSocket(socketId){}
|
||||
ServerInterface2(int socketId) : DataSocket(socketId) {}
|
||||
|
||||
int sendResult(bool update, int ret, void *retval, int retvalSize,
|
||||
char *mess = nullptr);
|
||||
int receiveArg(int &ret, char *mess, void *arg, int sizeofArg);
|
||||
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;
|
||||
}
|
||||
|
||||
private:
|
||||
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
|
||||
Reference in New Issue
Block a user