Matrix
Matrix

Represents a Matrix of values (varying size)

Functions
Matrix
Matrix(
uint16 rows,
uint16 columns,
ValueType storedAs,
const ByteStream &data
)

Creates a Matrix object given its size and data

Parameters
rows
uint16

The number of rows that are in the Matrix

columns
uint16

The number of columns that are in the Matrix

storedAs

The ValueType representing how all the values in the Matrix are stored

data
const ByteStream&

The ByteStream that hold the values to be stored in the Matrix

Variables
m_numRows
uint16 m_numRows

The number of rows in the Matrix

m_numColumns
uint16 m_numColumns

The number of columns in the Matrix

m_data
ByteStream m_data

A vector of vectors making the matrix that contains all the data values

m_valuesType
ValueType m_valuesType

How each value within the Matrix is stored

m_valueTypeSize

The size of each values' type within the Matrix

Functions
getBytePos
uint32 getBytePos(
uint16 row,
uint16 col
) const

Gets the byte position to read in data from the m_data ByteStream

Parameters
row
uint16

The row being requested

col
uint16

The column being requested

Exceptions
checkIndex
void checkIndex(
uint16 row,
uint16 col
) const

Checks that the given row and column indicies (0-based) are within range, throwing an exception if not

Parameters
row
uint16

The 0-based row index to check within range

col
uint16

The 0-based column index to check within range

Exceptions
valuesType
ValueType valuesType() const

Gets how each value within the Matrix is stored

Returns

A ValueType representing how each value in the Matrix is stored

rows
uint16 rows() const

Gets the number of rows in the Matrix

Returns

The number of rows in the Matrix

columns
uint16 columns() const

Gets the number of columns in the Matrix

Returns

The number of columns in the Matrix

as_floatAt
float as_floatAt(
uint16 row,
uint16 column
) const

Gets the value stored at the given row and column (0-based), as a 4-byte float

Parameters
row
uint16

The 0-based row index of which to get the value

column
uint16

The 0-based column index of which to get the value

Returns

The value stored at the given row and column, as a float

Exceptions
as_uint16At
uint16 as_uint16At(
uint16 row,
uint16 column
) const

Gets the value stored at the given row and column (0-based), as a 2-byte unsigned integer

Parameters
row
uint16

The 0-based row index of which to get the value

column
uint16

The 0-based column index of which to get the value

Returns

The value stored at the given row and column, as a 2-byte unsigned integer

Exceptions
as_uint8At
uint8 as_uint8At(
uint16 row,
uint16 column
) const

Gets the value stored at the given row and column (0-based), as a 1-byte uint8

Parameters
row
uint16

The 0-based row index of which to get the value

column
uint16

The 0-based column index of which to get the value

Returns

The value stored at the given row and column, as a 1-byte uint8

Exceptions
str
std::string str() const

Creates a string from the Matrix

Returns

A string representing the entire Matrix object (ex. "[[0,0.1,0.2],[1,1.1,1.2],[2,2.1,2.2]]")