Audio Processing Framework (APF) version 0.5.0
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
apf::fixed_matrix< T, Allocator > Class Template Reference

Two-dimensional data storage for row- and column-wise access. More...

#include <apf/container.h>

Inheritance diagram for apf::fixed_matrix< T, Allocator >:
Inheritance graph
[legend]

Classes

class  channels_iterator
 Iterator over fixed_matrix::Channels. More...
 
class  slices_iterator
 Iterator over fixed_matrix::Slices. More...
 

Public Types

using Channel = has_begin_and_end< pointer >
 Proxy class for returning one channel of the fixed_matrix. More...
 
using channel_iterator = typename Channel::iterator
 Iterator within a Channel. More...
 
using Slice = has_begin_and_end< stride_iterator< channel_iterator > >
 Proxy class for returning one slice of the fixed_matrix. More...
 
using slice_iterator = typename Slice::iterator
 Iterator within a Slice. More...
 

Public Member Functions

 fixed_matrix (const Allocator &a=Allocator())
 Default constructor. More...
 
 fixed_matrix (fixed_matrix &&)=default
 
 fixed_matrix (const fixed_matrix &)=delete
 
fixed_matrixoperator= (const fixed_matrix &)=delete
 
fixed_matrixoperator= (fixed_matrix &&)=delete
 
 fixed_matrix (size_type max_channels, size_type max_slices, const Allocator &a=Allocator())
 Constructor. More...
 
void initialize (size_type max_channels, size_type max_slices)
 Allocate memory for max_channels x max_slices elements and default-construct them. More...
 
template<typename Ch >
void set_channels (const Ch &ch)
 Copy channels from another matrix. More...
 
pointer const * get_channel_ptrs () const
 Get array of pointers to the channels. More...
 
- Public Member Functions inherited from apf::fixed_vector< T, std::allocator< T > >
 fixed_vector (fixed_vector &&)=default
 
 fixed_vector (const fixed_vector &)=delete
 
 fixed_vector (Args &&... args)
 Constructor that forwards everything except if first type is integral. More...
 
 fixed_vector (size_type n)
 
 fixed_vector (Size n, Arg &&arg, const std::allocator< T > &a)
 
 fixed_vector (Size n, Args &&... args)
 Constructor from size and initialization arguments. More...
 
 fixed_vector (std::initializer_list< value_type > il, const std::allocator< T > &a=std::allocator< T >())
 
fixed_vectoroperator= (const fixed_vector &)=delete
 
fixed_vectoroperator= (fixed_vector &&)=delete
 
void resize (size_type n)
 Reserve space for new elements and default-construct them. More...
 
void reserve (size_type n)
 Reserve space for new elements. More...
 
void emplace_back (Args &&... args)
 Construct element at the end. More...
 

Public Attributes

has_begin_and_end< channels_iteratorchannels
 Access to Channels; use channels.begin() and channels.end() More...
 
has_begin_and_end< slices_iteratorslices
 Access to Slices; use slices.begin() and slices.end() More...
 

Detailed Description

template<typename T, typename Allocator = std::allocator<T>>
class apf::fixed_matrix< T, Allocator >

Two-dimensional data storage for row- and column-wise access.

The two dimensions have following properties:

  1. Channel
  2. Slice
Template Parameters
TType of stored data

Definition at line 341 of file container.h.

Member Typedef Documentation

◆ Channel

template<typename T , typename Allocator = std::allocator<T>>
using apf::fixed_matrix< T, Allocator >::Channel = has_begin_and_end<pointer>

Proxy class for returning one channel of the fixed_matrix.

Definition at line 351 of file container.h.

◆ channel_iterator

template<typename T , typename Allocator = std::allocator<T>>
using apf::fixed_matrix< T, Allocator >::channel_iterator = typename Channel::iterator

Iterator within a Channel.

Definition at line 353 of file container.h.

◆ Slice

template<typename T , typename Allocator = std::allocator<T>>
using apf::fixed_matrix< T, Allocator >::Slice = has_begin_and_end<stride_iterator<channel_iterator> >

Proxy class for returning one slice of the fixed_matrix.

Definition at line 356 of file container.h.

◆ slice_iterator

template<typename T , typename Allocator = std::allocator<T>>
using apf::fixed_matrix< T, Allocator >::slice_iterator = typename Slice::iterator

Iterator within a Slice.

Definition at line 358 of file container.h.

Constructor & Destructor Documentation

◆ fixed_matrix() [1/2]

template<typename T , typename Allocator = std::allocator<T>>
apf::fixed_matrix< T, Allocator >::fixed_matrix ( const Allocator &  a = Allocator())
inlineexplicit

Default constructor.

Only initialize() makes sense after this.

Definition at line 365 of file container.h.

References apf::fixed_matrix< T, Allocator >::initialize().

◆ fixed_matrix() [2/2]

template<typename T , typename Allocator = std::allocator<T>>
apf::fixed_matrix< T, Allocator >::fixed_matrix ( size_type  max_channels,
size_type  max_slices,
const Allocator &  a = Allocator() 
)
inline

Constructor.

Parameters
max_channelsNumber of Channels
max_slicesNumber of Slices
aOptional allocator

Definition at line 381 of file container.h.

References apf::fixed_matrix< T, Allocator >::initialize().

Member Function Documentation

◆ initialize()

template<typename T , typename Allocator = std::allocator<T>>
void apf::fixed_matrix< T, Allocator >::initialize ( size_type  max_channels,
size_type  max_slices 
)
inline

Allocate memory for max_channels x max_slices elements and default-construct them.

Precondition
empty() == true

Definition at line 391 of file container.h.

References apf::fixed_matrix< T, Allocator >::channels, and apf::fixed_vector< T, Allocator >::resize().

Referenced by apf::fixed_matrix< T, Allocator >::fixed_matrix().

◆ set_channels()

template<typename T , typename Allocator >
template<typename Ch >
void apf::fixed_matrix< T, Allocator >::set_channels ( const Ch &  ch)

Copy channels from another matrix.

Parameters
chchannels (or slices) to copy from another fixed_matrix
Note
A plain copy may be faster with std::copy() from fixed_matrix::begin() to fixed_matrix::end().
Anyway, a plain copy of a fixed_matrix is rarely needed, the main reason for this function is that if you use slices instead of channels, you'll get a transposed matrix.
Precondition
The dimensions must be correct beforehand!
Warning
If the dimensions are not correct, bad things will happen!

Definition at line 589 of file container.h.

Referenced by apf::mimoprocessor_file_io().

◆ get_channel_ptrs()

template<typename T , typename Allocator = std::allocator<T>>
pointer const * apf::fixed_matrix< T, Allocator >::get_channel_ptrs ( ) const
inline

Get array of pointers to the channels.

This can be useful to interact with functions which use plain pointers instead of iterators.

Definition at line 413 of file container.h.

Referenced by apf::mimoprocessor_file_io().

Member Data Documentation

◆ channels

template<typename T , typename Allocator = std::allocator<T>>
has_begin_and_end<channels_iterator> apf::fixed_matrix< T, Allocator >::channels

Access to Channels; use channels.begin() and channels.end()

Definition at line 416 of file container.h.

Referenced by apf::fixed_matrix< T, Allocator >::initialize().

◆ slices

template<typename T , typename Allocator = std::allocator<T>>
has_begin_and_end<slices_iterator> apf::fixed_matrix< T, Allocator >::slices

Access to Slices; use slices.begin() and slices.end()

Definition at line 418 of file container.h.

Referenced by apf::mimoprocessor_file_io().


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