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

A wrapper class for a list of DmTime instances. More...

#include <cheetah/data/DmTime.h>

Inheritance diagram for ska::cheetah::data::DmTime< DmTrialsType >:
Inheritance graph
Collaboration diagram for ska::cheetah::data::DmTime< DmTrialsType >:
Collaboration graph

Public Types

typedef std::list< std::shared_ptr< DmTrialsType > > ContainerType
 
typedef std::shared_ptr< DmTrialsType > ValueType
 
typedef detail::DmTimeSlice< SelfTypeSliceType
 
typedef detail::DmTimeIterator< SelfTypeIterator
 
typedef detail::DmTimeIterator< SelfType const > ConstIterator
 

Public Member Functions

void add (ValueType data)
 Insert a new DmTime object into the buffer. More...
 
void clear ()
 Clear the DmTime.
 
Iterator begin (std::size_t number_dms_per_slice)
 Get an iterator pointing to the first DM trial that iterates over slices of DMs. More...
 
ConstIterator cbegin (std::size_t number_dms_per_slice) const
 
Iterator end ()
 Get an iterator that points to the last DM trial in the buffer. More...
 
ConstIterator cend () const
 
ContainerType const & blocks () const
 Get a reference to the underlying list. More...
 
ContainerType & blocks ()
 

Detailed Description

template<typename DmTrialsType>
class ska::cheetah::data::DmTime< DmTrialsType >

A wrapper class for a list of DmTime instances.

This class provides methods for organising access to a container (currently a list) of DmTime instances. The DmTime list remains sorted at all times. The underlying data structure can be iterated over in blocks of DMs. This allows the DMs to be split up for dispatch to processing algorithms that require the full observation length for processing (e.g. Fdas and Tdas)

Note that the DmTime class does not guarantee that all DmTrials instances it contains are compatible (i.e. contain the same of DMs and are contiguous in time). The Psbc class which wraps a DmTime instance is intended to handle this functionality and act as an aggregation buffer for passing DmTrials between processing algorithms.

A typical use case for the DmTime class is as follows:

//Create a new instance
auto dm_time = DmTime::make_shared();
//Add some sets of DmTrials to the instance. The trials will be inserted
//into the underlying list in time order.
dm_time->add(<DmTrials instance 0>);
dm_time->add(<DmTrials instance 1>);
dm_time->add(<DmTrials instance 2>);
//To access the underlying data in a useful manner, we employ iterators.
//The begin iterator of the DmTime object will return a slice iterator
//that iterates over all the underlying DMs in groups defined by the user.
for (auto it = dm_time->begin(<number of DMs per slice>);
it != dm_time->end();
++it)
{
//If we wish to iterate over the slice we do the following
for (auto dm_it = *(it)->begin();
dm_it != *(it)->end();
++dm_it)
{
...do somthing with each DmTrial...
}
}

Definition at line 14 of file DmTimeIterator.h.

Member Function Documentation

◆ add()

template<typename DmTrialsType >
void ska::cheetah::data::DmTime< DmTrialsType >::add ( ValueType  data)

Insert a new DmTime object into the buffer.

The shared_ptr is inserted into the underlying list in order based upon the start_time() method of the DmTime object.

Parameters
[in]dataThe data to be added

Definition at line 61 of file DmTime.cpp.

62 {
63  //First determine where in the list this block should be
64  auto it = std::upper_bound(_data.begin(),_data.end(),data,detail::DmTimeStartTimeComparitor<DmTrialsType>());
65 
66  //Insert it in an ordered manner
67  _data.insert(it,data);
68 }

◆ begin()

template<typename DmTrialsType >
DmTime< DmTrialsType >::Iterator ska::cheetah::data::DmTime< DmTrialsType >::begin ( std::size_t  number_dms_per_slice)

Get an iterator pointing to the first DM trial that iterates over slices of DMs.

Parameters
[in]number_dms_per_sliceThe number DM trials per slice
Returns
An iterator that dereferences to a DmTimeSlice object

Definition at line 77 of file DmTime.cpp.

78 {
79  return Iterator(0, number_dms_per_slice, this->shared_from_this());
80 }

◆ blocks()

template<typename DmTrialsType >
DmTime< DmTrialsType >::ContainerType const & ska::cheetah::data::DmTime< DmTrialsType >::blocks ( ) const

Get a reference to the underlying list.

Returns
A constant reference to the underlying list object

Definition at line 105 of file DmTime.cpp.

106 {
107  return _data;
108 }

◆ end()

template<typename DmTrialsType >
DmTime< DmTrialsType >::Iterator ska::cheetah::data::DmTime< DmTrialsType >::end ( )

Get an iterator that points to the last DM trial in the buffer.

Returns
An iterator that dereferences to a DmTimeSlice object

Definition at line 89 of file DmTime.cpp.

90 {
91  if (_data.empty())
92  return Iterator(0,0,this->shared_from_this());
93  return Iterator(_data.front()->size(),0,this->shared_from_this());
94 }

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