Tide 0.1.0
|
The in-memory Cluster implementation. More...
#include <tide/memory_cluster.h>
Classes | |
class | IteratorBase |
Public Types | |
typedef IteratorBase < BlockElement::Ptr, BlockStore::iterator > | Iterator |
Block iterator interface. | |
typedef IteratorBase < Block::ConstPtr, BlockStore::const_iterator > | ConstIterator |
Block const iterator interface. | |
Public Member Functions | |
MemoryCluster (uint64_t timecode=0) | |
Construct a new cluster. | |
Iterator | begin () |
Access the start of the blocks. | |
ConstIterator | begin () const |
Access the start of the blocks. | |
Iterator | end () |
Access the end of the blocks. | |
ConstIterator | end () const |
Access the end of the blocks. | |
virtual bool | empty () const |
Check if there are no blocks. | |
virtual size_type | count () const |
Get the number of blocks. | |
virtual void | clear () |
Remove all blocks. | |
virtual void | erase (Iterator position) |
Erase the block at the specified iterator. | |
virtual void | erase (Iterator first, Iterator last) |
Erase a range of blocks. | |
virtual void | push_back (value_type const &value) |
Add a block to this cluster. | |
std::streamsize | finalise (std::ostream &output) |
Finalise writing of the cluster. | |
Protected Types | |
typedef std::vector < BlockElement::Ptr > | BlockStore |
Block storage type. | |
Protected Member Functions | |
std::streamsize | blocks_size () const |
Get the size of the blocks in this cluster. | |
std::streamsize | read_blocks (std::istream &input, std::streamsize size) |
Read the blocks in this cluster from the output stream. | |
Protected Attributes | |
BlockStore | blocks_ |
Block storage. |
The in-memory Cluster implementation.
This implementation of the Cluster interface stores the entire cluster in memory, using a std::vector to store the Blocks. It provides rapid access to the blocks at the expense of a larger memory footprint and longer loading time when opening the cluster.
Definition at line 50 of file memory_cluster.h.
typedef std::vector<BlockElement::Ptr> tide::MemoryCluster::BlockStore [protected] |
Block storage type.
Definition at line 54 of file memory_cluster.h.
typedef IteratorBase<Block::ConstPtr, BlockStore::const_iterator> tide::MemoryCluster::ConstIterator |
Block const iterator interface.
This interface provides access to the blocks in the cluster, sorted in ascending time order. The access is const, preventing modification of the blocks.
Definition at line 157 of file memory_cluster.h.
typedef IteratorBase<BlockElement::Ptr, BlockStore::iterator> tide::MemoryCluster::Iterator |
Block iterator interface.
This interface provides access to the blocks in the cluster, sorted in ascending time order.
Definition at line 149 of file memory_cluster.h.
tide::MemoryCluster::MemoryCluster | ( | uint64_t | timecode = 0 | ) |
Construct a new cluster.
[in] | timecode | The timecode of the cluster, in the units specified by TimecodeScale. |
Iterator tide::MemoryCluster::begin | ( | ) |
Access the start of the blocks.
Gets an iterator pointing to the first block in the cluster.
ConstIterator tide::MemoryCluster::begin | ( | ) | const |
Access the start of the blocks.
Gets an iterator pointing to the first block in the cluster.
std::streamsize tide::MemoryCluster::blocks_size | ( | ) | const [protected, virtual] |
Get the size of the blocks in this cluster.
Implements tide::Cluster.
virtual void tide::MemoryCluster::clear | ( | ) | [inline, virtual] |
virtual size_type tide::MemoryCluster::count | ( | ) | const [inline, virtual] |
Get the number of blocks.
Implements tide::Cluster.
Definition at line 191 of file memory_cluster.h.
virtual bool tide::MemoryCluster::empty | ( | ) | const [inline, virtual] |
Check if there are no blocks.
Implements tide::Cluster.
Definition at line 189 of file memory_cluster.h.
ConstIterator tide::MemoryCluster::end | ( | ) | const |
Access the end of the blocks.
Gets an iterator pointing beyond the last block in the cluster.
Iterator tide::MemoryCluster::end | ( | ) |
Access the end of the blocks.
Gets an iterator pointing beyond the last block in the cluster.
virtual void tide::MemoryCluster::erase | ( | Iterator | position | ) | [inline, virtual] |
Erase the block at the specified iterator.
[in] | position | The position to erase at. |
Definition at line 199 of file memory_cluster.h.
Erase a range of blocks.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
Definition at line 206 of file memory_cluster.h.
std::streamsize tide::MemoryCluster::finalise | ( | std::ostream & | output | ) | [virtual] |
Finalise writing of the cluster.
Implements tide::Cluster.
virtual void tide::MemoryCluster::push_back | ( | value_type const & | value | ) | [inline, virtual] |
Add a block to this cluster.
The cluster must be in the writable state. This means that write() has been called and finish_write() has not been called.
Implements tide::Cluster.
Definition at line 214 of file memory_cluster.h.
std::streamsize tide::MemoryCluster::read_blocks | ( | std::istream & | input, |
std::streamsize | size | ||
) | [protected, virtual] |
Read the blocks in this cluster from the output stream.
Implements tide::Cluster.
BlockStore tide::MemoryCluster::blocks_ [protected] |
Block storage.
Definition at line 222 of file memory_cluster.h.