classPiiTypelessMatrix
#include <PiiMatrix.h>
A two-dimensional dynamic array of non-typed data.
Inherited by PiiMatrix< T,-1,-1 >
Description
This class provides basic functionality for accessing the data of a matrix in a type-agnostic manner. PiiMatrix provides type-specific functions and usual matrix manipulation operations.
PiiTypelessMatrix holds a pointer to a data structure that may be shared among many matrices. The class implements the copy-on-write paradigm; all copies are shallow until a modification is going to happen. The data will be detached in the beginning of all non-const functions.
Constructors and destructor
|
Releases the internal data pointer. |
Public member functions
|
int
|
( )
Returns the maximum number or rows that can be stored in the matrix without reallocation. |
|
void
|
( )
Releases all memory allocated by the matrix and resizes the matrix to 0-by-0. |
|
int
|
( )
Returns the number of columns in the matrix. |
|
int
|
( )
Returns the number of rows in the matrix. |
|
int
|
( )
Returns the number of bytes between the beginnings of successive rows. |
Function details
-
~PiiTypelessMatrix
()[inline]Releases the internal data pointer.
-
int capacity
()[inline]Returns the maximum number or rows that can be stored in the matrix without reallocation.
If the matrix references external data, the capacity is zero.
-
void clear
()Releases all memory allocated by the matrix and resizes the matrix to 0-by-0.
-
int columns
()[inline]Returns the number of columns in the matrix.
-
int rows
()[inline]Returns the number of rows in the matrix.
-
int stride
()[inline]Returns the number of bytes between the beginnings of successive rows.
The stride may be different from sizeof(datatype) * columns() for two reasons:
-
Matrix rows are aligned to four-byte boundaries. For example, if the data type is
char, and the matrix has three columns (three bytes per row), stride will be four. -
The matrix references external data. In this case the stride may be anything, but always larger than or equal to the number of columns.
-
Add a note
Not a single note added yet. Be the first, add yours.