From 24b8db522a41e7a095307ca3c838e26a4429e78d Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 16 Jul 2014 11:58:27 -0700 Subject: [PATCH] Remove unused things in block_cache.h --- src/block_cache.h | 63 +---------------------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/src/block_cache.h b/src/block_cache.h index ad19fb2c7..b4cf06811 100644 --- a/src/block_cache.h +++ b/src/block_cache.h @@ -37,55 +37,12 @@ #include #include -/// @class BasicDataBlockFactory -/// @brief Simple factory for allocating blocks for DataBlockCache -/// @tparam BlockT Type of blocks to produce -/// -/// This is the default block factory class used by DataBlockCache if another isn't specified. -/// It allocates blocks on the heap using operator new and the default constructor, and does -/// nothing special to initialise the blocks. -/// -/// Custom block factories could use a large internally pre-allocated buffer to create the -/// requested blocks in to avoid the default allocator. -template -struct BasicDataBlockFactory { - typedef std::unique_ptr BlockType; - - /// @brief Allocates a block and returns it - /// @param i Index of the block to allocate - /// @return A pointer to the allocated block - /// - /// This default implementation does not use the i parameter. Custom implementations - /// of block factories should use i to determine what data to fill into the block. - std::unique_ptr ProduceBlock(size_t i) - { - (void)i; - return std::unique_ptr(new BlockT); - } - - /// @brief Retrieve the amount of memory consumed by a single block - /// @return Number of bytes consumed by a block - /// - /// All blocks must consume the same amount of memory. The size of a block - /// is used to manage and limit the size of the cache. - size_t GetBlockSize() const - { - return sizeof(BlockT); - } -}; - - - /// @class DataBlockCache /// @brief Cache for blocks of data in a stream or similar /// @tparam BlockT Type of blocks to store /// @tparam MacroblockExponent Controls the number of blocks per macroblock, for tuning memory usage /// @tparam BlockFactoryT Type of block factory, see BasicDataBlockFactory class for detail on these -template < - typename BlockT, - int MacroblockExponent = 6, - typename BlockFactoryT = BasicDataBlockFactory -> +template class DataBlockCache { /// Type of an array of blocks typedef std::vector BlockArray; @@ -260,22 +217,4 @@ public: return b; } - - - /// @brief Speculatively add blocks not present to the cache - /// @param forward Assume forwards linear access is plausible - /// @param backward Assume backwards linear access is plausible - /// @return Number of blocks added to the cache - /// - /// Assuming forwards and/or backwards linear access causes the macroblock access data to be - /// used for speculating in macroblocks that may be accessed soon, and also allocate block - /// in macroblocks that may otherwise not have been accessed recently. - /// - /// @todo Implement this. - size_t Speculate(bool forward, bool backward) - { - (void)forward; - (void)backward; - return 0; - } };