#ifndef _STATSWRITER_H__ #define _STATSWRITER_H__ #include "common.h" #include #include "Vector3.h" namespace CHCDemoEngine { struct FrameStats { FrameStats(): mFrame(0), mFPS(0), mTime(.0f), mNodes(0), mTriangles(0), mObjects(0) {} FrameStats(int frame, int fps, float time, int nodes, int triangles, int objects): mFrame(frame), mFPS(fps), mTime(time), mNodes(nodes), mTriangles(triangles), mObjects(objects) {} friend std::ostream& operator<< (std::ostream &s, const FrameStats &A); //////////////// int mFrame; int mFPS; float mTime; int mNodes; int mTriangles; int mObjects; }; /// Overload << operator for C++-style output inline std::ostream& operator<< (std::ostream &s, const FrameStats &A) { s << "#FRAME" << "\n" << A.mFrame << std::endl; s << "#FPS" << "\n" << A.mFPS << std::endl; s << "#TIME" << "\n" << A.mTime << std::endl; s << "#NODES" << "\n" << A.mNodes << std::endl; s << "#TRIANGLES" << "\n" << A.mTriangles << std::endl; s << "#OBJECTS" << "\n" << A.mObjects << std::endl; return s; } /** Writes out stats */ class StatsWriter { public: StatsWriter(const std::string &filename); ~StatsWriter(); /** Writes current data */ void WriteFrameStats(const FrameStats &stats); protected: std::ofstream mFile; }; } // _STATSWRITER_H__ #endif