changed namings

This commit is contained in:
Dhanya Maliakal 2017-02-10 10:41:01 +01:00
parent b260d08225
commit 54f92fb26c
11 changed files with 80 additions and 131 deletions

View File

@ -21,9 +21,9 @@ LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
#-Iinclude -I../slsDetectorCalibration -I$(ASM) #-Iinclude -I../slsDetectorCalibration -I$(ASM)
SRC_CLNT = MySocketTCP.cpp ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp FileWriter.cpp BinaryFileWriter.cpp UDPInterface.cpp UDPBaseImplementation.cpp UDPStandardImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp utilities.cpp SRC_CLNT = MySocketTCP.cpp ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp UDPInterface.cpp UDPBaseImplementation.cpp UDPStandardImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp utilities.cpp
ifeq ($(HDF5),yes) ifeq ($(HDF5),yes)
SRC_CLNT += HDF5FileWriter.cpp SRC_CLNT += HDF5File.cpp
endif endif
ifeq ($(REST), yes) ifeq ($(REST), yes)

View File

@ -1,18 +1,18 @@
/************************************************ /************************************************
* @file BinaryFileWriter.h * @file BinaryFile.h
* @short sets/gets properties for the binary file, * @short sets/gets properties for the binary file,
* creates/closes the file and writes data to it * creates/closes the file and writes data to it
***********************************************/ ***********************************************/
#ifndef BINARY_FILE_WRITER_H #ifndef BINARY_FILE_H
#define BINARY_FILE_WRITER_H #define BINARY_FILE_H
#include "FileWriter.h" #include "File.h"
/** /**
*@short sets/gets properties for the binary file, creates/closes the file and writes data to it *@short sets/gets properties for the binary file, creates/closes the file and writes data to it
*/ */
class BinaryFileWriter : private virtual slsReceiverDefs, public FileWriter { class BinaryFile : private virtual slsReceiverDefs, public File {
public: public:
/** /**
@ -28,13 +28,13 @@ class BinaryFileWriter : private virtual slsReceiverDefs, public FileWriter {
* @param nunits pointer to number of theads/ units per detector * @param nunits pointer to number of theads/ units per detector
* @param maxf pointer to max frames per file * @param maxf pointer to max frames per file
*/ */
BinaryFileWriter(int ind, char* fname, char* fpath, uint64_t* findex, BinaryFile(int ind, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits, uint32_t maxf); bool* frindexenable, bool* owenable, int* dindex, int* nunits, uint32_t maxf);
/** /**
* Destructor * Destructor
*/ */
~BinaryFileWriter(); ~BinaryFile();
/** /**
* Print all member values * Print all member values

View File

@ -14,7 +14,7 @@
class GeneralData; class GeneralData;
class Fifo; class Fifo;
class FileWriter; class File;
#include <vector> #include <vector>
@ -260,8 +260,8 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
/** Frame Number of latest processed frame number of an entire Acquisition (including all scans) */ /** Frame Number of latest processed frame number of an entire Acquisition (including all scans) */
uint64_t currentFrameIndex; uint64_t currentFrameIndex;
/** File writer implemented as binary or hdf5 filewriter */ /** File writer implemented as binary or hdf5 File */
FileWriter* fileWriter; File* file;
/** File Format Type */ /** File Format Type */
fileFormat* fileFormatType; fileFormat* fileFormatType;

View File

@ -1,10 +1,10 @@
/************************************************ /************************************************
* @file FileWriter.h * @file File.h
* @short sets/gets properties for the file, * @short sets/gets properties for the file,
* creates/closes the file and writes data to it * creates/closes the file and writes data to it
***********************************************/ ***********************************************/
#ifndef FILE_WRITER_H #ifndef FILE_H
#define FILE_WRITER_H #define FILE_H
/** /**
*@short sets/gets properties for the file, creates/closes the file and writes data to it *@short sets/gets properties for the file, creates/closes the file and writes data to it
*/ */
@ -15,7 +15,7 @@
#include <string> #include <string>
class FileWriter : private virtual slsReceiverDefs { class File : private virtual slsReceiverDefs {
public: public:
/** /**
@ -30,13 +30,13 @@ class FileWriter : private virtual slsReceiverDefs {
* @param dindex pointer to detector index * @param dindex pointer to detector index
* @param nunits pointer to number of theads/ units per detector * @param nunits pointer to number of theads/ units per detector
*/ */
FileWriter(int ind, char* fname, char* fpath, uint64_t* findex, File(int ind, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits); bool* frindexenable, bool* owenable, int* dindex, int* nunits);
/** /**
* Destructor * Destructor
*/ */
virtual ~FileWriter(); virtual ~File();
/** /**
* Get Current File Name * Get Current File Name

View File

@ -1,32 +0,0 @@
/********************************************//**
* @file FileWriter.h
* @short sets/gets properties for the file, creates/closes the file and writes data to it
***********************************************/
#ifndef FILE_WRITER_H
#define FILE_WRITER_H
/**
*@short sets/gets properties for the file, creates/closes the file and writes data to it
*/
class FileWriter : private virtual slsReceiverDefs {
public:
/**
* Constructor
* creates the File Writer
*/
FileWriter();
/**
* Destructor
*/
~FileWriter();
private:
};
#endif

View File

@ -1,18 +1,18 @@
/************************************************ /************************************************
* @file HDF5FileWriter.h * @file HDF5File.h
* @short sets/gets properties for the HDF5 file, * @short sets/gets properties for the HDF5 file,
* creates/closes the file and writes data to it * creates/closes the file and writes data to it
***********************************************/ ***********************************************/
#ifndef HDF5_FILE_WRITER_H #ifndef HDF5_FILE_H
#define HDF5_FILE_WRITER_H #define HDF5_FILE_H
#include "FileWriter.h" #include "File.h"
/** /**
*@short sets/gets properties for the HDF5 file, creates/closes the file and writes data to it *@short sets/gets properties for the HDF5 file, creates/closes the file and writes data to it
*/ */
class HDF5FileWriter : private virtual slsReceiverDefs, public FileWriter { class HDF5File : private virtual slsReceiverDefs, public File {
public: public:
/** /**
@ -26,13 +26,13 @@ class HDF5FileWriter : private virtual slsReceiverDefs, public FileWriter {
* @param dindex pointer to detector index * @param dindex pointer to detector index
* @param nunits pointer to number of theads/ units per detector * @param nunits pointer to number of theads/ units per detector
*/ */
HDF5FileWriter(int ind, char* fname, char* fpath, uint64_t* findex, HDF5File(int ind, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits); bool* frindexenable, bool* owenable, int* dindex, int* nunits);
/** /**
* Destructor * Destructor
*/ */
~HDF5FileWriter(); ~HDF5File();
/** /**
* Print all member values * Print all member values

View File

@ -1,43 +1,43 @@
/************************************************ /************************************************
* @file BinaryFileWriter.h * @file BinaryFile.h
* @short sets/gets properties for the binary file, * @short sets/gets properties for the binary file,
* creates/closes the file and writes data to it * creates/closes the file and writes data to it
***********************************************/ ***********************************************/
#include "BinaryFileWriter.h" #include "BinaryFile.h"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace std; using namespace std;
BinaryFileWriter::BinaryFileWriter(int ind, char* fname, char* fpath, uint64_t* findex, BinaryFile::BinaryFile(int ind, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits, uint32_t maxf): bool* frindexenable, bool* owenable, int* dindex, int* nunits, uint32_t maxf):
FileWriter(ind, fname, fpath, findex, frindexenable, owenable, dindex, nunits), File(ind, fname, fpath, findex, frindexenable, owenable, dindex, nunits),
maxFramesPerFile(maxf) maxFramesPerFile(maxf)
{ {
printf("%d BinaryFileWriter constructor\n",index); printf("%d BinaryFile constructor\n",index);
PrintMembers(); PrintMembers();
} }
BinaryFileWriter::~BinaryFileWriter() { BinaryFile::~BinaryFile() {
printf("%d BinaryFileWriter destructor\n",index); printf("%d BinaryFile destructor\n",index);
} }
void BinaryFileWriter::PrintMembers() { void BinaryFile::PrintMembers() {
FileWriter::PrintMembers(); File::PrintMembers();
printf("Max Frames Per File: %d\n",maxFramesPerFile); printf("Max Frames Per File: %d\n",maxFramesPerFile);
} }
slsReceiverDefs::fileFormat BinaryFileWriter::GetType() { slsReceiverDefs::fileFormat BinaryFile::GetType() {
return BINARY; return BINARY;
} }
void BinaryFileWriter::SetMaxFramesPerFile(uint32_t maxf) { void BinaryFile::SetMaxFramesPerFile(uint32_t maxf) {
maxFramesPerFile = maxf; maxFramesPerFile = maxf;
} }
int BinaryFileWriter::CreateFile(uint64_t fnum) { int BinaryFile::CreateFile(uint64_t fnum) {
currentFileName = CreateFileName(filePath, fileNamePrefix, *fileIndex, currentFileName = CreateFileName(filePath, fileNamePrefix, *fileIndex,
*frameIndexEnable, fnum, *detIndex, *numUnitsPerDetector, index); *frameIndexEnable, fnum, *detIndex, *numUnitsPerDetector, index);
@ -46,11 +46,11 @@ int BinaryFileWriter::CreateFile(uint64_t fnum) {
} }
void BinaryFileWriter::CloseFile() { void BinaryFile::CloseFile() {
printf("%d Closing File: %s\n", index, currentFileName.c_str()); printf("%d Closing File: %s\n", index, currentFileName.c_str());
} }
string BinaryFileWriter::CreateFileName(char* fpath, char* fnameprefix, uint64_t findex, string BinaryFile::CreateFileName(char* fpath, char* fnameprefix, uint64_t findex,
bool frindexenable, uint64_t fnum, int dindex, int numunits, int unitindex) { bool frindexenable, uint64_t fnum, int dindex, int numunits, int unitindex) {
ostringstream osfn; ostringstream osfn;
osfn << fpath << "/" << fnameprefix; osfn << fpath << "/" << fnameprefix;
@ -61,10 +61,10 @@ string BinaryFileWriter::CreateFileName(char* fpath, char* fnameprefix, uint64_t
return osfn.str(); return osfn.str();
} }
int BinaryFileWriter::CreateDataFile(bool owenable, char* fname) { int BinaryFile::CreateDataFile(bool owenable, char* fname) {
return OK; return OK;
} }
void BinaryFileWriter::CloseDataFile() { void BinaryFile::CloseDataFile() {
} }

View File

@ -9,9 +9,9 @@
#include "DataProcessor.h" #include "DataProcessor.h"
#include "GeneralData.h" #include "GeneralData.h"
#include "Fifo.h" #include "Fifo.h"
#include "BinaryFileWriter.h" #include "BinaryFile.h"
#ifdef HDF5C #ifdef HDF5C
#include "HDF5FileWriter.h" #include "HDF5File.h"
#endif #endif
#include <iostream> #include <iostream>
@ -46,7 +46,7 @@ DataProcessor::DataProcessor(Fifo*& f, runStatus* s, pthread_mutex_t* m, fileFor
firstAcquisitionIndex(0), firstAcquisitionIndex(0),
firstMeasurementIndex(0), firstMeasurementIndex(0),
currentFrameIndex(0), currentFrameIndex(0),
fileWriter(0), file(0),
fileFormatType(ftype), fileFormatType(ftype),
fileWriteEnable(fwenable), fileWriteEnable(fwenable),
callbackAction(cbaction), callbackAction(cbaction),
@ -64,7 +64,7 @@ DataProcessor::DataProcessor(Fifo*& f, runStatus* s, pthread_mutex_t* m, fileFor
DataProcessor::~DataProcessor() { DataProcessor::~DataProcessor() {
if (fileWriter) delete fileWriter; if (file) delete file;
ThreadObject::DestroyThread(); ThreadObject::DestroyThread();
NumberofDataProcessors--; NumberofDataProcessors--;
} }
@ -181,8 +181,8 @@ void DataProcessor::RecordFirstIndices(uint64_t fnum) {
void DataProcessor::SetMaxFramesPerFile() { void DataProcessor::SetMaxFramesPerFile() {
if (fileWriter->GetType() == BINARY) if (file->GetType() == BINARY)
fileWriter->SetMaxFramesPerFile(generalData->maxFramesPerFile); file->SetMaxFramesPerFile(generalData->maxFramesPerFile);
} }
@ -202,7 +202,7 @@ void DataProcessor::SetFileFormat(const fileFormat f) {
//remember the pointer values before they are destroyed //remember the pointer values before they are destroyed
char* fname=0; char* fpath=0; uint64_t* findex=0; bool* frindexenable=0; char* fname=0; char* fpath=0; uint64_t* findex=0; bool* frindexenable=0;
bool* fwenable=0; bool* owenable=0; int* dindex=0; int* nunits=0; bool* fwenable=0; bool* owenable=0; int* dindex=0; int* nunits=0;
fileWriter->GetMemberPointerValues(fname, fpath, findex, frindexenable, owenable, dindex, nunits); file->GetMemberPointerValues(fname, fpath, findex, frindexenable, owenable, dindex, nunits);
SetupFileWriter(fname, fpath, findex, frindexenable, owenable, dindex, nunits); SetupFileWriter(fname, fpath, findex, frindexenable, owenable, dindex, nunits);
} }
@ -214,18 +214,18 @@ void DataProcessor::SetupFileWriter(char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits) bool* frindexenable, bool* owenable, int* dindex, int* nunits)
{ {
if (fileWriter) if (file)
delete fileWriter; delete file;
switch(*fileFormatType){ switch(*fileFormatType){
#ifdef HDF5C #ifdef HDF5C
case HDF5: case HDF5:
fileWriter = new HDF5FileWriter(index, fname, fpath, findex, file = new HDF5File(index, fname, fpath, findex,
frindexenable, owenable, dindex, nunits); frindexenable, owenable, dindex, nunits);
break; break;
#endif #endif
default: default:
fileWriter = new BinaryFileWriter(index, fname, fpath, findex, file = new BinaryFile(index, fname, fpath, findex,
frindexenable, owenable, dindex, nunits, generalData->maxFramesPerFile); frindexenable, owenable, dindex, nunits, generalData->maxFramesPerFile);
break; break;
} }
@ -233,9 +233,9 @@ void DataProcessor::SetupFileWriter(char* fname, char* fpath, uint64_t* findex,
int DataProcessor::CreateNewFile() { int DataProcessor::CreateNewFile() {
if (!fileWriter) if (!file)
return FAIL; return FAIL;
if (fileWriter->CreateFile(currentFrameIndex) == FAIL) if (file->CreateFile(currentFrameIndex) == FAIL)
return FAIL; return FAIL;
return OK; return OK;
} }
@ -243,8 +243,8 @@ int DataProcessor::CreateNewFile() {
void DataProcessor::CloseFile() { void DataProcessor::CloseFile() {
if (fileWriter) if (file)
fileWriter->CloseFile(); file->CloseFile();
} }

View File

@ -1,16 +1,16 @@
/************************************************ /************************************************
* @file FileWriter.h * @file File.h
* @short sets/gets properties for the file, * @short sets/gets properties for the file,
* creates/closes the file and writes data to it * creates/closes the file and writes data to it
***********************************************/ ***********************************************/
#include "FileWriter.h" #include "File.h"
#include <iostream> #include <iostream>
using namespace std; using namespace std;
FileWriter::FileWriter(int ind, char* fname, char* fpath, uint64_t* findex, File::File(int ind, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits): bool* frindexenable, bool* owenable, int* dindex, int* nunits):
index(ind), index(ind),
fileNamePrefix(fname), fileNamePrefix(fname),
@ -21,18 +21,18 @@ FileWriter::FileWriter(int ind, char* fname, char* fpath, uint64_t* findex,
detIndex(dindex), detIndex(dindex),
numUnitsPerDetector(nunits) numUnitsPerDetector(nunits)
{ {
printf("%d FileWriter constructor\n",index); printf("%d File constructor\n",index);
} }
FileWriter::~FileWriter() { File::~File() {
printf("%d FileWriter Destructor\n", index); printf("%d File Destructor\n", index);
} }
string FileWriter::GetCurrentFileName() { string File::GetCurrentFileName() {
return currentFileName; return currentFileName;
} }
void FileWriter::PrintMembers() { void File::PrintMembers() {
printf("\nGeneral Writer Variables:" printf("\nGeneral Writer Variables:"
"Index: %d\n" "Index: %d\n"
"File Name Prefix: %s\n" "File Name Prefix: %s\n"
@ -53,7 +53,7 @@ void FileWriter::PrintMembers() {
} }
void FileWriter::GetMemberPointerValues(char* fname, char* fpath, uint64_t* findex, void File::GetMemberPointerValues(char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits) bool* frindexenable, bool* owenable, int* dindex, int* nunits)
{ {
fname = fileNamePrefix; fname = fileNamePrefix;

View File

@ -1,19 +0,0 @@
/********************************************//**
* @file FileWriter.cpp
* @short sets/gets properties for the file, creates/closes the file and writes data to it
***********************************************/
#include "FileWriter.h"
#include <iostream>
using namespace std;
FileWriter::FileWriter(){}
FileWriter::~FileWriter() {}

View File

@ -1,40 +1,40 @@
/************************************************ /************************************************
* @file HDF5FileWriter.h * @file HDF5File.h
* @short sets/gets properties for the HDF5 file, * @short sets/gets properties for the HDF5 file,
* creates/closes the file and writes data to it * creates/closes the file and writes data to it
***********************************************/ ***********************************************/
#include "HDF5FileWriter.h" #include "HDF5File.h"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace std; using namespace std;
HDF5FileWriter::HDF5FileWriter(int ind, char* fname, char* fpath, uint64_t* findex, HDF5File::HDF5File(int ind, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, int* dindex, int* nunits): bool* frindexenable, bool* owenable, int* dindex, int* nunits):
FileWriter(ind, fname, fpath, findex, frindexenable, owenable, dindex, nunits) File(ind, fname, fpath, findex, frindexenable, owenable, dindex, nunits)
{ {
printf("%d HDF5FileWriter constructor\n",index); printf("%d HDF5File constructor\n",index);
PrintMembers(); PrintMembers();
} }
HDF5FileWriter::~HDF5FileWriter() { HDF5File::~HDF5File() {
printf("%d HDF5FileWriter destructor\n",index); printf("%d HDF5File destructor\n",index);
} }
void HDF5FileWriter::PrintMembers() { void HDF5File::PrintMembers() {
FileWriter::PrintMembers(); File::PrintMembers();
printf("\nHDF5 Print Members \n"); printf("\nHDF5 Print Members \n");
} }
slsReceiverDefs::fileFormat HDF5FileWriter::GetType() { slsReceiverDefs::fileFormat HDF5File::GetType() {
return HDF5; return HDF5;
} }
int HDF5FileWriter::CreateFile(uint64_t fnum) { int HDF5File::CreateFile(uint64_t fnum) {
currentFileName = CreateFileName(filePath, fileNamePrefix, *fileIndex, currentFileName = CreateFileName(filePath, fileNamePrefix, *fileIndex,
*frameIndexEnable, fnum, *detIndex, *numUnitsPerDetector, index); *frameIndexEnable, fnum, *detIndex, *numUnitsPerDetector, index);
printf("%d HDF5 File: %s\n", index, currentFileName.c_str()); printf("%d HDF5 File: %s\n", index, currentFileName.c_str());
@ -42,10 +42,10 @@ int HDF5FileWriter::CreateFile(uint64_t fnum) {
} }
void HDF5FileWriter::CloseFile() { void HDF5File::CloseFile() {
} }
string HDF5FileWriter::CreateFileName(char* fpath, char* fnameprefix, uint64_t findex, string HDF5File::CreateFileName(char* fpath, char* fnameprefix, uint64_t findex,
bool frindexenable, uint64_t fnum, int dindex, int numunits, int unitindex) { bool frindexenable, uint64_t fnum, int dindex, int numunits, int unitindex) {
ostringstream osfn; ostringstream osfn;
osfn << fpath << "/" << fnameprefix; osfn << fpath << "/" << fnameprefix;
@ -56,10 +56,10 @@ string HDF5FileWriter::CreateFileName(char* fpath, char* fnameprefix, uint64_t f
return osfn.str(); return osfn.str();
} }
int HDF5FileWriter::CreateDataFile(bool owenable, char* fname) { int HDF5File::CreateDataFile(bool owenable, char* fname) {
return OK; return OK;
} }
void HDF5FileWriter::CloseDataFile() { void HDF5File::CloseDataFile() {
} }