Pulsar::ManagedStrategies Class Reference

Inserted by Integration class to tell Profile instance it is managed. More...

#include <ManagedStrategies.h>

Inheritance diagram for Pulsar::ManagedStrategies:
Pulsar::Profile::Strategies Reference::Able Reference::HeapTracked

Public Member Functions

 ManagedStrategies (Integration *)
 Construct with a pointer to the container.
 ManagedStrategies (const ManagedStrategies &)
 Copy constructor.
 ManagedStrategies (const ManagedStrategies *)
 Copy constructor for later cloning.
 ~ManagedStrategies ()
 Destructor.
Integrationget_container ()
 Return the container.
ProfileWeightFunctionbaseline () const override
 The implementation of the baseline finding algorithm.
ProfileWeightFunctiononpulse () const override
 The implementation of the on-pulse finding algorithm.
SNRatioEstimatorsnratio () const override
 The implementation of the signal-to-noise ratio calculation.
WidthEstimatorwidth () const override
 The implementation of the pulse width estimator.
ManagedStrategiesclone () const override
 Clone.
bool to_be_cloned () const
 Return true if the container strategy should be cloned.
Public Member Functions inherited from Pulsar::Profile::Strategies
virtual ~Strategies ()
 Destructor.
Public Member Functions inherited from Reference::Able
 Able (const Able &)
Ableoperator= (const Able &)
unsigned get_reference_count () const
Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
HeapTrackedoperator= (const HeapTracked &)
bool __is_on_heap () const

Additional Inherited Members

Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
static void operator delete (void *location, void *ptr)
static void operator delete (void *location)
static size_t get_heap_queue_size ()
Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
void __dereference (bool auto_delete=true) const

Detailed Description

Inserted by Integration class to tell Profile instance it is managed.

This class addresses the issue raised by the separation of Base/ and More/ sub-directories. The end goal is to have each Profile use a centralised set of strategies that are managed by the Archive class. This allows things like setting an unique set of strategies for an individual Archive instance, such that all of the Profile instances that it contains behave in a certain way other than the default. For example, when the Archive contains an observation of a noise diode, it can set the baseline and onpulse estimation strategies to algorithms that are specific to square waves. All Profile instances contained by that Archive will then use those strategies.

More fundamentally, the problem that this class is attempting to solve is failure to apply the Interface Segregation Principle when designing the Profile class. That is, the Profile class is both a container and a set of algorithms (baseline estimation, signal-to-noise ratio calculation, etc.) that are applied to the contents of the container. In principle, the containerly nature of the Profile class is implemented by methods that are defined in Base/ and the algorithmic nature of the Profile class is implemented by methods that are defined in More/. This allows an end-user program to be compiled that uses only the container and needs to be linked only against the library defined in Base/; within psrchive, psredit is an example of such a program.

Now, ProfileWeightFunction and SNRatioEstimator are defined in More/ and therefore an object that is created in Base/ could never create an instance of ProfileWeightFunction or SNRatioEstimator, as this would create a dependence on the library defined in More/. However, it is necessary for the Integration class to inform each of its Profile instances that its strategies are centrally managed. Therefore, this class is just a place-holder. When Profile::get_strategy (defined in More/) is called, this method will check and see that its strategy instance is of type ManagedStrategies. If so, it will set its strategy to the one retrieved from its Integration container via this class.

Member Function Documentation

◆ baseline()

ProfileWeightFunction * ManagedStrategies::baseline ( ) const
overridevirtual

The implementation of the baseline finding algorithm.

Implements Pulsar::Profile::Strategies.

◆ clone()

ManagedStrategies * ManagedStrategies::clone ( ) const
overridevirtual

Clone.

Implements Pulsar::Profile::Strategies.

References ManagedStrategies().

◆ onpulse()

ProfileWeightFunction * ManagedStrategies::onpulse ( ) const
overridevirtual

The implementation of the on-pulse finding algorithm.

Implements Pulsar::Profile::Strategies.

◆ snratio()

SNRatioEstimator * ManagedStrategies::snratio ( ) const
overridevirtual

The implementation of the signal-to-noise ratio calculation.

Implements Pulsar::Profile::Strategies.

◆ width()

WidthEstimator * ManagedStrategies::width ( ) const
overridevirtual

The implementation of the pulse width estimator.

Implements Pulsar::Profile::Strategies.


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

Generated using doxygen 1.14.0