mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 18:40:42 +02:00
data types and format
This commit is contained in:
parent
a4fec1e750
commit
b200138730
7
.clang-tidy
Normal file
7
.clang-tidy
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
Checks: '*, -google-runtime-references, -hicpp-no-array-decay, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -fuchsia*,-readability-else-after-return,-readability-avoid-const-params-in-decls,-hicpp-signed-bitwise,-cppcoreguidelines-pro-bounds-constant-array-index,-llvm-header-guard,-readability-static-accessed-through-instance,-google-readability-todo'
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '.*'
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
...
|
@ -11,6 +11,7 @@
|
||||
#include "versionAPI.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
@ -5258,18 +5259,18 @@ int slsDetector::setCTBPatLoops(int level, int &start, int &stop, int &n) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int slsDetector::setCTBPatWaitAddr(int level, int addr) {
|
||||
uint64_t slsDetector::setCTBPatWaitAddr(uint64_t level, uint64_t addr) {
|
||||
int fnum = F_SET_CTB_PATTERN;
|
||||
int ret = FAIL;
|
||||
int mode = 2; // sets loop
|
||||
uint64_t args[3] = {(uint64_t)mode, (uint64_t)level, (uint64_t)addr};
|
||||
uint64_t mode = 2; // sets loop
|
||||
uint64_t retval = -1;
|
||||
std::array<uint64_t, 3> args{mode, level, addr};
|
||||
FILE_LOG(logDEBUG1) << "Setting CTB Wait Addr, "
|
||||
"level: "
|
||||
<< level << ", addr: 0x" << std::hex << addr << std::dec;
|
||||
|
||||
if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) {
|
||||
ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval));
|
||||
ret = thisDetectorControl->Client_Send(fnum, args.data(), sizeof(args), &retval, sizeof(retval));
|
||||
disconnectControl();
|
||||
|
||||
// handle ret
|
||||
@ -5285,16 +5286,16 @@ int slsDetector::setCTBPatWaitAddr(int level, int addr) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int slsDetector::setCTBPatWaitTime(int level, uint64_t t) {
|
||||
uint64_t slsDetector::setCTBPatWaitTime(uint64_t level, uint64_t t) {
|
||||
int fnum = F_SET_CTB_PATTERN;
|
||||
int ret = FAIL;
|
||||
int mode = 3; // sets loop
|
||||
uint64_t args[3] = {(uint64_t)mode, (uint64_t)level, t};
|
||||
uint64_t retval = -1;
|
||||
uint64_t mode = 3; // sets loop
|
||||
uint64_t retval = -1; //TODO! is this what we want?
|
||||
std::array<uint64_t,3> args{mode, level, t};
|
||||
FILE_LOG(logDEBUG1) << "Setting CTB Wait Time, level: " << level << ", t: " << t;
|
||||
|
||||
if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) {
|
||||
ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval));
|
||||
ret = thisDetectorControl->Client_Send(fnum, args.data(), sizeof(args), &retval, sizeof(retval));
|
||||
disconnectControl();
|
||||
|
||||
// handle ret
|
||||
|
@ -1612,7 +1612,7 @@ public:
|
||||
* @param addr wait address, -1 gets
|
||||
* @returns actual value
|
||||
*/
|
||||
int setCTBPatWaitAddr(int level, int addr=-1);
|
||||
uint64_t setCTBPatWaitAddr(uint64_t level, uint64_t addr=-1);
|
||||
|
||||
/**
|
||||
* Sets the wait time in the CTB
|
||||
@ -1620,7 +1620,7 @@ public:
|
||||
* @param t wait time, -1 gets
|
||||
* @returns actual value
|
||||
*/
|
||||
int setCTBPatWaitTime(int level, uint64_t t=-1);
|
||||
uint64_t setCTBPatWaitTime(uint64_t level, uint64_t t=-1);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -12,38 +12,31 @@
|
||||
/*
|
||||
canceled SetupParameters() and varaibles intialized in the constructors' headers;
|
||||
defined SEND_REC_MAX_SIZE (for compatibilty with mythen (and possibly other) pure C servers (i would move it to the common header file)
|
||||
|
||||
added #ifndef C_ONLY... to cutout class definition when including in pure C servers (can be removed if SEND_REC_MAX_SIZE is moved to the common header file)
|
||||
|
||||
defined private variables char hostname[1000] and int portno to store connection informations;
|
||||
|
||||
defined public functions int getHostname(char *name) and int getPortNumber() to retrieve connection informations
|
||||
|
||||
added public function int getErrorStatus() returning 1 if socketDescriptor<0
|
||||
|
||||
remove exits in the constructors and replace them with socketDescriptor=-1
|
||||
|
||||
replaced the argument of send/receive data with void (to avoid too much casting or compiler errors/warnings)
|
||||
|
||||
added a function which really does not close the socket between send/receive (senddataonly, receivedataonly)
|
||||
|
||||
Modified by Anna on 31.10.2012 developed and
|
||||
*/
|
||||
/* Modified by Anna on 31.10.2012
|
||||
|
||||
developed and
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "genericSocket.h"
|
||||
#define TCP_PACKET_SIZE 4096
|
||||
|
||||
class MySocketTCP : public genericSocket {
|
||||
|
||||
public:
|
||||
MySocketTCP(const char* const host_ip_or_name, unsigned short int const port_number): genericSocket(host_ip_or_name, port_number,TCP){setPacketSize(TCP_PACKET_SIZE);}; // sender (client): where to? ip
|
||||
MySocketTCP(unsigned short int const port_number):genericSocket(port_number,TCP) {setPacketSize(TCP_PACKET_SIZE);}; // receiver (server) local no need for ip
|
||||
// sender (client): where to? ip
|
||||
MySocketTCP(const char *const host_ip_or_name, uint64_t port_number)
|
||||
: genericSocket(host_ip_or_name, port_number, TCP) {
|
||||
setPacketSize(TCP_PACKET_SIZE);
|
||||
}
|
||||
// receiver (server) local no need for ip
|
||||
MySocketTCP(uint16_t port_number)
|
||||
: genericSocket(port_number, TCP) {
|
||||
setPacketSize(TCP_PACKET_SIZE);
|
||||
}
|
||||
virtual ~MySocketTCP(){};
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user