1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */ 2 3 #ifndef SYNC_TRACER_H 4 #define SYNC_TRACER_H 5 6 #ifdef TRACE_SYNC 7 8 #include <fstream> 9 10 class CSyncTracer 11 { 12 public: 13 void Initialize(int playerIndex); 14 15 template<typename T> 16 CSyncTracer& operator<<(const T& value) 17 { 18 if (logfile.good()) { 19 logfile << value; 20 } 21 return *this; 22 } 23 24 private: 25 std::ofstream logfile; 26 }; 27 28 extern CSyncTracer tracefile; 29 30 #endif // TRACE_SYNC 31 32 #endif // SYNC_TRACER_H 33