Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Public Types | Public Member Functions | List of all members
ska::cheetah::data::DataSequence2D< Cpu, T > Class Template Reference

A CPU implementation of the DataSequence2D. More...

#include <cheetah/data/DataSequence2D.h>

Collaboration diagram for ska::cheetah::data::DataSequence2D< Cpu, T >:
Collaboration graph

Public Types

typedef T DataType
 
typedef DataSequence2DFastIterator< Cpu, DataType > Iterator
 
typedef DataSequence2DFastIterator< Cpu, const DataType > ConstIterator
 
typedef DataSequence2DPartialIterator< Cpu, DataType > PartialIterator
 

Public Member Functions

 DataSequence2D ()
 Create a zero-sized DataSequence2D.
 
 DataSequence2D (std::size_t fast_axis_length, std::size_t slow_axis_length)
 Create a pre-sized DataSequence2D filled with the default constructor of T. More...
 
 DataSequence2D (std::size_t fast_axis_length, std::size_t slow_axis_length, const T &fill)
 Create a pre-sized DataSequence2D, filled with copies of a provided T. More...
 
 ~DataSequence2D ()
 Free memory associated with DataSequence2D.
 
std::size_t fast_axis_length () const
 Get the current fast_axis_length.
 
std::size_t slow_axis_length () const
 Get the current slow_axis_length.
 
std::size_t size () const
 the number fo elements in the data
 
void resize (std::size_t fast_axis_length, std::size_t slow_axis_length, const T &fill)
 Destructive resize of underlying data. Fill with copies. More...
 
void resize (std::size_t fast_axis_length, std::size_t slow_axis_length)
 Destructive resize of underlying data. More...
 
T const * data () const
 access a read-only pointer to the data
 
T * data ()
 access a pointer to the data
 
Iterator begin ()
 get the default Iterator More...
 
ConstIterator begin () const
 get the default Iterator More...
 
ConstIterator cbegin () const
 get the default Iterator More...
 
Iterator end ()
 get the default end Iterator More...
 
ConstIterator end () const
 get the default end Iterator More...
 
ConstIterator cend () const
 get the default end Iterator More...
 
PartialIterator slice (std::size_t fbegin, std::size_t fend, std::size_t sbegin, std::size_t send)
 Return an Iterator to a slice of the datasequence. The partial Iterator returned will iterate only over the range specified, from fbegin to fend on the fast axis and from sbegin to send on the slow axis. Otherwise the Iterator behaves as if it were a FastIterator over a smaller DataSequence2D of length (fend-fbegin) by (send-sbegin) More...
 

Detailed Description

template<typename T>
class ska::cheetah::data::DataSequence2D< Cpu, T >

A CPU implementation of the DataSequence2D.

A two dimensional data structure, guaraneteed to be stored in continuous memory. Has a "fast" and "slow" axis. The "fast" axis is the index that moves fastest as one moves through the memory, and the "slow" axis moves slowest as one moves through the memory. Typically the "fast" axis is equivilent to "columns" and the slow axis is "rows"

The index to the memory is such that memory index = FastAxis + fast_axis_length*SlowAxis

Allows access to a pointer of type T*, but may be backed by any data structure.

Template Parameters
Tis the type of the pointer stored.

Definition at line 80 of file DataSequence2D.h.

Constructor & Destructor Documentation

◆ DataSequence2D() [1/2]

template<typename T >
ska::cheetah::data::DataSequence2D< Cpu, T >::DataSequence2D ( std::size_t  fast_axis_length,
std::size_t  slow_axis_length 
)

Create a pre-sized DataSequence2D filled with the default constructor of T.

Parameters
fast_axis_lengththe length of the fast axis
slow_axis_lengththe length of the slow axis.

Definition at line 32 of file DataSequence2D.cpp.

33  : _fast_axis_length(fast_axis_length)
34  , _slow_axis_length(slow_axis_length)
35  , _data()
36 {
37  this->_data.resize(fast_axis_length*slow_axis_length);
38 }
std::size_t fast_axis_length() const
Get the current fast_axis_length.
std::size_t slow_axis_length() const
Get the current slow_axis_length.

◆ DataSequence2D() [2/2]

template<typename T >
ska::cheetah::data::DataSequence2D< Cpu, T >::DataSequence2D ( std::size_t  fast_axis_length,
std::size_t  slow_axis_length,
const T &  fill 
)

Create a pre-sized DataSequence2D, filled with copies of a provided T.

Parameters
fast_axis_lengththe length of the fast axis
slow_axis_lengththe length of the slow axis.
fillobject to be copied.

Definition at line 41 of file DataSequence2D.cpp.

42  : _fast_axis_length(fast_axis_length)
43  , _slow_axis_length(slow_axis_length)
45 {
46 }
std::size_t fast_axis_length() const
Get the current fast_axis_length.
std::size_t slow_axis_length() const
Get the current slow_axis_length.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
DataSequence2D< Cpu, T >::Iterator ska::cheetah::data::DataSequence2D< Cpu, T >::begin ( )

get the default Iterator

iterates over fast axis first, then slow axis

Definition at line 84 of file DataSequence2D.cpp.

84  {
85  return Iterator(*this);
86 }

◆ begin() [2/2]

template<typename T >
DataSequence2D< Cpu, T >::ConstIterator ska::cheetah::data::DataSequence2D< Cpu, T >::begin ( ) const

get the default Iterator

iterates over fast axis first, then slow axis

Definition at line 89 of file DataSequence2D.cpp.

89  {
90  return ConstIterator(*this);
91 }

◆ cbegin()

template<typename T >
DataSequence2D< Cpu, T >::ConstIterator ska::cheetah::data::DataSequence2D< Cpu, T >::cbegin ( ) const

get the default Iterator

iterates over fast axis first, then slow axis

Definition at line 94 of file DataSequence2D.cpp.

94  {
95  return ConstIterator(*this);
96 }

◆ cend()

template<typename T >
DataSequence2D< Cpu, T >::ConstIterator ska::cheetah::data::DataSequence2D< Cpu, T >::cend ( ) const

get the default end Iterator

iterates over fast axis first, then slow axis

Definition at line 110 of file DataSequence2D.cpp.

110  {
111  return ConstIterator(*this)+this->_data.size();
112 }

◆ end() [1/2]

template<typename T >
DataSequence2D< Cpu, T >::Iterator ska::cheetah::data::DataSequence2D< Cpu, T >::end ( )

get the default end Iterator

iterates over fast axis first, then slow axis

Definition at line 100 of file DataSequence2D.cpp.

100  {
101  return Iterator(*this)+this->_data.size();
102 }

◆ end() [2/2]

template<typename T >
DataSequence2D< Cpu, T >::ConstIterator ska::cheetah::data::DataSequence2D< Cpu, T >::end ( ) const

get the default end Iterator

iterates over fast axis first, then slow axis

Definition at line 105 of file DataSequence2D.cpp.

105  {
106  return ConstIterator(*this)+this->_data.size();
107 }

◆ resize() [1/2]

template<typename T >
void ska::cheetah::data::DataSequence2D< Cpu, T >::resize ( std::size_t  fast_axis_length,
std::size_t  slow_axis_length,
const T &  fill 
)

Destructive resize of underlying data. Fill with copies.

Parameters
fast_axis_lengthnew fast axis length
slow_axis_lengthnew slow axis length
fillValue to copy to fill underlying array.

Definition at line 61 of file DataSequence2D.cpp.

62 {
63  this->_fast_axis_length = fast_axis_length;
64  this->_slow_axis_length = slow_axis_length;
65  this->_data.resize(this->_fast_axis_length*this->_slow_axis_length);
66  std::fill(this->_data.begin(),this->_data.end(), fill);
67 }
std::size_t fast_axis_length() const
Get the current fast_axis_length.
std::size_t slow_axis_length() const
Get the current slow_axis_length.

◆ resize() [2/2]

template<typename T >
void ska::cheetah::data::DataSequence2D< Cpu, T >::resize ( std::size_t  fast_axis_length,
std::size_t  slow_axis_length 
)

Destructive resize of underlying data.

the contents of the memory are not defined after a call to this method.

Parameters
fast_axis_lengthnew fast axis length
slow_axis_lengthnew slow axis length
fillValue to copy to fill underlying array.

Definition at line 70 of file DataSequence2D.cpp.

71 {
72  this->_fast_axis_length = fast_axis_length;
73  this->_slow_axis_length = slow_axis_length;
74  this->_data.resize(this->_fast_axis_length*this->_slow_axis_length);
75 }
std::size_t fast_axis_length() const
Get the current fast_axis_length.
std::size_t slow_axis_length() const
Get the current slow_axis_length.

◆ slice()

template<typename T >
DataSequence2D< Cpu, T >::PartialIterator ska::cheetah::data::DataSequence2D< Cpu, T >::slice ( std::size_t  fbegin,
std::size_t  fend,
std::size_t  sbegin,
std::size_t  send 
)

Return an Iterator to a slice of the datasequence. The partial Iterator returned will iterate only over the range specified, from fbegin to fend on the fast axis and from sbegin to send on the slow axis. Otherwise the Iterator behaves as if it were a FastIterator over a smaller DataSequence2D of length (fend-fbegin) by (send-sbegin)

  • fbegin the fast axis to start at (inclusive)
  • fend the fast axis to end at (not inclusive)
  • sbegin the slow axis to start at (inclusive)
  • send the slow axis to end at (not inclusive)

Definition at line 115 of file DataSequence2D.cpp.

118  {
119 
120  BOOST_ASSERT(fend <= this->fast_axis_length());
121  BOOST_ASSERT(send <= this->slow_axis_length());
122 
123  return DataSequence2DPartialIterator<Cpu,T>(*this, fbegin,fend,sbegin,send);
124 }
std::size_t fast_axis_length() const
Get the current fast_axis_length.
std::size_t slow_axis_length() const
Get the current slow_axis_length.

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