Scopira 20080306

scopira::tool::basic_matrix< T > Class Template Reference

#include <array.h>

Inheritance diagram for scopira::tool::basic_matrix< T >:
scopira::tool::basic_array< T >

List of all members.

Public Member Functions

 basic_matrix (void)
 basic_matrix (size_t w, size_t h)
void resize (size_t w, size_t h)
size_t width (void) const
size_t height (void) const
void set (size_t x, size_t y, const T &v)
const T & get (size_t x, size_t y) const
T & get (size_t x, size_t y)
const T & operator() (size_t x, size_t y) const
T & operator() (size_t x, size_t y)

Protected Member Functions

void resize (size_t newlen)

Protected Attributes

size_t dm_w
size_t dm_h

Detailed Description

template<class T>
class scopira::tool::basic_matrix< T >

A basic_matrix adds 2 dimentional (matrix) like operations to basic_array.

Author:
Aleksander Demko

Constructor & Destructor Documentation

template<class T >
scopira::tool::basic_matrix< T >::basic_matrix ( void  ) [inline]

Makes a 0 by 0 matrix.

Author:
Aleksander Demko
template<class T >
scopira::tool::basic_matrix< T >::basic_matrix ( size_t  w,
size_t  h 
) [inline]

Makes a w by h matrix.

Author:
Aleksander Demko

Member Function Documentation

template<class T >
const T& scopira::tool::basic_matrix< T >::get ( size_t  x,
size_t  y 
) const [inline]

Individual element setter

Author:
Aleksander Demko
template<class T >
T& scopira::tool::basic_matrix< T >::get ( size_t  x,
size_t  y 
) [inline]

Individual element setter

Author:
Aleksander Demko
template<class T >
size_t scopira::tool::basic_matrix< T >::height ( void  ) const [inline]

Returns the height of the matrix.

Author:
Aleksander Demko
template<class T >
T& scopira::tool::basic_matrix< T >::operator() ( size_t  x,
size_t  y 
) [inline]

Nice reference access

Author:
Aleksander Demko
template<class T >
const T& scopira::tool::basic_matrix< T >::operator() ( size_t  x,
size_t  y 
) const [inline]

Nice reference access

Author:
Aleksander Demko
template<class T >
void scopira::tool::basic_matrix< T >::resize ( size_t  newlen) [inline, protected]

Resizes the array. Please note the following: 1) If the new size is the current size, nothing will be done. 2) Resizes are destructive. All old values will be lost, and a new array is constructed (following the initialization rules specified in the constructor description)

Parameters:
newlenthe new length
Author:
Aleksander Demko

Reimplemented from scopira::tool::basic_array< T >.

template<class T >
void scopira::tool::basic_matrix< T >::resize ( size_t  w,
size_t  h 
) [inline]

Resizes the matrix to the new, given dimensions. Please see basic_array::resize for what happens to the data.

Author:
Aleksander Demko
template<class T >
void scopira::tool::basic_matrix< T >::set ( size_t  x,
size_t  y,
const T &  v 
) [inline]

Individual element setter

Author:
Aleksander Demko
template<class T >
size_t scopira::tool::basic_matrix< T >::width ( void  ) const [inline]

Returns the width of the matrix.

Author:
Aleksander Demko

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