Tide 0.1.0
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

tide::MemoryCluster Class Reference

The in-memory Cluster implementation. More...

#include <tide/memory_cluster.h>

Inheritance diagram for tide::MemoryCluster:
Inheritance graph
[legend]
Collaboration diagram for tide::MemoryCluster:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

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.


Member Typedef Documentation

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.

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.


Constructor & Destructor Documentation

tide::MemoryCluster::MemoryCluster ( uint64_t  timecode = 0)

Construct a new cluster.

Parameters:
[in]timecodeThe timecode of the cluster, in the units specified by TimecodeScale.

Member Function Documentation

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]

Remove all blocks.

Implements tide::Cluster.

Definition at line 193 of file memory_cluster.h.

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.

Parameters:
[in]positionThe position to erase at.

Definition at line 199 of file memory_cluster.h.

virtual void tide::MemoryCluster::erase ( Iterator  first,
Iterator  last 
) [inline, virtual]

Erase a range of blocks.

Parameters:
[in]firstThe start of the range.
[in]lastThe 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.


Member Data Documentation

Block storage.

Definition at line 222 of file memory_cluster.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines