field< oT > Class Template Reference
[Field]

A lightweight 2D container for abitrary objects (the objects must have a copy constructor). More...

#include <field_proto.hpp>

List of all members.

Public Types

typedef oT object_type

Public Member Functions

 ~field ()
 field ()
 field (const field &x)
 construct a field from a given field
const fieldoperator= (const field &x)
 construct a field from a given field
 field (const subview_field< oT > &x)
 construct a field from subview_field (e.g. construct a field from a delayed subfield operation)
const fieldoperator= (const subview_field< oT > &x)
 construct a field from subview_field (e.g. construct a field from a delayed subfield operation)
 field (const u32 n_elem_in)
 construct the field with the specified number of elements, assuming a column-major layout
 field (const u32 n_rows_in, const u32 n_cols_in)
 construct the field with the specified dimensions
void set_size (const u32 n_obj_in)
 change the field to have the specified number of elements, assuming a column-major layout (data is not preserved)
void set_size (const u32 n_rows_in, const u32 n_cols_in)
 change the field to have the specified dimensions (data is not preserved)
arma_inline oT & operator[] (const u32 i)
 linear element accessor (treats the field as a vector); no bounds check
arma_inline const oT & operator[] (const u32 i) const
 linear element accessor (treats the field as a vector); no bounds check
arma_inline oT & operator() (const u32 i)
 linear element accessor (treats the field as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline const oT & operator() (const u32 i) const
 linear element accessor (treats the field as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline oT & at (const u32 row, const u32 col)
 element accessor; no bounds check
arma_inline const oT & at (const u32 row, const u32 col) const
 element accessor; no bounds check
arma_inline oT & operator() (const u32 row, const u32 col)
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline const oT & operator() (const u32 row, const u32 col) const
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
subview_field< oT > row (const u32 row_num)
 creation of subview_field (row of a field)
const subview_field< oT > row (const u32 row_num) const
 creation of subview_field (row of a field)
subview_field< oT > col (const u32 col_num)
 creation of subview_field (column of a field)
const subview_field< oT > col (const u32 col_num) const
 creation of subview_field (column of a field)
subview_field< oT > rows (const u32 in_row1, const u32 in_row2)
 creation of subview_field (subfield comprised of specified rows)
const subview_field< oT > rows (const u32 in_row1, const u32 in_row2) const
 creation of subview_field (subfield comprised of specified rows)
subview_field< oT > cols (const u32 in_col1, const u32 in_col2)
 creation of subview_field (subfield comprised of specified columns)
const subview_field< oT > cols (const u32 in_col1, const u32 in_col2) const
 creation of subview_field (subfield comprised of specified columns)
subview_field< oT > subfield (const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2)
 creation of subview_field (subfield with arbitrary dimensions)
const subview_field< oT > subfield (const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2) const
 creation of subview_field (generic submatrix)
void print (const std::string extra_text="") const
 print contents of the field, optionally preceding with a user specified line of text
void fill (const oT &x)
 fill the field with an object
void reset ()
void reset_objects ()
void save (const std::string name, const file_type type=arma_binary) const
void load (const std::string name, const file_type type=auto_detect)

Public Attributes

const u32 n_rows
 number of rows in the field (read-only)
const u32 n_cols
 number of columns in the field (read-only)
const u32 n_elem
 number of elements in the field (read-only)

Private Member Functions

void init (const field< oT > &x)
 construct a field from a given field
void init (const u32 n_rows_in, const u32 n_cols_in)
 internal field construction; if the requested size is small enough, memory from the stack is used. otherwise memory is allocated via 'new'
void delete_objects ()
void create_objects ()

Private Attributes

arma_aligned oT ** mem
 pointer to memory used by the object
arma_aligned oT * mem_local [16]
 Internal memory, to avoid calling the 'new' operator for small amounts of memory.

Friends

class field_aux
class subview_field< oT >


Detailed Description

template<typename oT>
class field< oT >

A lightweight 2D container for abitrary objects (the objects must have a copy constructor).

Definition at line 25 of file field_proto.hpp.


Member Typedef Documentation

template<typename oT >
typedef oT field< oT >::object_type

Definition at line 29 of file field_proto.hpp.


Friends And Related Function Documentation

template<typename oT >
friend class field_aux [friend]

Definition at line 106 of file field_proto.hpp.

template<typename oT >
friend class subview_field< oT > [friend]

Definition at line 107 of file field_proto.hpp.


Member Data Documentation

template<typename oT >
const u32 field< oT >::n_rows

template<typename oT >
const u32 field< oT >::n_cols

template<typename oT >
const u32 field< oT >::n_elem

template<typename oT >
arma_aligned oT** field< oT >::mem [private]

template<typename oT >
arma_aligned oT* field< oT >::mem_local[16] [private]

Internal memory, to avoid calling the 'new' operator for small amounts of memory.

Definition at line 40 of file field_proto.hpp.

Referenced by field< oT >::init(), and field< oT >::~field().