You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
I think that to do a template for fread is overcomplicated, in case that you want to automatically increase totalBytesReaded I would suggest something like this:
void FRead( void* buffer, std::size_t size, std::size_t count ){
if ( fread(buffer, size, count, fInputBinFile) != count){
printf("Error: could not read %d bytes.\n", size*count);
exit(1);
}
totalBytesReaded += size*count;
}
There is already an FRead() implemented in this PR: #33, which shall be working in normal cases. However it was a little problematic to reach the original goal of online analysis. I don't know why... So the PR has not been merged yet.
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 probablytotalBytesReaded
could be madeprivate
.For example:
could be replaced by:
For example:
could be replaced by:
or even
or
The text was updated successfully, but these errors were encountered: