31#ifndef __PSRPARAMETER_H
32#define __PSRPARAMETER_H
41 friend class psrParams;
45 static psrParameter null; // null value returned in some instances
47 // constructor used by derived classes only
48 psrParameter (int ephio_index, bool infit = false, double error = 0.0);
50 virtual ~psrParameter () {};
52 // verifies the index given, throws an exception if invalid, otherwise
53 // returns the index given.
54 static int check (int ephio_index);
56 // return true if this psrParameter may have an associated error
58 // return the error in this parameter
59 double getError () { return error; };
61 // return true if this psrParameter is fitable
63 // return true if the flag is set to fit for this element
64 bool getFit () const { return infit; };
66 // return true if this psrParameter is valid
67 bool valid() const { return ephio_index != -1; }
69 // return the index as in ephio.h
70 int get_ephind () const { return ephio_index; };
72 // set the fit flag to 'infit'
73 void setFit (bool fit) { infit = fit && fitable(); };
76 std::string getString ();
83 void setString (const std::string&);
84 void setDouble (double );
85 void setMJD (const MJD&);
86 void setAngle (const Angle&);
90 int ephio_index; // where in the ephio.h of things this element fits in
91 double error; // the error in the value
92 bool infit; // the 'fit' flag is set for this element
94 // basically a dynamic copy constructor
95 psrParameter* duplicate ();
97 // null constructor is protected
98 psrParameter () { ephio_index = -1; error = 0.0; infit = false; };
101// //////////////////////////////////////////////////////////////////////////
102// //////////////////////////////////////////////////////////////////////////
106// Class defines the appearance/behaviour of psrParams text elements.
108// //////////////////////////////////////////////////////////////////////////
109// //////////////////////////////////////////////////////////////////////////
111class psrString : public psrParameter
114 psrString (int ephind, const std::string& val, bool in_fit=false) :
115 psrParameter (ephind, false, in_fit),
118 std::string getString () { return value; };
119 void setString (const std::string& str) { value = str; };
125// //////////////////////////////////////////////////////////////////////////
126// //////////////////////////////////////////////////////////////////////////
130// Class defines the appearance/behaviour of psrParams real valued elements.
132// //////////////////////////////////////////////////////////////////////////
133// //////////////////////////////////////////////////////////////////////////
134class psrDouble : public psrParameter
137 psrDouble (int ephind, double val,
138 double err = 0.0, bool in_fit = false) :
139 psrParameter (ephind, in_fit, err),
142 double getDouble () { return value; };
143 void setDouble (double val, double err)
144 { value = val; error = err; };
145 void setDouble (double val)
152// //////////////////////////////////////////////////////////////////////////
153// //////////////////////////////////////////////////////////////////////////
157// Class defines the appearance/behaviour of psrParams real valued elements.
159// //////////////////////////////////////////////////////////////////////////
160// //////////////////////////////////////////////////////////////////////////
161class psrInteger : public psrParameter
164 psrInteger (int ephind, int val, int err = 0, bool in_fit = false) :
165 psrParameter (ephind, in_fit, err),
168 int getInteger () { return value; };
169 void setInteger (int val, int err)
170 { value = val; error = err; };
171 void setInteger (int val)
178// //////////////////////////////////////////////////////////////////////////
179// //////////////////////////////////////////////////////////////////////////
183// Class defines the appearance/behaviour of psrParams MJD elements.
185// //////////////////////////////////////////////////////////////////////////
186// //////////////////////////////////////////////////////////////////////////
187class psrMJD : public psrParameter
190 psrMJD (int ephind, const MJD& mjd, double err=0, bool in_fit=false) :
191 psrParameter (ephind, in_fit, err),
194 psrMJD (int ephind, int days, double fracdays,
195 double err=0, bool in_fit=false) :
196 psrParameter (ephind, in_fit, err),
197 value (days, fracdays) { };
199 MJD getMJD () { return value; };
200 void setMJD (const MJD& val, double err)
201 { value = val; error = err; };
202 void setMJD (const MJD& val)
209// //////////////////////////////////////////////////////////////////////////
210// //////////////////////////////////////////////////////////////////////////
214// Class defines the appearance/behaviour of psrParams angular elements.
216// //////////////////////////////////////////////////////////////////////////
217// //////////////////////////////////////////////////////////////////////////
218class psrAngle : public psrParameter
221 psrAngle (int ephind, const Angle& angle, double err=0, bool in_fit=false, bool RA=false) :
222 psrParameter (ephind, in_fit, err),
225 psrAngle (int ephind, double turns, double err=0, bool in_fit=false) :
226 psrParameter (ephind, in_fit, err),
227 value (turns * 2.0 * M_PI) { };
229 Angle getAngle () { return value; };
230 void setAngle (const Angle& val, double err)
231 { value = val; error = err; };
232 void setAngle (const Angle& val)
236 value.setWrapPoint(2*M_PI);
237 if (value.getRadians() < 0) {
238 value.setRadians(value.getRadians()+2*M_PI);