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)
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)
SRC_CLNT += HDF5FileWriter.cpp
SRC_CLNT += HDF5File.cpp
endif
ifeq ($(REST), yes)

View File

@ -1,18 +1,18 @@
/************************************************
* @file BinaryFileWriter.h
* @file BinaryFile.h
* @short sets/gets properties for the binary file,
* creates/closes the file and writes data to it
***********************************************/
#ifndef BINARY_FILE_WRITER_H
#define BINARY_FILE_WRITER_H
#ifndef BINARY_FILE_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
*/
class BinaryFileWriter : private virtual slsReceiverDefs, public FileWriter {
class BinaryFile : private virtual slsReceiverDefs, public File {
public:
/**
@ -28,13 +28,13 @@ class BinaryFileWriter : private virtual slsReceiverDefs, public FileWriter {
* @param nunits pointer to number of theads/ units per detector
* @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);
/**
* Destructor
*/
~BinaryFileWriter();
~BinaryFile();
/**
* Print all member values

View File

@ -14,7 +14,7 @@
class GeneralData;
class Fifo;
class FileWriter;
class File;
#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) */
uint64_t currentFrameIndex;
/** File writer implemented as binary or hdf5 filewriter */
FileWriter* fileWriter;
/** File writer implemented as binary or hdf5 File */
File* file;
/** File Format Type */
fileFormat* fileFormatType;

View File

@ -1,10 +1,10 @@
/************************************************
* @file FileWriter.h
* @file File.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
#ifndef FILE_H
#define FILE_H
/**
*@short sets/gets properties for the file, creates/closes the file and writes data to it
*/
@ -15,7 +15,7 @@
#include <string>
class FileWriter : private virtual slsReceiverDefs {
class File : private virtual slsReceiverDefs {
public:
/**
@ -30,13 +30,13 @@ class FileWriter : private virtual slsReceiverDefs {
* @param dindex pointer to detector index
* @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);
/**
* Destructor
*/
virtual ~FileWriter();
virtual ~File();
/**
* 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,
* creates/closes the file and writes data to it
***********************************************/
#ifndef HDF5_FILE_WRITER_H
#define HDF5_FILE_WRITER_H
#ifndef HDF5_FILE_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
*/
class HDF5FileWriter : private virtual slsReceiverDefs, public FileWriter {
class HDF5File : private virtual slsReceiverDefs, public File {
public:
/**
@ -26,13 +26,13 @@ class HDF5FileWriter : private virtual slsReceiverDefs, public FileWriter {
* @param dindex pointer to detector index
* @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);
/**
* Destructor
*/
~HDF5FileWriter();
~HDF5File();
/**
* Print all member values

View File

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

View File

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

View File

@ -1,16 +1,16 @@
/************************************************
* @file FileWriter.h
* @file File.h
* @short sets/gets properties for the file,
* creates/closes the file and writes data to it
***********************************************/
#include "FileWriter.h"
#include "File.h"
#include <iostream>
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):
index(ind),
fileNamePrefix(fname),
@ -21,18 +21,18 @@ FileWriter::FileWriter(int ind, char* fname, char* fpath, uint64_t* findex,
detIndex(dindex),
numUnitsPerDetector(nunits)
{
printf("%d FileWriter constructor\n",index);
printf("%d File constructor\n",index);
}
FileWriter::~FileWriter() {
printf("%d FileWriter Destructor\n", index);
File::~File() {
printf("%d File Destructor\n", index);
}
string FileWriter::GetCurrentFileName() {
string File::GetCurrentFileName() {
return currentFileName;
}
void FileWriter::PrintMembers() {
void File::PrintMembers() {
printf("\nGeneral Writer Variables:"
"Index: %d\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)
{
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,
* creates/closes the file and writes data to it
***********************************************/
#include "HDF5FileWriter.h"
#include "HDF5File.h"
#include <iostream>
#include <iomanip>
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):
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();
}
HDF5FileWriter::~HDF5FileWriter() {
printf("%d HDF5FileWriter destructor\n",index);
HDF5File::~HDF5File() {
printf("%d HDF5File destructor\n",index);
}
void HDF5FileWriter::PrintMembers() {
FileWriter::PrintMembers();
void HDF5File::PrintMembers() {
File::PrintMembers();
printf("\nHDF5 Print Members \n");
}
slsReceiverDefs::fileFormat HDF5FileWriter::GetType() {
slsReceiverDefs::fileFormat HDF5File::GetType() {
return HDF5;
}
int HDF5FileWriter::CreateFile(uint64_t fnum) {
int HDF5File::CreateFile(uint64_t fnum) {
currentFileName = CreateFileName(filePath, fileNamePrefix, *fileIndex,
*frameIndexEnable, fnum, *detIndex, *numUnitsPerDetector, index);
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) {
ostringstream osfn;
osfn << fpath << "/" << fnameprefix;
@ -56,10 +56,10 @@ string HDF5FileWriter::CreateFileName(char* fpath, char* fnameprefix, uint64_t f
return osfn.str();
}
int HDF5FileWriter::CreateDataFile(bool owenable, char* fname) {
int HDF5File::CreateDataFile(bool owenable, char* fname) {
return OK;
}
void HDF5FileWriter::CloseDataFile() {
void HDF5File::CloseDataFile() {
}