Tawara
0.1.0
|
The in-memory Cluster implementation. More...
#include <tawara/memory_cluster.h>
Classes | |
class | IteratorBase |
Public Types | |
typedef boost::shared_ptr < MemoryCluster > | Ptr |
Pointer to a memory-based cluster. More... | |
typedef IteratorBase < BlockElement::Ptr, BlockStore::iterator > | Iterator |
Block iterator interface. More... | |
typedef IteratorBase < Block::ConstPtr, BlockStore::const_iterator > | ConstIterator |
Block const iterator interface. More... | |
![]() | |
typedef boost::shared_ptr < Cluster > | Ptr |
Pointer to a cluster. More... | |
typedef BlockElement::Ptr | value_type |
The value type of this container. More... | |
typedef size_t | size_type |
The size type of this container. More... | |
typedef value_type & | reference |
The reference type. More... | |
typedef value_type const & | const_reference |
The constant reference type. More... | |
Public Member Functions | |
MemoryCluster (uint64_t timecode=0) | |
Construct a new cluster. More... | |
Iterator | begin () |
Access the start of the blocks. More... | |
ConstIterator | begin () const |
Access the start of the blocks. More... | |
Iterator | end () |
Access the end of the blocks. More... | |
ConstIterator | end () const |
Access the end of the blocks. More... | |
virtual bool | empty () const |
Check if there are no blocks. More... | |
virtual size_type | count () const |
Get the number of blocks. More... | |
virtual void | clear () |
Remove all blocks. More... | |
virtual void | erase (Iterator position) |
Erase the block at the specified iterator. More... | |
virtual void | erase (Iterator first, Iterator last) |
Erase a range of blocks. More... | |
virtual void | push_back (value_type const &value) |
Add a block to this cluster. More... | |
std::streamsize | finalise (std::ostream &output) |
Finalise writing of the cluster. More... | |
![]() | |
Cluster (uint64_t timecode=0) | |
Construct a new Cluster. More... | |
virtual | ~Cluster () |
Destructor. More... | |
uint64_t | timecode () const |
Get the cluster's timecode. More... | |
void | timecode (uint64_t timecode) |
Set the cluster's timecode. More... | |
std::vector< SilentTrackNumber > & | silent_tracks () |
Get the list of silent tracks. More... | |
uint64_t | position () const |
Get the position of this cluster in the segment. More... | |
uint64_t | previous_size () const |
Get the size of the previous cluster in the segment. More... | |
void | previous_size (uint64_t size) |
Set the size of the previous cluster in the segment. More... | |
std::streamsize | size () const |
Get the total size of the element. More... | |
std::streamsize | read (std::istream &input) |
Element reading. More... | |
![]() | |
MasterElement (uint32_t id, bool crc=false) | |
Create a new MasterElement. More... | |
virtual | ~MasterElement () |
Destructor. More... | |
![]() | |
Element (tawara::ids::ID id) | |
Create a new Element. More... | |
virtual | ~Element () |
Destructor. More... | |
uint32_t | id () const |
Get the element's ID. More... | |
std::streampos | offset () const |
Get the element's offset in the byte stream. More... | |
virtual std::streamsize | write (std::ostream &output) |
Element writing. More... | |
Protected Types | |
typedef std::vector < BlockElement::Ptr > | BlockStore |
Block storage type. More... | |
Protected Member Functions | |
std::streamsize | blocks_size () const |
Get the size of the blocks in this cluster. More... | |
std::streamsize | read_blocks (std::istream &input, std::streamsize size) |
Read the blocks in this cluster from the output stream. More... | |
![]() | |
std::streamsize | meta_size () const |
Get the size of the meta-data portion of the body of. More... | |
std::streamsize | body_size () const |
Get the size of the body of this element. More... | |
std::streamsize | write_size (std::ostream &output) |
Element size writing. More... | |
std::streamsize | write_body (std::ostream &output) |
Element body writing. More... | |
std::streamsize | read_body (std::istream &input, std::streamsize size) |
Element body loading. More... | |
std::streamsize | read_silent_tracks (std::istream &input) |
Read the SilentTracks child element. More... | |
virtual void | reset () |
Reset the cluster's members to default values. More... | |
![]() | |
std::streamsize | write_id (std::ostream &output) |
Element ID writing. More... | |
Protected Attributes | |
BlockStore | blocks_ |
Block storage. More... | |
![]() | |
UIntElement | timecode_ |
std::vector< SilentTrackNumber > | silent_tracks_ |
UIntElement | position_ |
UIntElement | prev_size_ |
bool | writing_ |
![]() | |
tawara::ids::ID | id_ |
std::streampos | offset_ |
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 61 of file memory_cluster.h.
|
protected |
Block storage type.
Definition at line 65 of file memory_cluster.h.
typedef IteratorBase<Block::ConstPtr, BlockStore::const_iterator> tawara::MemoryCluster::ConstIterator |
Block const iterator interface.
This interface provides access to the blocks in the cluster. The access is const, preventing modification of the blocks.
Definition at line 169 of file memory_cluster.h.
typedef IteratorBase<BlockElement::Ptr, BlockStore::iterator> tawara::MemoryCluster::Iterator |
Block iterator interface.
This interface provides access to the blocks in the cluster.
Definition at line 162 of file memory_cluster.h.
typedef boost::shared_ptr<MemoryCluster> tawara::MemoryCluster::Ptr |
Pointer to a memory-based cluster.
Definition at line 69 of file memory_cluster.h.
tawara::MemoryCluster::MemoryCluster | ( | uint64_t | timecode = 0 | ) |
Construct a new cluster.
[in] | timecode | The timecode of the cluster, in the units specified by TimecodeScale. |
Iterator tawara::MemoryCluster::begin | ( | ) |
Access the start of the blocks.
Gets an iterator pointing to the first block in the cluster.
ConstIterator tawara::MemoryCluster::begin | ( | ) | const |
Access the start of the blocks.
Gets an iterator pointing to the first block in the cluster.
|
protectedvirtual |
Get the size of the blocks in this cluster.
Implements tawara::Cluster.
|
inlinevirtual |
|
inlinevirtual |
Get the number of blocks.
Implements tawara::Cluster.
Definition at line 204 of file memory_cluster.h.
|
inlinevirtual |
Check if there are no blocks.
Implements tawara::Cluster.
Definition at line 202 of file memory_cluster.h.
Iterator tawara::MemoryCluster::end | ( | ) |
Access the end of the blocks.
Gets an iterator pointing beyond the last block in the cluster.
ConstIterator tawara::MemoryCluster::end | ( | ) | const |
Access the end of the blocks.
Gets an iterator pointing beyond the last block in the cluster.
|
inlinevirtual |
Erase the block at the specified iterator.
[in] | position | The position to erase at. |
Definition at line 212 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 219 of file memory_cluster.h.
|
virtual |
Finalise writing of the cluster.
Implements tawara::Cluster.
|
inlinevirtual |
Add a block to this cluster.
The cluster must be in the writable state. This means that write() has been called and finalise() has not been called.
Implements tawara::Cluster.
Definition at line 227 of file memory_cluster.h.
|
protectedvirtual |
Read the blocks in this cluster from the output stream.
Implements tawara::Cluster.
|
protected |
Block storage.
Definition at line 235 of file memory_cluster.h.