switching from black to white background for receiver

This commit is contained in:
Dhanya Maliakal
2017-11-28 11:18:30 +01:00
parent eb89e9bf96
commit a351fa8f28
17 changed files with 98 additions and 99 deletions

View File

@ -118,12 +118,12 @@ class BinaryFileStatic {
{
if(!owenable){
if (NULL == (fd = fopen((const char *) fname.c_str(), "wx"))){
bprintf(RED,"Error in creating binary master file %s\n",fname.c_str());
cprintf(RED,"Error in creating binary master file %s\n",fname.c_str());
fd = 0;
return 1;
}
}else if (NULL == (fd = fopen((const char *) fname.c_str(), "w"))){
bprintf(RED,"Error in creating binary master file %s\n",fname.c_str());
cprintf(RED,"Error in creating binary master file %s\n",fname.c_str());
fd = 0;
return 1;
}
@ -169,7 +169,7 @@ class BinaryFileStatic {
(long long int)acquisitionPeriod,
ctime(&t));
if (strlen(message) > MAX_STR_LENGTH) {
bprintf(RED,"Master File Size %d is greater than max str size %d\n",
cprintf(RED,"Master File Size %d is greater than max str size %d\n",
(int)strlen(message), MAX_STR_LENGTH);
return 1;
}

View File

@ -100,7 +100,7 @@ class File : private virtual slsReceiverDefs {
* @returns OK or FAIL
*/
virtual int CreateFile(uint64_t fnum){
bprintf(RED,"This is a generic function CreateFile that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function CreateFile that should be overloaded by a derived class\n");
return OK;
}
@ -108,14 +108,14 @@ class File : private virtual slsReceiverDefs {
* Close Current File
*/
virtual void CloseCurrentFile() {
bprintf(RED,"This is a generic function CloseCurrentFile that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function CloseCurrentFile that should be overloaded by a derived class\n");
}
/**
* Close Files
*/
virtual void CloseAllFiles() {
bprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
}
/**
@ -126,7 +126,7 @@ class File : private virtual slsReceiverDefs {
* @param OK or FAIL
*/
virtual int WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t nump) {
bprintf(RED,"This is a generic function WriteToFile that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function WriteToFile that should be overloaded by a derived class\n");
return FAIL;
}
@ -143,7 +143,7 @@ class File : private virtual slsReceiverDefs {
*/
virtual int CreateMasterFile(bool en, uint32_t size,
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t ap) {
bprintf(RED,"This is a generic function CreateMasterFile that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function CreateMasterFile that should be overloaded by a derived class\n");
return OK;
}
@ -154,7 +154,7 @@ class File : private virtual slsReceiverDefs {
* @param ny number of pixels in y direction
*/
virtual void SetNumberofPixels(uint32_t nx, uint32_t ny) {
bprintf(RED,"This is a generic function SetNumberofPixels that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function SetNumberofPixels that should be overloaded by a derived class\n");
}
/**
@ -162,7 +162,7 @@ class File : private virtual slsReceiverDefs {
* @param numf number of images caught
*/
virtual void EndofAcquisition(uint64_t numf) {
bprintf(RED,"This is a generic function EndofAcquisition that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function EndofAcquisition that should be overloaded by a derived class\n");
}
protected:

View File

@ -151,7 +151,7 @@ public:
* @param tgEnable true if 10GbE is enabled, else false
*/
virtual void SetDynamicRange(int dr, bool tgEnable) {
bprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
};
/**
@ -160,7 +160,7 @@ public:
* @param dr dynamic range
*/
virtual void SetTenGigaEnable(bool tgEnable, int dr) {
bprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
};
/**

View File

@ -111,7 +111,7 @@ public:
fd = 0;
}
} catch(Exception error) {
bprintf(RED,"Error in closing HDF5 handles of index %d\n", ind);
cprintf(RED,"Error in closing HDF5 handles of index %d\n", ind);
error.printError();
}
}
@ -129,7 +129,7 @@ public:
fd = 0;
}
} catch(Exception error) {
bprintf(RED,"Error in closing master HDF5 handles\n");
cprintf(RED,"Error in closing master HDF5 handles\n");
error.printError();
}
}
@ -143,7 +143,7 @@ public:
{
if(fd) {
if (H5Fclose(fd) < 0 )
bprintf(RED,"Error in closing virtual HDF5 handles\n");
cprintf(RED,"Error in closing virtual HDF5 handles\n");
fd = 0;
}
}
@ -176,7 +176,7 @@ public:
memspace.close();
}
catch(Exception error){
bprintf(RED,"Error in writing to file in object %d\n",ind);
cprintf(RED,"Error in writing to file in object %d\n",ind);
error.printError();
return 1;
}
@ -212,7 +212,7 @@ public:
dset_para[12]->write(&header->version, ParameterDataTypes[12], memspace, *dspace_para);
}
catch(Exception error){
bprintf(RED,"Error in writing parameters to file in object %d\n",ind);
cprintf(RED,"Error in writing parameters to file in object %d\n",ind);
error.printError();
return 1;
}
@ -327,7 +327,7 @@ public:
fd->close();
} catch(Exception error) {
bprintf(RED,"Error in creating master HDF5 handles\n");
cprintf(RED,"Error in creating master HDF5 handles\n");
error.printError();
return 1;
}
@ -411,7 +411,7 @@ public:
dset_para[i] = new DataSet(fd->createDataSet(ParameterNames[i], ParameterDataTypes[i], *dspace_para));
}
catch(Exception error){
bprintf(RED,"Error in creating HDF5 handles in object %d\n",ind);
cprintf(RED,"Error in creating HDF5 handles in object %d\n",ind);
error.printError();
fd->close();
return 1;
@ -527,12 +527,12 @@ public:
//setect hyperslabs
if (H5Sselect_hyperslab (vdsDataspace, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) {
bprintf(RED,"could not select hyperslab\n");
cprintf(RED,"could not select hyperslab\n");
error = true;
break;
}
if (H5Sselect_hyperslab (vdsDataspace_para, H5S_SELECT_SET, offset_para, NULL, count_para, NULL) < 0) {
bprintf(RED,"could not select hyperslab for parameters\n");
cprintf(RED,"could not select hyperslab for parameters\n");
error = true;
break;
}
@ -559,14 +559,14 @@ public:
//mapping
if (H5Pset_virtual(dcpl, vdsDataspace, srcFileName.c_str(), srcDatasetName.c_str(), srcDataspace) < 0) {
bprintf(RED,"could not set mapping for paramter 1\n");
cprintf(RED,"could not set mapping for paramter 1\n");
error = true;
break;
}
for (int k = 0; k < NumberofParameters; ++k) {
if (H5Pset_virtual(dcpl_para[k], vdsDataspace_para, srcFileName.c_str(), ParameterNames[k], srcDataspace_para) < 0) {
bprintf(RED,"could not set mapping for paramter %d\n", k);
cprintf(RED,"could not set mapping for paramter %d\n", k);
error = true;
break;
}
@ -639,7 +639,7 @@ public:
data_out = (T*)malloc(sizeof(T)*(nDimx*nDimy*nDimz));
break;
default:
bprintf(RED,"invalid rank. Options: 2 or 3\n");
cprintf(RED,"invalid rank. Options: 2 or 3\n");
return 0;
}
if (datatype == PredType::STD_U16LE) {
@ -696,7 +696,7 @@ public:
newfd->close();
oldfd->close();
} catch(Exception error){
bprintf(RED,"Error in copying virtual files\n");
cprintf(RED,"Error in copying virtual files\n");
error.printError();
free(data_out);
oldfd->close();
@ -780,7 +780,7 @@ public:
* @returns 1 for fail
*/
static int CloseFileOnError(hid_t& fd, const string msg) {
bprintf(RED, "%s", msg.c_str());
cprintf(RED, "%s", msg.c_str());
if(fd > 0)
H5Fclose(fd);
fd = 0;
@ -803,7 +803,7 @@ public:
else if (dtype == PredType::STD_U64LE)
return H5T_STD_U64LE;
else {
bprintf(RED, "Invalid Data type\n");
cprintf(RED, "Invalid Data type\n");
return H5T_STD_U64LE;
}
}

View File

@ -659,7 +659,7 @@ enum communicationProtocol{
continue;
if(nsent != nsending){
if(nsent && (nsent != -1))
bprintf(RED,"Incomplete Packet size %d\n",nsent);
cprintf(RED,"Incomplete Packet size %d\n",nsent);
break;
}
length-=nsent;
@ -672,7 +672,7 @@ enum communicationProtocol{
nsending=packet_size;
while(1){
#ifdef VERYVERBOSE
bprintf(BLUE,"%d gonna listen\n", portno); fflush(stdout);
cprintf(BLUE,"%d gonna listen\n", portno); fflush(stdout);
#endif
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
//break out of loop only if read one packets size or read didnt work (cuz of shutdown)
@ -680,7 +680,7 @@ enum communicationProtocol{
break;
//incomplete packets or header packets ignored and read buffer again
if(nsent != packet_size && nsent != header_packet_size)
bprintf(RED,"%d Incomplete Packet size %d\n", portno, nsent);
cprintf(RED,"%d Incomplete Packet size %d\n", portno, nsent);
}
//nsent = 1040;
if(nsent > 0)total_sent+=nsent;

View File

@ -218,10 +218,9 @@ inline void Output2FILE::Output(const std::string& msg, TLogLevel level)
return;
bool out = true;
switch(level){
case logERROR: bprintf(RED BOLD,"%s",msg.c_str()); break;
case logWARNING: bprintf(YELLOW BOLD,"%s",msg.c_str()); break;
case logINFO: bprintf(GRAY,"%s",msg.c_str()); break;
// case logINFO: bprintf(DARKGRAY BOLD,"%s",msg.c_str());break;
case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break;
case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break;
case logINFO: cprintf(DARKGRAY,"%s",msg.c_str()); break;
default: fprintf(pStream,"%s",msg.c_str()); out = false; break;
}
fflush(out ? stdout : pStream);