Predictor.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2007 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/Util/tempo/Pulsar/Predictor.h
10
11#ifndef __PulsarPredictor_h
12#define __PulsarPredictor_h
13
14#include "Reference.h"
15#include "Phase.h"
16#include "MJD.h"
17#include "Configuration.h"
18
19#include <stdio.h>
20
21namespace Pulsar {
22
23 class Generator;
24
26
28 class Predictor : public Reference::Able {
29
30 public:
31
42
45
47 static bool verbose;
48
50 virtual Predictor* clone () const = 0;
51
53 virtual Generator* generator () const = 0;
54
56
57 virtual void insert (const Predictor*) = 0;
58
60 virtual void keep (const std::vector<MJD>& epochs) = 0;
61
63 virtual bool matches (const Predictor*) const = 0;
64
66 virtual void set_observing_frequency (long double MHz) = 0;
67
69 virtual long double get_observing_frequency () const = 0;
70
72 virtual Phase phase (const MJD& t) const = 0;
73
75 virtual MJD iphase (const Phase& phase, const MJD* guess = 0) const = 0;
76
78 virtual long double frequency (const MJD& t) const = 0;
79
81 virtual Phase dispersion (const MJD &t, long double MHz) const = 0;
82
84 virtual void load (FILE*) = 0;
85
87 virtual void unload (FILE*) const = 0;
88
90 virtual void load_file (const std::string& filename);
92 virtual void unload_file (const std::string& filename) const;
93
95 static void children (std::vector< Reference::To<Predictor> >&);
96
97 };
98
99 std::ostream& operator<< (std::ostream& ostr, Predictor::Policy p);
100
101 std::istream& operator>> (std::istream& istr, Predictor::Policy& p);
102}
103
104#endif
A configurable parameter.
Definition Configuration.h:83
Class for representing modified Julian dates with high precision.
Definition MJD.h:23
Generator of functions that predict pulse phase.
Definition Generator.h:26
Functions that predict pulse phase.
Definition Predictor.h:28
Policy
Policy for creating new predictors.
Definition Predictor.h:34
@ Default
Generate a new predictor using the default generator.
Definition Predictor.h:38
@ Input
Clone the input predictor.
Definition Predictor.h:36
@ Ephemeris
Generate a new predictor based on the input ephemeris.
Definition Predictor.h:40
virtual void insert(const Predictor *)=0
Add the information from the supplied predictor to self.
virtual Phase phase(const MJD &t) const =0
Return the phase, given the epoch.
virtual long double frequency(const MJD &t) const =0
Return the spin frequency, given the epoch.
virtual Predictor * clone() const =0
Return a new, copy constructed instance of self.
static void children(std::vector< Reference::To< Predictor > > &)
Factory helper creates a vector of pointers to derived class instances.
Definition Predictor_children.C:22
virtual void unload_file(const std::string &filename) const
Unload to the specified file.
Definition Predictor.C:17
virtual void keep(const std::vector< MJD > &epochs)=0
Keep only the components required to span the given epochs.
virtual Generator * generator() const =0
Return a new Generator set up to produce a new Predictor like self.
virtual void load(FILE *)=0
Load from an open stream.
virtual void load_file(const std::string &filename)
Load from the specified file.
Definition Predictor.C:11
virtual void set_observing_frequency(long double MHz)=0
Set the observing frequency at which phase and time are related.
static bool verbose
Verbosity flag.
Definition Predictor.h:47
virtual MJD iphase(const Phase &phase, const MJD *guess=0) const =0
Return the epoch, given the phase and, optionally, a first guess.
static Configuration::Parameter< Policy > & get_policy()
Policy for creating new predictors.
virtual void unload(FILE *) const =0
Unload to an open stream.
virtual long double get_observing_frequency() const =0
Get the observing frequency at which phase and epoch are related.
virtual Phase dispersion(const MJD &t, long double MHz) const =0
Return the phase correction for dispersion delay.
virtual bool matches(const Predictor *) const =0
Return true if the Predictor configuration matches this.
Manages Reference::To references to the instance.
Definition ReferenceAble.h:35
Template class manages Reference::Able objects.
Definition ReferenceTo.h:25

Generated using doxygen 1.14.0