#include <tRecorder.h>
Static Public Member Functions | |
static void | Archive (char const *section, int debugLevel, DATA &data) |
Archives a bit of data for reference. | |
Static Private Member Functions | |
static float | GetDifference (DATA const &a, DATA const &b) |
Calculates a suitable difference between two bits of data. |
Definition at line 225 of file tRecorder.h.
void tRecorderSync< DATA >::Archive | ( | char const * | section, | |
int | level, | |||
DATA & | data | |||
) | [inline, static] |
Archives a bit of data for reference.
typedefs for easier handling
section | section to archive to | |
level | debug level of the data (lower levels get archived sooner) | |
data | data to archive |
Definition at line 903 of file tRecorder.h.
References a, b, EPS, tRecorderSyncBase::GetDebugLevelPlayback(), tRecorderSyncBase::GetDebugLevelRecording(), tRecorderSync< DATA >::GetDifference(), tRecorderBase::IsPlayingBack(), tRecorder::PlaybackStrict(), REAL, tRecorder::Record(), st_Breakpoint(), st_GetDifference(), and tASSERT.
Referenced by eGrid::AddEdge(), nSendBuffer::AddMessage(), nMessage::nMessage(), gCycle::OnDropTempWall(), eGrid::RemoveEdge(), sg_ArchiveCoord(), sg_ArchiveReal(), eHalfEdge::Simplify(), eGrid::SimplifyNum(), gCycle::Timestep(), and nNetObject::~nNetObject().
00904 { 00905 // see if it is really a DEBUG only section 00906 tASSERT( section && *section == '_' ); 00907 00908 if ( level <= GetDebugLevelPlayback() ) 00909 { 00910 DATA copy = data; 00911 00912 // read data from archive 00913 if ( tRecorder::PlaybackStrict( section, copy ) ) 00914 { 00915 #ifdef DEBUG_DIFFERENCE 00916 // determine difference 00917 REAL diff = GetDifference( data, copy ); 00918 00919 static REAL alarmDiff = EPS; 00920 if ( diff > alarmDiff ) 00921 { 00922 alarmDiff = diff * 2; 00923 REAL st_GetDifference( REAL a, REAL b); 00924 REAL st_GetDifference( int a, int b); 00925 REAL st_GetDifference( tString const & a, tString const & b ); 00926 std::cout << "Syncing difference found: " << data << "!=" << copy << " by " << diff << "\n"; 00927 st_Breakpoint(); 00928 } 00929 #endif 00930 00931 // restore data, hoping that the playback can take the little bump 00932 if ( level <= GetDebugLevelRecording() ) 00933 { 00934 data = copy; 00935 } 00936 } 00937 else if ( tRecorder::IsPlayingBack() ) 00938 { 00939 std::cout << "Syncing difference found: expected " << section << ".\n"; 00940 00941 st_Breakpoint(); 00942 } 00943 } 00944 00945 // archive data 00946 if ( level <= GetDebugLevelRecording() ) 00947 tRecorder::Record( section, data ); 00948 }
float tRecorderSync< DATA >::GetDifference | ( | DATA const & | a, | |
DATA const & | b | |||
) | [inline, static, private] |
Calculates a suitable difference between two bits of data.
a | object a | |
b | object b |
Definition at line 969 of file tRecorder.h.
References st_GetDifference().
Referenced by tRecorderSync< DATA >::Archive().
00970 { 00971 return st_GetDifference( a, b ); 00972 }