Commit 9c8742c2 authored by LEGEARD Luc's avatar LEGEARD Luc
Browse files

add 2 functions IsSame and RawEqual in

parent 077a5146
......@@ -95,7 +95,7 @@ void SetExternalPointers(UtilVector_c* vect){
void ReSize(int size) {
int i=0;
int old= fSize;
// int old= fSize;
if (fPt == NULL){
fPtTempo = (char*) (malloc(size));
for (int i = 0; i < size; i++) ((char*) fPtTempo)[i] = 0;
......
......@@ -1267,3 +1267,46 @@ void MFMCommonFrame::debug_frame() const
}
}
//_______________________________________________________________________________
bool MFMCommonFrame::RawEqual(MFMCommonFrame* testframe)const{
// test if testframe and this:frame is equal
bool test= true;
int i=0;
char* pttest;
char* thispttest;
testframe->SetAttributs();
int size = testframe->GetFrameSize();
thispttest = (char*)(GetPointHeader());
pttest = (char*)(testframe->GetPointHeader());
for (i=0; i<size; i++) {
test = test and ((char)(pttest[i])==(char)((thispttest[i])));
if (not test) break;
}
return test;
}
//_______________________________________________________________________________
bool MFMCommonFrame::IsSame(MFMCommonFrame* testframe){
// test if testframe have same attibuts
bool test= true;
int i=0;
char* pttest;
char* thispttest;
testframe->SetAttributs();
int size = testframe->GetFrameSize();
SetAttributs();
test = test and ( GetFrameSize() == testframe->GetFrameSize());
test = test and ( GetHeaderSize() == testframe->GetHeaderSize());
test = test and ( GetBlobNess() == testframe->GetBlobNess());
test = test and ( GetMetaType() == testframe->GetMetaType());
test = test and ( GetFrameEndianness() == testframe->GetFrameEndianness());
test = test and ( GetDataSource() == testframe->GetDataSource());
//test = test and ( GetUnitBlockSize() == testframe->GetUnitBlockSize());
test = test and ( GetRevision() == testframe->GetRevision());
test = test and ( GetEventNumberFromCommonFrameData() == testframe->GetEventNumberFromCommonFrameData());
test = test and ( GetTimeStampFromCommonFrameData() == testframe->GetTimeStampFromCommonFrameData());
return test;
}
//_______________________________________________________________________________
......@@ -181,6 +181,8 @@ MFMCommonFrame(int unitBlock_size, int dataSource,
virtual string GetDumpData(char mode='d', bool nozero=false) const {string test ="";return test;}; /// Dump decoded data in if frame class avec this method
virtual string GetHeaderDisplay(char* infotext=NULL)const;
void HeaderDisplay(char* infotext=NULL) const ;
virtual bool RawEqual(MFMCommonFrame* testframe)const;
virtual bool IsSame(MFMCommonFrame* testframe);
virtual void MFM_make_header(int unitBlock_size, int dataSource,
int frameType, int revision, int frameSize,bool blob=false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment