#include "tString.h"
#include "tError.h"
Go to the source code of this file.
Classes | |
class | tRecorderTemplate1< BLOCK > |
recording funtions that take one piece of data More... | |
class | tRecorderTemplate2< BLOCK, DATA > |
recording funtions that take two pieces of data More... | |
class | tRecorderTemplate3< BLOCK, DATA1, DATA2 > |
recording funtions that take two pieces of data and a block More... | |
class | tRecorderBase |
non-templated base class of recorder More... | |
class | tRecorder |
simple interface to recording functionality More... | |
class | tTextFileRecorder |
text file loading recorder More... | |
struct | tTypeToStream< T > |
typedef for easier handling More... | |
class | tLineString |
persistable string class More... | |
class | tRecorderSyncBase |
debug recording synchronization test class More... | |
class | tRecorderSync< DATA > |
debug recording synchronization test class More... | |
class | tRecorderBlockHelper< DATA > |
class taking the ugly implementation part of tRecordingBlock and tPlaybackBlock More... | |
class | tRecordingBlockBase |
a block of data to record (for more advanced data storage ), base class More... | |
class | tRecordingBlock |
a block of data to record (for more advanced data storage ), implementation More... | |
class | tPlaybackBlockBase |
a block of data to play back. More... | |
class | tPlaybackBlock |
a block of data to play back. More... | |
Defines | |
#define | tRECORD_AS(TYPE, STREAM) |
macro declaring that type TYPE should be converted to type STREAM before | |
#define | tRECORDING_ENUM(TYPE) tRECORD_AS( TYPE, int ) |
macro for recording enums: convert them to int. | |
Functions | |
tRECORD_AS (char, int) | |
tRECORD_AS (unsigned char, int) | |
std::ostream & | operator<< (std::ostream &s, tLineString const &line) |
persistent string writing operator | |
std::istream & | operator>> (std::istream &s, tLineString &line) |
persistent string reading operator | |
tRECORD_AS (tString, tLineString) | |
record strings as line strings | |
REAL | st_GetDifference (REAL a, REAL b) |
REAL | st_GetDifference (int a, int b) |
REAL | st_GetDifference (unsigned int a, unsigned int b) |
REAL | st_GetDifference (long unsigned int a, long unsigned int b) |
REAL | st_GetDifference (tString const &a, tString const &b) |
#define tRECORD_AS | ( | TYPE, | |||
STREAM | ) |
Value:
template<> struct tTypeToStream< TYPE > \ { \ typedef STREAM TOSTREAM; \ typedef int * DUMMYREQUIRED; \ } \
Definition at line 176 of file tRecorder.h.
#define tRECORDING_ENUM | ( | TYPE | ) | tRECORD_AS( TYPE, int ) |
std::ostream& operator<< | ( | std::ostream & | s, | |
tLineString const & | line | |||
) |
persistent string writing operator
Definition at line 183 of file tRecorder.cpp.
References c, and tString::Len().
00184 { 00185 // write magic character 00186 s << 'L'; 00187 00188 // print string, encode newlines 00189 for( int i=0; i<line.Len(); ++i) 00190 { 00191 char c = line[i]; 00192 if ( c == '\n' ) 00193 s << "\\n"; 00194 if ( c == '\\' ) 00195 s << "\\\\"; 00196 else if ( c != '\0' ) 00197 s << c; 00198 } 00199 00200 return s << '\n'; 00201 }
std::istream& operator>> | ( | std::istream & | s, | |
tLineString & | line | |||
) |
persistent string reading operator
Definition at line 204 of file tRecorder.cpp.
References c, tString::Clear(), tString::ReadLine(), tString::Size(), and tASSERT.
00205 { 00206 // read magic character 00207 char c; 00208 s >> c; 00209 tASSERT( 'L' == c ); 00210 00211 tString read; 00212 00213 // read line 00214 read.ReadLine(s); 00215 00216 // std::cout << "Read: " << read << "\n"; 00217 00218 line.Clear(); 00219 00220 // copy line, replacing "\n" with real newline 00221 for(size_t i=0; i<read.Size(); ++i) 00222 { 00223 char c = read[i]; 00224 if ( c != '\\' || i+1 == read.Size() || ( read[i+1] != 'n' && read[i+1] != '\\' ) ) 00225 { 00226 line << c; 00227 } 00228 else if ( read[i+1] == '\\' ) 00229 { 00230 line << "\\"; 00231 i++; 00232 } 00233 else // if ( read[i+1] != 'n' ) 00234 { 00235 line << "\n"; 00236 i++; 00237 } 00238 } 00239 00240 return s; 00241 }
REAL st_GetDifference | ( | long unsigned int | a, | |
long unsigned int | b | |||
) |
REAL st_GetDifference | ( | unsigned int | a, | |
unsigned int | b | |||
) |
REAL st_GetDifference | ( | int | a, | |
int | b | |||
) |
tRECORD_AS | ( | tString | , | |
tLineString | ||||
) |
record strings as line strings
tRECORD_AS | ( | unsigned | char, | |
int | ||||
) |
tRECORD_AS | ( | char | , | |
int | ||||
) |