diff --git a/Core/include/BlockStats.h b/Core/include/BlockStats.h index 91294de..ebb997c 100644 --- a/Core/include/BlockStats.h +++ b/Core/include/BlockStats.h @@ -62,7 +62,7 @@ class TCMutex; struct BlockStat { friend class BlockStatManager; -public: + public: BlockStat(const CHAR *statName, int); BlockStat(const CHAR *statName, double stat); @@ -71,7 +71,7 @@ public: void ToString(CHAR *buf, int bufSz) const; -private: + private: const enum Type { eType_Float, eType_Int, @@ -95,8 +95,14 @@ class BlockStatManager { BlockStatManager &operator=(const BlockStatManager &); ~BlockStatManager(); + // A thread-safe version that returns a list index for recording + // block statistics. uint32 BeginBlock(); + + // Add a stat for a given block. This is thread-safe void AddStat(uint32 blockIdx, const BlockStat &stat); + + // Write the statistics to a file. void ToFile(const CHAR *filename); private: diff --git a/Core/include/CompressedImage.h b/Core/include/CompressedImage.h index 2310403..831a50c 100644 --- a/Core/include/CompressedImage.h +++ b/Core/include/CompressedImage.h @@ -66,6 +66,10 @@ class CompressedImage { void InitData(const unsigned char *withData); public: CompressedImage(); + + // Create a compressed image from the given data according to + // the passed format. The size of the data is expected to conform + // to the width, height, and format specified. CompressedImage( const unsigned int width, const unsigned int height, @@ -79,6 +83,10 @@ class CompressedImage { CompressedImage( const CompressedImage &other ); ~CompressedImage(); + // Decompress the compressed image data into outBuf. outBufSz is expected + // to be the proper size determined by the width, height, and format. + // !FIXME! We should have a function to explicitly return the in/out buf + // size for a given compressed image. bool DecompressImage(unsigned char *outBuf, unsigned int outBufSz) const; }; diff --git a/Core/src/BlockStats.cpp b/Core/src/BlockStats.cpp index 1d3a872..178184c 100644 --- a/Core/src/BlockStats.cpp +++ b/Core/src/BlockStats.cpp @@ -47,15 +47,11 @@ #include #include #include +#include #include "FileStream.h" #include "Thread.h" -template -static T max(const T &a, const T &b) { - return (a > b)? a : b; -} - //////////////////////////////////////////////////////////////////////////////// // // BlockStat implementation @@ -150,7 +146,7 @@ BlockStatManager &BlockStatManager::operator=(const BlockStatManager &other) { } BlockStatManager::BlockStatManager(int nBlocks) - : m_BlockStatListSz(max(nBlocks, 0)) + : m_BlockStatListSz(std::max(nBlocks, 0)) , m_NextBlock(0) , m_Mutex(new TCMutex) {