-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or request
Description
We could perhaps simplify the code of external to raw signal processes if we introduce a template method inside TRestRawToSignalProcess::FRead.
Each time we read, it is required to increase the variable totalBytesRead. This could also be encapsulated in the base class. And probably totalBytesReaded could be made private.
For example:
char buffer[CTAG_SZ];
if (fread(buffer, sizeof(char), CTAG_SZ, fInputBinFile) != CTAG_SZ) {
printf("Error: could not read first ACQ prefix.\n");
exit(1);
}
totalBytesReaded += CTAG_SZ * sizeof(char);
could be replaced by:
char buffer[CTAG_SZ];
FRead( buffer, sizeof(char), CTAG_SZ);
For example:
if (fread(&tmp, sizeof(int32_t), 1, fInputBinFile) != 1) {
printf("Error: could not read timestamp.\n");
exit(1);
}
totalBytesReaded += sizeof(int32_t);
could be replaced by:
int32_t tmp;
FRead( tmp, sizeof(int32_t), 1);
or even
int32_t tmp;
FReadOne( tmp, sizeof(int32_t));
or
tmp = FRead<int32_t>();
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or request