Tawara
0.1.0
|
The in-file Cluster implementation. More...
#include <tawara/file_cluster.h>
Classes | |
class | IteratorBase |
Public Types | |
typedef boost::shared_ptr < FileCluster > | Ptr |
Pointer to a file-based cluster. More... | |
typedef IteratorBase < BlockElement > | Iterator |
File-based cluster 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 | |
FileCluster (uint64_t timecode=0) | |
Construct a new cluster. More... | |
Iterator | begin () |
Access the start of the blocks. More... | |
Iterator | end () |
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 | write (std::ostream &output) |
Element writing. 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... | |
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 | |
std::ostream * | ostream_ |
std::istream * | istream_ |
std::streampos | blocks_start_pos_ |
std::streampos | blocks_end_pos_ |
![]() | |
UIntElement | timecode_ |
std::vector< SilentTrackNumber > | silent_tracks_ |
UIntElement | position_ |
UIntElement | prev_size_ |
bool | writing_ |
![]() | |
tawara::ids::ID | id_ |
std::streampos | offset_ |
The in-file Cluster implementation.
This implementation of the cluster interface stores only a minimal amount of information in memory. When reading, each block is left in the file until needed. When writing, blocks are written to the file immediately as they become available. It provides a lower memory footprint than the MemoryCluster implementation, at the expense of slower block retrieval and addition.
Definition at line 62 of file file_cluster.h.
File-based cluster iterator interface.
This interface provides access to the blocks in the cluster.
Definition at line 234 of file file_cluster.h.
typedef boost::shared_ptr<FileCluster> tawara::FileCluster::Ptr |
Pointer to a file-based cluster.
Definition at line 66 of file file_cluster.h.
tawara::FileCluster::FileCluster | ( | uint64_t | timecode = 0 | ) |
Construct a new cluster.
[in] | timecode | The timecode in the cluster, in the units specified by TimecodeScale. |
Iterator tawara::FileCluster::begin | ( | ) |
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.
|
virtual |
Remove all blocks.
This will not erase the blocks from the file. It will instead overwrite them with a void element, hiding them.
Implements tawara::Cluster.
|
virtual |
Get the number of blocks.
Implements tawara::Cluster.
|
virtual |
Check if there are no blocks.
Implements tawara::Cluster.
Iterator tawara::FileCluster::end | ( | ) |
Access the end of the blocks.
Gets an iterator pointing beyond the last block in the cluster.
|
virtual |
Erase the block at the specified iterator.
This will not erase the block from the file. It will instead overwrite it with a void element, hiding the data.
[in] | position | The position to erase at. |
Erase a range of blocks.
This will not erase the blocks from the file. It will instead overwrite them with a void element, hiding them.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
|
virtual |
Finalise writing of the cluster.
Implements tawara::Cluster.
|
virtual |
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.
|
protectedvirtual |
Read the blocks in this cluster from the output stream.
Implements tawara::Cluster.
|
virtual |
Element writing.
Reimplemented from tawara::Element.
|
protected |
Definition at line 302 of file file_cluster.h.
|
protected |
Definition at line 301 of file file_cluster.h.
|
protected |
Definition at line 300 of file file_cluster.h.
|
protected |
Definition at line 299 of file file_cluster.h.