HOPS
HOPS class reference
MHO_MK4FringeExport.hh
Go to the documentation of this file.
1 #ifndef MHO_MK4FringeExport_HH__
2 #define MHO_MK4FringeExport_HH__
3 
4 //forward declaration of mk4 structs
5 //we do this to keep the mk4 structures from 'leaking' into the new code via includes,
6 //We want to make sure any interface to the old mk4 IO libraries is kept only
7 //within the MK4Interface library.
8 #ifndef HOPS3_USE_CXX
9 extern "C"
10 {
11 #endif
12 
16  struct type_000;
20  struct type_200;
24  struct type_201;
28  struct type_202;
32  struct type_203;
36  struct type_204;
40  struct type_205;
44  struct type_206;
48  struct type_207;
52  struct type_208;
56  struct type_210;
60  struct type_212;
64  struct type_220;
68  struct type_221;
72  struct type_222;
76  struct type_230;
80  struct mk4_fringe;
84  struct sky_coord;
88  struct date;
92  struct ch_struct;
93 
94 #ifndef HOPS3_USE_CXX
95 }
96 #endif
97 
98 #include <iostream>
99 #include <string>
100 
101 //data/config passing classes
102 #include "MHO_ContainerStore.hh"
103 #include "MHO_DirectoryInterface.hh"
104 #include "MHO_JSONHeaderWrapper.hh"
105 #include "MHO_OperatorToolbox.hh"
106 #include "MHO_ParameterStore.hh"
107 #include "MHO_Tokenizer.hh"
108 
109 //needed to read hops files and extract objects from scan dir
110 #include "MHO_ScanDataStore.hh"
111 
112 namespace hops
113 {
114 
124 {
125  public:
127  virtual ~MHO_MK4FringeExport();
128 
129  void SetParameterStore(MHO_ParameterStore* pStore) { fPStore = pStore; };
130 
131  void SetContainerStore(MHO_ContainerStore* cStore) { fCStore = cStore; };
132 
133  void SetPlotData(mho_json& plot_data) { fPlotData.FillData(plot_data); }
134 
135  void ExportFringeFile() { output(); }
136 
137  private:
138  std::string CreateFringeFileName(std::string directory, int seq_no);
139 
140  MHO_ParameterStore* fPStore;
141  MHO_ContainerStore* fCStore;
142  MHO_ParameterStore fPlotData;
143 
144  void char_clear(char* arr, std::size_t n)
145  {
146  for(std::size_t i = 0; i < n; i++)
147  {
148  arr[i] = '\0';
149  }
150  }
151 
152  //utilty to convert source coordinate strings to numerical values
153  int convert_sky_coords(struct sky_coord& coords, std::string ra, std::string dec);
154  MHO_Tokenizer fTokenizer;
155 
156  //the fringe data to be filled and written
157  struct mk4_fringe* fringe;
158 
159  //utilities
160  void FillString(char* destination, std::string param_path, int max_length, std::string default_value = "");
161  void FillString(std::string& destination, std::string param_path, std::string default_value = "");
162  void FillInt(int& destination, std::string param_path, int default_value = 0);
163  void FillShort(short& destination, std::string param_path, int default_value = 0);
164  void FillDouble(double& destination, std::string param_path, double default_value = 0);
165  void FillFloat(float& destination, std::string param_path, float default_value = 0);
166  void FillDate(struct date* destination, std::string param_path);
167  void FillDate(struct date* destination, struct legacy_hops_date& a_date);
168  void FillChannels(struct ch_struct* chan_array);
169 
170  //the filling functions for each type
171  int fill_200(struct type_200* t200);
172  int fill_201(struct type_201* t201);
173  int fill_202(struct type_202* t202);
174  int fill_203(struct type_203* t203);
175  int fill_204(struct type_204* t204);
176  int fill_205(struct type_203* t203, struct type_205* t205);
177  int fill_206(struct type_206* t206);
178  int fill_207(struct type_207* t207);
179  int fill_208(struct type_202* t202, struct type_208* t208);
180  int fill_210(struct type_210* t210);
181  int fill_212(int fr, struct type_212* t212);
182 
183  int fill_221(struct type_221** t221);
184 
185  int fill_222(struct type_222** t222);
186  int fill_230(int fr, int ap, struct type_230* t230);
187 
188  int output();
189 };
190 
191 } // namespace hops
192 
193 #endif
nlohmann::json mho_json
Definition: MHO_JSONHeaderWrapper.hh:5
Class MHO_ContainerStore.
Definition: MHO_ContainerStore.hh:32
Exports HOPS4 fringe data to mark4 type_2xx file data.
Definition: MHO_MK4FringeExport.hh:124
void ExportFringeFile()
Definition: MHO_MK4FringeExport.hh:135
void SetParameterStore(MHO_ParameterStore *pStore)
Definition: MHO_MK4FringeExport.hh:129
virtual ~MHO_MK4FringeExport()
Definition: MHO_MK4FringeExport.cc:53
MHO_MK4FringeExport()
Definition: MHO_MK4FringeExport.cc:50
void SetPlotData(mho_json &plot_data)
Definition: MHO_MK4FringeExport.hh:133
void SetContainerStore(MHO_ContainerStore *cStore)
Definition: MHO_MK4FringeExport.hh:131
Class MHO_ParameterStore.
Definition: MHO_ParameterStore.hh:52
void FillData(const mho_json &data)
Stores input json data for later use.
Definition: MHO_ParameterStore.hh:87
int fill_210(struct type_pass *pass, struct type_status *status, struct type_210 *t210)
Definition: fill_210.c:24
int fill_206(struct scan_struct *root, struct type_pass *pass, struct type_param *param, struct type_status *status, struct type_206 *t206)
Definition: fill_206.c:22
int fill_203(struct scan_struct *root, struct type_param *param, struct type_203 *t203)
Definition: fill_203.c:24
int fill_212(struct type_pass *pass, struct type_status *status, struct type_param *param, int fr, struct type_212 *t212)
Definition: fill_212.c:20
int fill_207(struct type_pass *pass, struct type_status *status, struct type_param *param, struct type_207 *t207)
Definition: fill_207.c:23
int fill_204(struct type_204 *t204)
Definition: fill_204.c:23
int fill_200(struct scan_struct *root, struct type_param *param, struct type_200 *t200)
Definition: fill_200.c:28
int fill_222(struct type_param *param, struct type_222 **t222)
Definition: fill_222.c:25
int fill_202(struct vex *root, struct type_param *param, struct type_202 *t202)
Definition: fill_202.c:23
int fill_201(struct scan_struct *root, struct type_param *param, struct type_201 *t201)
Definition: fill_201.c:20
int fill_205(struct scan_struct *root, struct type_pass *pass, struct type_param *param, struct type_203 *t203, struct type_205 *t205)
Definition: fill_205.c:22
int fill_230(struct type_pass *pass, struct type_param *param, int fr, int ap, struct type_230 *t230)
Definition: fill_230.c:19
int fill_208(struct type_pass *pass, struct type_param *param, struct type_status *status, struct type_202 *t202, struct type_208 *t208)
Definition: fill_208.c:27
struct mk4_fringe fringe
Definition: fourfit3.c:54
struct type_212 * t212[MAXFREQ]
Definition: mk4_data.h:99
struct type_203 * t203
Definition: mk4_data.h:90
struct type_200 * t200
Definition: mk4_data.h:87
struct type_202 * t202
Definition: mk4_data.h:89
struct type_221 * t221
Definition: mk4_data.h:101
struct type_210 * t210
Definition: mk4_data.h:96
struct type_204 * t204
Definition: mk4_data.h:91
struct type_205 * t205
Definition: mk4_data.h:92
struct type_222 * t222
Definition: mk4_data.h:102
struct type_201 * t201
Definition: mk4_data.h:88
struct type_207 * t207
Definition: mk4_data.h:94
struct type_206 * t206
Definition: mk4_data.h:93
struct type_208 * t208
Definition: mk4_data.h:95
struct type_230 * t230[MAXFREQ *MAXAP]
Definition: mk4_data.h:104
Definition: mk4_data.h:82
Definition: mk4_typedefs.h:15
Definition: mk4_typedefs.h:5
Definition: MHO_ChannelLabeler.hh:17
void FillDate(struct date *destination, struct legacy_hops_date &a_date)
Definition: MHO_MK4CorelInterfaceReversed.cc:25
int output(struct vex *root, struct type_pass *pass)
Definition: output.c:255
Definition: type_000.h:5
Definition: type_200.h:11
Definition: type_201.h:11
Definition: type_202.h:9
Definition: type_203.h:21
Definition: type_203.h:43
Definition: type_204.h:12
Definition: type_205.h:34
Definition: type_206.h:77
Definition: type_207.h:54
Definition: type_208.h:43
Definition: type_210.h:24
Definition: type_212.h:36
Definition: type_220.h:5
Definition: type_221.h:10
Definition: type_222.h:10
Definition: type_230.h:11
Definition: vex.h:200
Definition: vex.h:193