Dirac - A Video Codec

Created by the British Broadcasting Corporation.


Public Member Functions | Private Types | Private Member Functions | Private Attributes
dirac::TwoDArray Class Reference

A template class for two-dimensional arrays. More...

#include <arrays.h>

Inheritance diagram for dirac::TwoDArray:
Inheritance graph
[legend]

List of all members.

Public Member Functions

Private Types

Private Member Functions

Private Attributes


Detailed Description

A template class to do two-d arrays, so that explicit memory (de-)allocation is not required. Only zero-based arrays are currently supported so that access is fast. Accessing elements along a row is therefore much faster than accessing them along a column. Rows are contiguous in memory, so array[y][x] is equivalent to array[0][x+y*LengthX()].


Member Typedef Documentation

typedef T* dirac::TwoDArray::element_type [private]

Constructor & Destructor Documentation

dirac::TwoDArray::TwoDArray ( ) [inline]

Default constructor creates an empty array.

dirac::TwoDArray::TwoDArray ( const int  height,
const int  width 
) [inline]

The constructor creates an array of given width height.

dirac::TwoDArray::TwoDArray ( const int  height,
const int  width,
val 
)

The constructor creates an array of given width and length height and initialises it to a value

virtual dirac::TwoDArray::~TwoDArray ( ) [inline, virtual]

Destructor frees the data allocated in the constructor.

dirac::TwoDArray::TwoDArray ( const TwoDArray< T > &  Cpy)

Copy constructor copies data and metadata.

References m_first_x, m_first_y, m_last_x, m_last_y, and m_array_of_rows.


Member Function Documentation

bool dirac::TwoDArray::CopyContents ( TwoDArray< T > &  out) const

Copy contents of array into output array retaining the dimensions of the output array. If output array is larger that array then pad with last true value. Return true is copy was successful

References m_length_y, m_length_x, and m_array_of_rows.

void dirac::TwoDArray::Fill ( val)

Initialise the array with the val provided.

int dirac::TwoDArray::FirstX ( ) const [inline]
int dirac::TwoDArray::FirstY ( ) const [inline]
void dirac::TwoDArray::FreeData ( ) [private]
void dirac::TwoDArray::Init ( const int  height,
const int  width 
) [private]
int dirac::TwoDArray::LastX ( ) const [inline]
int dirac::TwoDArray::LastY ( ) const [inline]
int dirac::TwoDArray::LengthX ( ) const [inline]

Referenced by dirac::operator>>().

int dirac::TwoDArray::LengthY ( ) const [inline]

Referenced by dirac::operator>>().

TwoDArray< T > & dirac::TwoDArray::operator= ( const TwoDArray< T > &  rhs)

Assignement = assigns both data and metadata.

References m_first_x, m_first_y, m_last_x, m_last_y, and m_array_of_rows.

element_type& dirac::TwoDArray::operator[] ( const int  pos) [inline]

Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects.

const element_type& dirac::TwoDArray::operator[] ( const int  pos) const [inline]

Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects.

void dirac::TwoDArray::Resize ( const int  height,
const int  width 
)

Member Data Documentation


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

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.