Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends

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.

Classes

class  const_iterator
class  iterator

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)
template<typename oT2 >
void copy_size (const field< oT2 > &x)
 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 (to the cout stream), //! optionally preceding with a user specified line of text. //! the field class preserves the stream's flags //! but the associated operator<< function for type oT //! may still modify the stream's parameters. //! NOTE: this function assumes that type oT can be printed, //! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)" //! has been defined.
void print (std::ostream &user_stream, const std::string extra_text="") const
 print contents of the field to a user specified stream, //! optionally preceding with a user specified line of text. //! the field class preserves the stream's flags //! but the associated operator<< function for type oT //! may still modify the stream's parameters. //! NOTE: this function assumes that type oT can be printed, //! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)" //! has been defined.
void fill (const oT &x)
 fill the field with an object
void reset ()
void reset_objects ()
bool save (const std::string name, const file_type type=arma_binary, const bool print_status=true) const
bool save (std::ostream &os, const file_type type=arma_binary, const bool print_status=true) const
bool load (const std::string name, const file_type type=auto_detect, const bool print_status=true)
bool load (std::istream &is, const file_type type=auto_detect, const bool print_status=true)
bool quiet_save (const std::string name, const file_type type=arma_binary) const
bool quiet_save (std::ostream &os, const file_type type=arma_binary) const
bool quiet_load (const std::string name, const file_type type=auto_detect)
bool quiet_load (std::istream &is, const file_type type=auto_detect)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const

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 27 of file field_proto.hpp.


Member Typedef Documentation

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

Definition at line 31 of file field_proto.hpp.


Friends And Related Function Documentation

template<typename oT>
friend class field_aux [friend]

Definition at line 175 of file field_proto.hpp.

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

Definition at line 176 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 41 of file field_proto.hpp.

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