libdcp
Public Member Functions | Private Attributes | List of all members
dcp::ArrayData Class Reference

Class to hold an arbitrary block of data. More...

#include <array_data.h>

Inheritance diagram for dcp::ArrayData:
dcp::Data

Public Member Functions

 ArrayData (int size)
 
 ArrayData (uint8_t const *data, int size)
 
 ArrayData (boost::shared_array< uint8_t > data, int size)
 
 ArrayData (boost::filesystem::path file)
 
uint8_t const * data () const override
 
uint8_t * data () override
 
int size () const override
 
void set_size (int s)
 
- Public Member Functions inherited from dcp::Data
void write (boost::filesystem::path file) const
 
void write_via_temp (boost::filesystem::path temp, boost::filesystem::path final) const
 

Private Attributes

boost::shared_array< uint8_t > _data
 
int _size = 0
 

Detailed Description

Class to hold an arbitrary block of data.

Definition at line 54 of file array_data.h.

Constructor & Destructor Documentation

◆ ArrayData() [1/2]

dcp::ArrayData::ArrayData ( boost::shared_array< uint8_t >  data,
int  size 
)

Create an ArrayData by copying a shared_array<>

Parameters
datashared_array<> to copy (the shared_array<> is copied, not the data)
sizeSize of data in bytes

◆ ArrayData() [2/2]

ArrayData::ArrayData ( boost::filesystem::path  file)
explicit

Create an ArrayData by reading the contents of a file

Parameters
fileFilename to read

Definition at line 81 of file array_data.cc.

Member Function Documentation

◆ set_size()

void dcp::ArrayData::set_size ( int  s)
inline

Set the size that will be returned from size()

Definition at line 90 of file array_data.h.

◆ size()

int dcp::ArrayData::size ( ) const
inlineoverridevirtual
Returns
size of the data in _data, or whatever was last passed to a set_size() call

Implements dcp::Data.

Definition at line 85 of file array_data.h.

Member Data Documentation

◆ _size

int dcp::ArrayData::_size = 0
private

amount of ‘valid’ data in _data; the array may be larger

Definition at line 97 of file array_data.h.


The documentation for this class was generated from the following files: