Dirac - A Video Codec
Created by the British Broadcasting Corporation.
dirac::TwoDArray< T > Class Template Reference
A template class for two-dimensional arrays.
More...
#include <arrays.h>
Inheritance diagram for dirac::TwoDArray< T >:
[legend]List of all members.Public Member Functions
- TwoDArray ()
- Default constructor.
- TwoDArray (const int height, const int width)
- Constructor.
- TwoDArray (const int height, const int width, T val)
- Constructor.
- virtual ~TwoDArray ()
- Destructor.
- TwoDArray (const TwoDArray< T > &Cpy)
- Copy constructor.
- TwoDArray< T > & operator= (const TwoDArray< T > &rhs)
- Assignment =.
- void Resize (const int height, const int width)
- Resizes the array, deleting the current data.
- element_type & operator[] (const int pos)
- Element access.
- const element_type & operator[] (const int pos) const
- Element access.
- const int LengthX () const
- Returns the width.
- const int LengthY () const
- Returns the height.
- const int FirstX () const
- Returns the index of the first element of a row.
- const int FirstY () const
- Returns the index of the first element of a column.
- const int LastX () const
- Returns the index of the last element of a row.
- const int LastY () const
- Returns the index of the first element of a column.
Private Types
Private Member Functions
- void Init (const int height, const int width)
- Initialise the array.
- void FreeData ()
- Free all the allocated data.
Private Attributes
Detailed Description
template<class T>
class dirac::TwoDArray< T >
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
Constructor & Destructor Documentation
|
Default constructor creates an empty array. |
|
The constructor creates an array of given width height. |
|
The constructor creates an array of given width and length height and initialises it to a value |
|
Destructor frees the data allocated in the constructor. |
|
Copy constructor copies data and metadata. |
Member Function Documentation
template<class T> |
void dirac::TwoDArray< T >::Init |
( |
const int |
height, |
|
|
const int |
width |
|
) |
[private] |
|
|
Assignement = assigns both data and metadata. |
|
Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects. |
|
Accesses the rows of the arrays, which are returned in the form of pointers to the row data NOT OneDArray objects. |
template<class T> |
void dirac::TwoDArray< T >::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.