mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 10:20:04 +02:00
changes without ostringstream done
This commit is contained in:
parent
91b7a87557
commit
3b4b2d707f
@ -831,8 +831,6 @@ private:
|
||||
/** Progress (currentFrameNumber) Mutex */
|
||||
pthread_mutex_t progressMutex;
|
||||
|
||||
char streambuf[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH];
|
||||
char cstreambuf[MAX_STR_LENGTH];
|
||||
|
||||
|
||||
};
|
||||
|
@ -14,7 +14,7 @@
|
||||
#elif VERYVERBOSE
|
||||
#define FILELOG_MAX_LEVEL logDEBUG4
|
||||
#elif VERBOSE
|
||||
#define FILELOG_MAX_LEVEL logDEBUG
|
||||
#define FILELOG_MAX_LEVEL logDEBUG1
|
||||
#endif
|
||||
|
||||
#ifndef FILELOG_MAX_LEVEL
|
||||
@ -31,11 +31,14 @@ class Logger {
|
||||
public:
|
||||
Logger(){};
|
||||
|
||||
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
|
||||
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
|
||||
|
||||
|
||||
static void FILE_LOG(TLogLevel level, char* msg)
|
||||
static void FILE_LOG(TLogLevel level, char const* msg)
|
||||
{
|
||||
|
||||
if(level > FILELOG_MAX_LEVEL) return;
|
||||
|
||||
char buffer[11];
|
||||
const int buffer_len = sizeof(buffer);
|
||||
time_t t;
|
||||
@ -70,10 +73,10 @@ public:
|
||||
*/
|
||||
|
||||
switch(level){
|
||||
case logERROR: cprintf(RED BOLD, "- %s ERROR: %s", result, msg); break;
|
||||
case logWARNING: cprintf(YELLOW BOLD,"- %s WARNING: %s", result, msg); break;
|
||||
case logINFO: cprintf(GRAY, "- %s INFO: %s", result, msg); break;
|
||||
default: break;
|
||||
case logERROR: cprintf(RED BOLD, "- %s ERROR: %s \n", result, msg); break;
|
||||
case logWARNING: cprintf(YELLOW BOLD,"- %s WARNING: %s \n", result, msg); break;
|
||||
case logINFO: cprintf(GRAY, "- %s INFO: %s \n", result, msg); break;
|
||||
default: cprintf(GRAY, "- %s DEBUG: %s \n", result, msg); break;
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,9 +206,7 @@ int UDPBaseImplementation::getActivate() const{ return activated;}
|
||||
|
||||
/**initial parameters***/
|
||||
void UDPBaseImplementation::configure(map<string, string> config_map){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
@ -216,9 +214,9 @@ void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
|
||||
ostringstream os;
|
||||
os << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Flipped Data: %d , %d ", flippedData[0], flippedData[1]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
|
||||
@ -228,14 +226,13 @@ void UDPBaseImplementation::setFileName(const char c[]){
|
||||
if(strlen(c))
|
||||
strcpy(fileName, c);
|
||||
|
||||
ostringstream os;
|
||||
os << "File name:" << fileName;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "File name: %s ", fileName);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFilePath(const char c[]){
|
||||
|
||||
|
||||
if(strlen(c)){
|
||||
//check if filepath exists
|
||||
struct stat st;
|
||||
@ -243,69 +240,67 @@ void UDPBaseImplementation::setFilePath(const char c[]){
|
||||
strcpy(filePath,c);
|
||||
else{
|
||||
strcpy(filePath,"");
|
||||
ostringstream os;
|
||||
os << "FilePath does not exist:" << filePath;
|
||||
string message(os.str()); FILE_LOG(logWARNING, message);
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "FilePath does not exist: %s ", filePath);
|
||||
FILE_LOG(logWARNING, cstreambuf);
|
||||
}
|
||||
strcpy(filePath, c);
|
||||
}
|
||||
/*FILE_LOG(logDEBUG) << "Info: File path:" << filePath;*/
|
||||
/*{
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "File path:: %s ", filePath);
|
||||
FILE_LOG(logDEBUG, cstreambuf);
|
||||
}*/
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFileIndex(const uint64_t i){
|
||||
|
||||
|
||||
fileIndex = i;
|
||||
ostringstream os;
|
||||
os << "File Index:" << fileIndex;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "File Index: %lu ", fileIndex);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
//FIXME: needed?
|
||||
void UDPBaseImplementation::setScanTag(const int i){
|
||||
|
||||
|
||||
scanTag = i;
|
||||
ostringstream os;
|
||||
os << "Scan Tag:" << scanTag;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Scan Tag: %d ", scanTag);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFrameIndexEnable(const bool b){
|
||||
|
||||
|
||||
frameIndexEnable = b;
|
||||
ostringstream os;
|
||||
os << "Frame Index Enable: " << stringEnable(frameIndexEnable);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Frame Index Enable: %s ", stringEnable(frameIndexEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
||||
|
||||
|
||||
fileWriteEnable = b;
|
||||
ostringstream os;
|
||||
os << "File Write Enable: " << stringEnable(fileWriteEnable);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "File Write Enable: %s ", stringEnable(fileWriteEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setOverwriteEnable(const bool b){
|
||||
|
||||
|
||||
overwriteEnable = b;
|
||||
ostringstream os;
|
||||
os << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Overwrite Enable: %s ", stringEnable(overwriteEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
||||
|
||||
|
||||
dataCompressionEnable = b;
|
||||
ostringstream os;
|
||||
os << "Data Compression : " << stringEnable(dataCompressionEnable);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Data Compression: %s ", stringEnable(dataCompressionEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overridden methods might return FAIL
|
||||
return OK;
|
||||
@ -315,49 +310,44 @@ int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
||||
/***connection parameters***/
|
||||
void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
|
||||
|
||||
|
||||
udpPortNum[0] = i;
|
||||
ostringstream os;
|
||||
os << "UDP Port Number[0]:" << udpPortNum[0];
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "UDP Port Number[0]: %u ", udpPortNum[0]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
|
||||
|
||||
|
||||
udpPortNum[1] = i;
|
||||
ostringstream os;
|
||||
os << "UDP Port Number[1]:" << udpPortNum[1];
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "UDP Port Number[1]: %u ", udpPortNum[1]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setEthernetInterface(const char* c){
|
||||
|
||||
|
||||
strcpy(eth, c);
|
||||
ostringstream os;
|
||||
os << "Ethernet Interface: " << eth;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Ethernet Interface: %s ", eth);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
void UDPBaseImplementation::setShortFrameEnable(const int i){
|
||||
|
||||
|
||||
shortFrameEnable = i;
|
||||
ostringstream os;
|
||||
os << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Short Frame Enable: %d ", shortFrameEnable);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
||||
|
||||
|
||||
frameToGuiFrequency = freq;
|
||||
ostringstream os;
|
||||
os << "Frame To Gui Frequency:" << frameToGuiFrequency;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Frame To Gui Frequency: %u ", frameToGuiFrequency);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
@ -365,21 +355,19 @@ int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
||||
|
||||
void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){
|
||||
|
||||
|
||||
frameToGuiTimerinMS = time_in_ms;
|
||||
ostringstream os;
|
||||
os << "Frame To Gui Timer:" << frameToGuiTimerinMS;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Frame To Gui Timer: %u ", frameToGuiTimerinMS);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
|
||||
uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
||||
|
||||
|
||||
dataStreamEnable = enable;
|
||||
ostringstream os;
|
||||
os << "Streaming Data from Receiver:" << dataStreamEnable;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Streaming Data from Receiver: %d ", dataStreamEnable);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
@ -388,11 +376,10 @@ uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
||||
|
||||
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||
|
||||
|
||||
acquisitionPeriod = i;
|
||||
ostringstream os;
|
||||
os << "Acquisition Period:" << (double)acquisitionPeriod/(1E9) << "s";
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Acquisition Period: %f s ", (double)acquisitionPeriod/(1E9));
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
@ -400,11 +387,10 @@ int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||
|
||||
int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
||||
|
||||
|
||||
acquisitionTime = i;
|
||||
ostringstream os;
|
||||
os << "Acquisition Time:" << (double)acquisitionTime/(1E9) << "s";
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Acquisition Time: %f s ", (double)acquisitionTime/(1E9));
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
@ -412,11 +398,10 @@ int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
||||
|
||||
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||
|
||||
|
||||
numberOfFrames = i;
|
||||
ostringstream os;
|
||||
os << "Number of Frames:" << numberOfFrames;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Number of Frames: %lu ", numberOfFrames);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
@ -424,11 +409,10 @@ int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||
|
||||
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
||||
|
||||
|
||||
dynamicRange = i;
|
||||
ostringstream os;
|
||||
os << "Dynamic Range:" << dynamicRange;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Dynamic Range: %u ", dynamicRange);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
@ -436,11 +420,10 @@ int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
||||
|
||||
int UDPBaseImplementation::setTenGigaEnable(const bool b){
|
||||
|
||||
|
||||
tengigaEnable = b;
|
||||
ostringstream os;
|
||||
os << "Ten Giga Enable: " << stringEnable(tengigaEnable);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Ten Giga Enable: %s ", stringEnable(tengigaEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overridden functions might return FAIL
|
||||
return OK;
|
||||
@ -448,11 +431,10 @@ int UDPBaseImplementation::setTenGigaEnable(const bool b){
|
||||
|
||||
int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
||||
|
||||
|
||||
fifoDepth = i;
|
||||
ostringstream os;
|
||||
os << "Fifo Depth: " << i;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Fifo Depth: %u ", i);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overridden functions might return FAIL
|
||||
return OK;
|
||||
@ -467,23 +449,23 @@ int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
||||
/***initial functions***/
|
||||
int UDPBaseImplementation::setDetectorType(const detectorType d){
|
||||
|
||||
|
||||
myDetectorType = d;
|
||||
//if eiger, set numberofListeningThreads = 2;
|
||||
ostringstream os;
|
||||
os << "Detector Type:" << getDetectorType(d);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Detector Type: %s ", getDetectorType(d).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::initialize(const char *c){
|
||||
|
||||
|
||||
if(strlen(c))
|
||||
strcpy(detHostname, c);
|
||||
ostringstream os;
|
||||
os << "Detector Hostname:" << detHostname;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Detector Hostname: %s ", detHostname);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -492,68 +474,62 @@ void UDPBaseImplementation::resetAcquisitionCount(){
|
||||
|
||||
|
||||
totalPacketsCaught = 0;
|
||||
ostringstream os;
|
||||
os << "totalPacketsCaught:" << totalPacketsCaught;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Total Packets Caught: %lu ", totalPacketsCaught);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::startReceiver(char *c){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::stopReceiver(){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::startReadout(){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::shutDownUDPSockets(){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
|
||||
//overridden functions might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::readFrame(int ithread, char* c,char** raw, int64_t &startAcquisitionIndex, int64_t &startFrameIndex){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
|
||||
//FIXME: needed, isnt stopReceiver enough?
|
||||
void UDPBaseImplementation::abort(){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::closeFile(int ithread){
|
||||
ostringstream os;
|
||||
os << " must be overridden by child classes";
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
|
||||
int UDPBaseImplementation::setActivate(int enable){
|
||||
|
||||
|
||||
if(enable != -1){
|
||||
activated = enable;
|
||||
ostringstream os;
|
||||
os << "Activation: " << stringEnable(activated);
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Activation: %s ", stringEnable(activated).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
return activated;
|
||||
|
@ -22,24 +22,21 @@ using namespace std;
|
||||
|
||||
UDPInterface * UDPInterface::create(string receiver_type){
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Starting %s ", receiver_type.c_str());
|
||||
|
||||
if (receiver_type == "standard"){
|
||||
ostringstream os;
|
||||
os << "Starting " << receiver_type;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
return new UDPStandardImplementation();
|
||||
}
|
||||
#ifdef REST
|
||||
else if (receiver_type == "REST"){
|
||||
ostringstream os;
|
||||
os << "Starting " << receiver_type;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
return new UDPRESTImplementation();
|
||||
}
|
||||
#endif
|
||||
else{
|
||||
ostringstream os;
|
||||
os << "[ERROR] UDP interface not supported, using standard implementation";
|
||||
string message(os.str()); FILE_LOG(logWARNING, message);
|
||||
FILE_LOG(logWARNING, "[ERROR] UDP interface not supported, using standard implementation");
|
||||
return new UDPBaseImplementation();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -106,31 +106,32 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
||||
|
||||
if( !fname.empty() ){
|
||||
try{
|
||||
ostringstream os;
|
||||
os << "config file name " << fname;
|
||||
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "config file name : %s ",fname.c_str());
|
||||
FILE_LOG(logDEBUG1, cstreambuf);
|
||||
|
||||
success = read_config_file(fname, &tcpip_port_no, &configuration_map);
|
||||
//VERBOSE_PRINT("Read configuration file of " + iline + " lines");
|
||||
}
|
||||
catch(...){
|
||||
ostringstream os;
|
||||
os << "Error opening configuration file " << fname ;
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Error opening configuration file : %s ",fname.c_str());
|
||||
FILE_LOG(logERROR, cstreambuf);
|
||||
|
||||
success = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(success != OK){
|
||||
ostringstream os;
|
||||
os << "Failed: see output above for more information " ;
|
||||
string message(os.str()); FILE_LOG(logERROR, message);
|
||||
FILE_LOG(logERROR, "Failed: see output above for more information ");
|
||||
}
|
||||
|
||||
if (success==OK){
|
||||
ostringstream os;
|
||||
os << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl;
|
||||
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "SLS Receiver starting %s on port %d ",udp_interface_type.c_str(), tcpip_port_no);
|
||||
FILE_LOG(logDEBUG1, cstreambuf);
|
||||
#ifdef REST
|
||||
udp_interface = UDPInterface::create(udp_interface_type);
|
||||
udp_interface->configure(configuration_map);
|
||||
|
@ -126,22 +126,17 @@ int slsReceiverTCPIPInterface::setPortNumber(int pn){
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::start(){
|
||||
{
|
||||
ostringstream os;
|
||||
os << "Creating TCP Server Thread" << endl;
|
||||
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1, "Creating TCP Server Thread");
|
||||
|
||||
killTCPServerThread = 0;
|
||||
if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){
|
||||
cout << "Could not create TCP Server thread" << endl;
|
||||
return FAIL;
|
||||
}
|
||||
//#ifdef VERYVERBOSE
|
||||
{
|
||||
ostringstream os;
|
||||
os << "TCP Server thread created successfully." << endl;
|
||||
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||
}
|
||||
FILE_LOG(logDEBUG1, "TCP Server thread created successfully.");
|
||||
|
||||
//#endif
|
||||
return OK;
|
||||
}
|
||||
@ -402,20 +397,20 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
||||
|
||||
}
|
||||
}
|
||||
//#ifdef VERYVERBOSE
|
||||
//#ifdef VERYVERBOSE
|
||||
if(ret!=FAIL)
|
||||
{
|
||||
ostringstream os;
|
||||
os << "detector type " << dr;
|
||||
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Detector Type %d ", (int)dr);
|
||||
FILE_LOG(logDEBUG1, cstreambuf);
|
||||
}
|
||||
else
|
||||
cprintf(RED, "%s\n", mess);
|
||||
//#endif
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -482,7 +477,7 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
||||
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -557,7 +552,7 @@ int slsReceiverTCPIPInterface::set_file_dir() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -629,7 +624,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -707,7 +702,7 @@ int slsReceiverTCPIPInterface::set_frame_index() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -772,15 +767,15 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
//setup udpip
|
||||
//get ethernet interface or IP to listen to
|
||||
{
|
||||
ostringstream os;
|
||||
os << "Receiver UDP IP: " << args[0];
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Receiver UDP IP: %s ",args[0]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
temp = genericSocket::ipToName(args[0]);
|
||||
if(temp=="none"){
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Failed to get ethernet interface or IP\n");
|
||||
FILE_LOG(logERROR, string(mess));
|
||||
FILE_LOG(logERROR, "Failed to get ethernet interface or IP ");
|
||||
}
|
||||
else{
|
||||
strcpy(eth,temp.c_str());
|
||||
@ -801,9 +796,10 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
}
|
||||
else{
|
||||
strcpy(retval,temp.c_str());
|
||||
ostringstream os;
|
||||
os << "Reciever MAC Address: " << retval;
|
||||
string message(os.str()); FILE_LOG(logINFO, message);
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Reciever MAC Address: %s ",retval);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -811,14 +807,16 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
// send answer
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
FILE_LOG(logERROR, string(mess));
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "%s ", mess);
|
||||
FILE_LOG(logERROR, cstreambuf);
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
mySock->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||
@ -867,7 +865,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -915,7 +913,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -946,7 +944,7 @@ int slsReceiverTCPIPInterface::get_status(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -977,7 +975,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
|
||||
}else retval=receiverBase->getTotalFramesCaught();
|
||||
#endif
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1009,7 +1007,7 @@ int slsReceiverTCPIPInterface::get_frame_index(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1054,7 +1052,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1123,7 +1121,7 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1305,7 +1303,7 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1486,7 +1484,7 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1640,7 +1638,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1907,7 +1905,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2070,7 +2068,7 @@ int slsReceiverTCPIPInterface::jungfrau_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2148,7 +2146,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2214,7 +2212,7 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2277,7 +2275,7 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2337,7 +2335,7 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2365,7 +2363,7 @@ int slsReceiverTCPIPInterface::get_id(){
|
||||
#endif
|
||||
|
||||
if(mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2413,7 +2411,7 @@ else{
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2501,7 +2499,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2573,7 +2571,7 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2639,7 +2637,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2740,7 +2738,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2808,7 +2806,7 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2878,7 +2876,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2950,7 +2948,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -3024,7 +3022,7 @@ int slsReceiverTCPIPInterface::set_activate() {
|
||||
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -3088,7 +3086,7 @@ int slsReceiverTCPIPInterface::set_flipped_data(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG,"Force update" );
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user