OpenCPN Partial API docs
Loading...
Searching...
No Matches
tcmgr.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2010 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
25#ifndef __TCMGR_H__
26#define __TCMGR_H__
27
28#include <map>
29#include <vector>
30
31#include <wx/datetime.h>
32
33#include "station_data.h"
34#include "idx_entry.h"
35#include "tc_error_code.h"
36#include "tc_data_source.h"
37
38// ----------------------------------------------------------------------------
39// external C linkages
40// ----------------------------------------------------------------------------
41
42//----------------------------------------------------------------------------
43// constants
44//----------------------------------------------------------------------------
45
46#define USF_REMOVE 1
47#define USF_UPDATE 2
48#define USF_WRITE 3
49
50#ifndef M_PI
51#define M_PI 3.141592654
52#endif
53
54#define TIDE_MAX_DERIV (2) // Maximum derivative supported
55/* TIDE_TIME_PREC
56 * Precision (in seconds) to which we will find roots
57 */
58#define TIDE_TIME_PREC (15)
59
60/* TIDE_TIME_BLEND
61 * Half the number of seconds over which to blend the tides from
62 * one epoch to the next.
63 */
64#define TIDE_BLEND_TIME (3600)
65
66/* TIDE_TIME_STEP
67 * We are guaranteed to find all high and low tides as long as their
68 * spacing is greater than this value (in seconds).
69 */
70#define TIDE_TIME_STEP (TIDE_TIME_PREC)
71#define TIDE_BAD_TIME ((time_t) - 1)
72
73class TCMgr; // forward
74extern TCMgr *ptcmgr;
75
76//----------------------------------------------------------------------------
77// Reference Station Data
78//----------------------------------------------------------------------------
79
80typedef struct {
81 Station_Data *sta_data;
82 void *next;
83} mru_entry;
84
85//----------------------------------------------------------------------------
86// TCMgr
87//----------------------------------------------------------------------------
88
89class TCMgr {
90public:
91 TCMgr();
92 ~TCMgr();
93
94 TC_Error_Code LoadDataSources(std::vector<std::string> &sources);
95 std::vector<std::string> GetDataSet() { return m_sourcefile_array; }
96
97 bool IsReady() { return bTCMReady; }
98
99 bool GetTideOrCurrent(time_t t, int idx, float &value, float &dir);
100 bool GetTideOrCurrentMeters(time_t t, int idx, float &value, float &dir);
101 bool GetTideOrCurrent15(time_t t, int idx, float &tcvalue, float &dir,
102 bool &bnew_val);
103 bool GetTideFlowSens(time_t t, int sch_step, int idx, float &tcvalue_now,
104 float &tcvalue_prev, bool &w_t);
105 void GetHightOrLowTide(time_t t, int sch_step_1, int sch_step_2,
106 float tide_val, bool w_t, int idx, float &tcvalue,
107 time_t &tctime);
108
109 int GetStationTimeOffset(IDX_entry *pIDX);
110 int GetNextBigEvent(time_t *tm, int idx);
111 std::wstring GetTidalEventStr(int station_id, wxDateTime ref_dt, double lat,
112 double lon, int dt_type);
113 double GetStationLat(IDX_entry *pIDX);
114 double GetStationLon(IDX_entry *pIDX);
115
116 const IDX_entry *GetIDX_entry(int index) const;
117
118 int Get_max_IDX() const { return m_Combined_IDX_array.size() - 1; }
119
120 std::map<double, const IDX_entry *> GetStationsForLL(double xlat,
121 double xlon) const;
122
123 int GetStationIDXbyName(const wxString &prefix, double xlat,
124 double xlon) const;
125 int GetStationIDXbyNameType(const wxString &prefix, double xlat, double xlon,
126 char type) const;
127 void ScrubCurrentDepths();
128
129private:
130 void PurgeData();
131
132 void LoadMRU();
133 void SaveMRU();
134 void AddMRU(Station_Data *psd);
135 void FreeMRU();
136
137 bool bTCMReady;
138 wxString pmru_file_name;
139
140 ArrayOfTCDSources m_source_array;
141 std::vector<std::string> m_sourcefile_array;
142
143 std::vector<IDX_entry *> m_Combined_IDX_array;
144};
145
146/* $Id: tcd.h.in 3744 2010-08-17 22:34:46Z flaterco $ */
147/* tcd.h. Generated from tcd.h.in by configure. */
148
149#ifndef __OAML_TIDES_H__
150#define __OAML_TIDES_H__
151
152/*****************************************************************************
153 *
154 * DISTRIBUTION STATEMENT
155 *
156 * This source file is unclassified, distribution unlimited, public
157 * domain. It is distributed in the hope that it will be useful, but
158 * WITHOUT ANY WARRANTY; without even the implied warranty of
159 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
160 *
161 ******************************************************************************/
162
163/*
164 * Data types for libtcd API
165 * Formerly nvtypes.h, NAVO Standard Data Type Definitions
166 *
167 * This section may appear slightly different from one platform to the
168 * next. The build process for libtcd generates #includes and data
169 * type definitions as needed to provide integer types of specific
170 * sizes.
171 */
172
173/* Generated includes */
174#include <sys/types.h>
175#ifndef __WXMSW__
176#include <inttypes.h>
177
178/* Generated data types */
179#define NV_BYTE int8_t
180#define NV_INT16 int16_t
181#define NV_INT32 int32_t
182#define NV_INT64 int64_t
183#define NV_U_BYTE uint8_t
184#define NV_U_INT16 uint16_t
185#define NV_U_INT32 uint32_t
186#define NV_U_INT64 uint64_t
187#else
188#define NV_BYTE unsigned char
189#define NV_INT16 short
190#define NV_INT32 int
191#define NV_INT64 long
192#define NV_U_BYTE unsigned char
193#define NV_U_INT16 unsigned short
194#define NV_U_INT32 unsigned int
195#define NV_U_INT64 unsigned long
196
197#endif
198
199/* Hard-coded data types */
200#define NV_BOOL unsigned char
201#define NV_CHAR char
202#define NV_U_CHAR unsigned char
203#define NV_FLOAT32 float
204#define NV_FLOAT64 double
205
206/* Defined values */
207#define NVFalse 0
208#define NVTrue 1
209#define NV_U_INT32_MAX 4294967295
210#define NV_INT32_MAX 2147483647
211#define NV_U_INT16_MAX 65535
212#define NV_INT16_MAX 32767
213
214#define LIBTCD_VERSION "PFM Software - libtcd v2.2.5 - 2010-08-17"
215#define LIBTCD_MAJOR_REV 2
216#define LIBTCD_MINOR_REV 2
217
218/*
219 * COMPAT114 is defined here if and only if libtcd was compiled with
220 * --enable-COMPAT114. COMPAT114 forces API changes to enable
221 * applications written against the v1 API to build with more recent
222 * libraries and successfully interact with v2 TCD files. This will
223 * BREAK applications expecting the v2 API. It is for localized use
224 * only (libraries built with this option should not be distributed).
225 */
226#undef COMPAT114
227
228/* Select #warning versus #pragma message (whichever works) */
229#undef USE_PRAGMA_MESSAGE
230
231#ifdef COMPAT114
232#ifdef USE_PRAGMA_MESSAGE
233#pragma message("WARNING: COMPAT114 is enabled! See libtcd.html.")
234#else
235#warning COMPAT114 is enabled! See libtcd.html.
236#endif
237#endif
238
239/* Maximum values. */
240
241/* One-line character strings */
242#define ONELINER_LENGTH 90
243/* Verbose character strings */
244#define MONOLOGUE_LENGTH 10000
245#define MAX_CONSTITUENTS 255
246
247#ifdef __cplusplus
248extern "C" {
249#endif
250
251/* Public portion of the database header. */
252/* See libtcd.html for documentation */
253
254typedef struct {
255 NV_CHAR version[ONELINER_LENGTH];
256 NV_U_INT32 major_rev;
257 NV_U_INT32 minor_rev;
258 NV_CHAR last_modified[ONELINER_LENGTH];
259 NV_U_INT32 number_of_records;
260 NV_INT32 start_year;
261 NV_U_INT32 number_of_years;
262 NV_U_INT32 constituents;
263 NV_U_INT32 level_unit_types;
264 NV_U_INT32 dir_unit_types;
265 NV_U_INT32 restriction_types;
266 NV_U_INT32 datum_types;
267 NV_U_INT32 countries;
268 NV_U_INT32 tzfiles;
269 NV_U_INT32 legaleses;
270
271 /* Need this to read V1 files. */
272 NV_U_INT32 pedigree_types;
274
275/* Header portion of each station record. */
276/* See libtcd.html for documentation */
277
278enum TIDE_RECORD_TYPE { REFERENCE_STATION = 1, SUBORDINATE_STATION = 2 };
279
280typedef struct {
281 NV_INT32 record_number;
282 NV_U_INT32 record_size;
283 NV_U_BYTE record_type;
284 NV_FLOAT64 latitude;
285 NV_FLOAT64 longitude;
286 NV_INT32 reference_station;
287 NV_INT16 tzfile;
288 NV_CHAR name[ONELINER_LENGTH];
290
291/* Tide station record. */
292/* See libtcd.html for documentation */
293
294typedef struct {
295 /* Common */
296 TIDE_STATION_HEADER header;
297 NV_INT16 country;
298 NV_CHAR source[ONELINER_LENGTH];
299 NV_U_BYTE restriction;
300 NV_CHAR comments[MONOLOGUE_LENGTH];
301 NV_CHAR notes[MONOLOGUE_LENGTH];
302 NV_U_BYTE legalese;
303 NV_CHAR station_id_context[ONELINER_LENGTH];
304 NV_CHAR station_id[ONELINER_LENGTH];
305 NV_U_INT32 date_imported;
306 NV_CHAR xfields[MONOLOGUE_LENGTH];
307 NV_U_BYTE direction_units;
308 NV_INT32 min_direction;
309 NV_INT32 max_direction;
310 NV_U_BYTE level_units;
311
312 /* Type 1 */
313 NV_FLOAT32 datum_offset;
314 NV_INT16 datum;
315 NV_INT32 zone_offset;
316 NV_U_INT32 expiration_date;
317 NV_U_INT16 months_on_station;
318 NV_U_INT32 last_date_on_station;
319 NV_U_BYTE confidence;
320 NV_FLOAT32 amplitude[MAX_CONSTITUENTS];
321 NV_FLOAT32 epoch[MAX_CONSTITUENTS];
322
323 /* Type 2 */
324 NV_INT32 min_time_add;
325 NV_FLOAT32 min_level_add;
326 NV_FLOAT32 min_level_multiply;
327 NV_INT32 max_time_add;
328 NV_FLOAT32 max_level_add;
329 NV_FLOAT32 max_level_multiply;
330 NV_INT32 flood_begins;
331 NV_INT32 ebb_begins;
332
333#ifdef COMPAT114
334 /* Deprecated */
335 NV_INT16 pedigree;
336 NV_U_BYTE units;
337 NV_U_BYTE avg_level_units;
338 NV_FLOAT32 min_avg_level;
339 NV_FLOAT32 max_avg_level;
340#endif
342
343/* DWF: This value signifies "null" or "omitted" slack offsets
344 * (flood_begins, ebb_begins). Zero is *not* the same. */
345/* Time offsets are represented as hours * 100 plus minutes.
346 * 0xA00 = 2560
347 * It turns out that offsets do exceed 24 hours (long story), but we
348 * should still be safe with the 60.
349 */
350#define NULLSLACKOFFSET 0xA00
351
352/* This is the level below which an amplitude rounds to zero. */
353/* It should be exactly (0.5 / DEFAULT_AMPLITUDE_SCALE). */
354#define AMPLITUDE_EPSILON 0.00005
355
356/* Rounding function. */
357#define NINT(a) ((a) < 0.0 ? (NV_INT32)((a) - 0.5) : (NV_INT32)((a) + 0.5))
358
359/* Public function prototypes. */
360
361/* Prints a low-level dump of the tide record to stderr. */
362void dump_tide_record(const TIDE_RECORD *rec);
363
364/* For fields in the tide record that are indices into tables of
365 * character string values, these functions are used to retrieve the
366 * character string value corresponding to a particular index. The
367 * value "Unknown" is returned when no translation exists. The return
368 * value is a pointer into static memory. */
369const NV_CHAR *get_country(NV_INT32 num);
370const NV_CHAR *get_tzfile(NV_INT32 num);
371const NV_CHAR *get_level_units(NV_INT32 num);
372const NV_CHAR *get_dir_units(NV_INT32 num);
373const NV_CHAR *get_restriction(NV_INT32 num);
374const NV_CHAR *get_datum(NV_INT32 num);
375const NV_CHAR *get_legalese(NV_INT32 num);
376
377/* Get the name of the constituent corresponding to index num
378 * [0,constituents-1]. The return value is a pointer into static
379 * memory. */
380const NV_CHAR *get_constituent(NV_INT32 num);
381
382/* Get the name of the station whose record_number is num
383 * [0,number_of_records-1]. The return value is a pointer into static
384 * memory. */
385const NV_CHAR *get_station(NV_INT32 num);
386
387/* Returns the speed of the constituent indicated by num
388 * [0,constituents-1]. */
389NV_FLOAT64 get_speed(NV_INT32 num);
390
391/* Get the equilibrium argument and node factor for the constituent
392 * indicated by num [0,constituents-1], for the year
393 * start_year+year. */
394NV_FLOAT32 get_equilibrium(NV_INT32 num, NV_INT32 year);
395NV_FLOAT32 get_node_factor(NV_INT32 num, NV_INT32 year);
396
397/* Get all available equilibrium arguments and node factors for the
398 * constituent indicated by num [0,constituents-1]. The return value
399 * is a pointer into static memory which is an array of
400 * number_of_years floats, corresponding to the years start_year
401 * through start_year+number_of_years-1. */
402NV_FLOAT32 *get_equilibriums(NV_INT32 num);
403NV_FLOAT32 *get_node_factors(NV_INT32 num);
404
405/* Convert between character strings of the form "[+-]HH:MM" and the
406 * encoding Hours * 100 + Minutes. ret_time pads the hours with a
407 * leading zero when less than 10; ret_time_neat omits the leading
408 * zero and omits the sign when the value is 0:00. Returned pointers
409 * point into static memory. */
410NV_INT32 get_time(const NV_CHAR *string);
411NV_CHAR *ret_time(NV_INT32 time);
412NV_CHAR *ret_time_neat(NV_INT32 time);
413
414/* Convert the encoding Year * 10000 + Month [1, 12] * 100 + Day [1,
415 * 31] to a character string of the form "YYYY-MM-DD", or "NULL" if
416 * the value is zero. The returned pointer points into static memory.
417 * (The compact form, without hyphens, is obtainable just by printing
418 * the integer.) */
419NV_CHAR *ret_date(NV_U_INT32 date);
420
421/* When invoked multiple times with the same string, returns record
422 * numbers of all stations that have that string anywhere in the
423 * station name. This search is case insensitive. When no more
424 * records are found it returns -1. */
425NV_INT32 search_station(const NV_CHAR *string);
426
427/* Inverses of the corresponding get_ operations. Return -1 for not
428 * found. */
429NV_INT32 find_station(const NV_CHAR *name);
430NV_INT32 find_tzfile(const NV_CHAR *name);
431NV_INT32 find_country(const NV_CHAR *name);
432NV_INT32 find_level_units(const NV_CHAR *name);
433NV_INT32 find_dir_units(const NV_CHAR *name);
434NV_INT32 find_restriction(const NV_CHAR *name);
435NV_INT32 find_datum(const NV_CHAR *name);
436NV_INT32 find_constituent(const NV_CHAR *name);
437NV_INT32 find_legalese(const NV_CHAR *name);
438
439/* Add the value of name to the corresponding lookup table and return
440 * the index of the new value. If db is not NULL, the database header
441 * struct pointed to will be updated to reflect the changes. */
442NV_INT32 add_restriction(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
443NV_INT32 add_tzfile(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
444NV_INT32 add_country(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
445NV_INT32 add_datum(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
446NV_INT32 add_legalese(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
447
448/* Add the value of name to the corresponding lookup table if and
449 * only if it is not already present. Return the index of the value.
450 * If db is not NULL, the database header struct pointed to will be
451 * updated to reflect the changes. */
452NV_INT32 find_or_add_restriction(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
453NV_INT32 find_or_add_tzfile(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
454NV_INT32 find_or_add_country(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
455NV_INT32 find_or_add_datum(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
456NV_INT32 find_or_add_legalese(const NV_CHAR *name, DB_HEADER_PUBLIC *db);
457
458/* Set the speed for the constituent corresponding to index num
459 * [0,constituents-1]. */
460void set_speed(NV_INT32 num, NV_FLOAT64 value);
461
462/* Set the equilibrium argument and node factor for the constituent
463 * corresponding to index num [0,constituents-1], for the year
464 * start_year+year. */
465void set_equilibrium(NV_INT32 num, NV_INT32 year, NV_FLOAT32 value);
466void set_node_factor(NV_INT32 num, NV_INT32 year, NV_FLOAT32 value);
467
468/* Opens the specified TCD file. If a different database is already
469 * open, it will be closed. libtcd maintains considerable internal
470 * state and can only handle one open database at a time. Returns
471 * false if the open failed. */
472NV_BOOL open_tide_db(const NV_CHAR *file);
473
474/* Closes the open database. */
475void close_tide_db();
476
477/* Creates a TCD file with the supplied constituents and no tide
478 * stations. Returns false if creation failed. The database is left
479 * in an open state. */
480NV_BOOL create_tide_db(const NV_CHAR *file, NV_U_INT32 constituents,
481 NV_CHAR const *const constituent[],
482 const NV_FLOAT64 *speed, NV_INT32 start_year,
483 NV_U_INT32 num_years,
484 NV_FLOAT32 const *const equilibrium[],
485 NV_FLOAT32 const *const node_factor[]);
486
487/* Returns a copy of the database header for the open database. */
488DB_HEADER_PUBLIC get_tide_db_header();
489
490/* Gets "header" portion of tide record for the station whose
491 * record_number is num [0,number_of_records-1] and writes it into
492 * rec. Returns false if num is out of range. num is preserved in
493 * the static variable current_index. */
494NV_BOOL get_partial_tide_record(NV_INT32 num, TIDE_STATION_HEADER *rec);
495
496/* Invokes get_partial_tide_record for current_index+1. Returns the
497 * record number or -1 for failure. */
498NV_INT32 get_next_partial_tide_record(TIDE_STATION_HEADER *rec);
499
500/* Invokes get_partial_tide_record for a station that appears closest
501 * to the specified lat and lon in the Cylindrical Equidistant
502 * projection. Returns the record number or -1 for failure. */
503NV_INT32 get_nearest_partial_tide_record(NV_FLOAT64 lat, NV_FLOAT64 lon,
505
506/* Gets tide record for the station whose record_number is num
507 * [0,number_of_records-1] and writes it into rec. num is preserved
508 * in the static variable current_record. Returns num, or -1 if num is
509 * out of range. */
510NV_INT32 read_tide_record(NV_INT32 num, TIDE_RECORD *rec);
511
512/* Invokes read_tide_record for current_record+1. Returns the record
513 * number or -1 for failure. */
514NV_INT32 read_next_tide_record(TIDE_RECORD *rec);
515
516/* Add a new record, update an existing record, or delete an existing
517 * record. If the deleted record is a reference station, all
518 * dependent subordinate stations will also be deleted. Add and
519 * update return false if the new record is invalid; delete and update
520 * return false if the specified num is invalid. If db is not NULL,
521 * the database header struct pointed to will be updated to reflect
522 * the changes. */
523NV_BOOL add_tide_record(TIDE_RECORD *rec, DB_HEADER_PUBLIC *db);
524#ifdef COMPAT114
525/* Omission of db parameter was a bug. */
526NV_BOOL update_tide_record(NV_INT32 num, TIDE_RECORD *rec);
527#else
528NV_BOOL update_tide_record(NV_INT32 num, TIDE_RECORD *rec,
529 DB_HEADER_PUBLIC *db);
530#endif
531NV_BOOL delete_tide_record(NV_INT32 num, DB_HEADER_PUBLIC *db);
532
533/* Computes inferred constituents when M2, S2, K1, and O1 are given
534 * and fills in the remaining unfilled constituents. The inferred
535 * constituents are developed or decided based on Article 230 of
536 * "Manual of Harmonic Analysis and Prediction of Tides," Paul
537 * Schureman, C&GS Special Publication No. 98, October 1971. Returns
538 * false if M2, S2, K1, or O1 is missing. */
539NV_BOOL infer_constituents(TIDE_RECORD *rec);
540
541#ifdef COMPAT114
542/* Deprecated stuff. */
543#define NAME_LENGTH ONELINER_LENGTH
544#define SOURCE_LENGTH ONELINER_LENGTH
545#define COMMENTS_LENGTH MONOLOGUE_LENGTH
546NV_CHAR *get_pedigree(NV_INT32 num);
547NV_INT32 find_pedigree(const NV_CHAR *name);
548NV_INT32 add_pedigree(const NV_CHAR *name, const DB_HEADER_PUBLIC *db);
549NV_BOOL check_simple(TIDE_RECORD rec);
550#endif
551
552#ifdef __cplusplus
553}
554#endif
555
556#endif
557
558/* $Id: tide_db_header.h 1092 2006-11-16 03:02:42Z flaterco $ */
559
560/*****************************************************************************\
561 *
562 * DISTRIBUTION STATEMENT
563 *
564 * This source file is unclassified, distribution unlimited, public
565 * domain. It is distributed in the hope that it will be useful, but
566 * WITHOUT ANY WARRANTY; without even the implied warranty of
567 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
568 *
569 * \*****************************************************************************/
570
571/***************************************************************************\
572 *
573 * Module Name: TIDE DB option header file
574 *
575 * Programmer(s): Jan C. Depner
576 *
577 * Date Written: July 2002
578 *
579 * Purpose: This header file defines all of the format options
580 * that are stored in the TIDE DB file header. To add a
581 * new option you simply add it to the header_data
582 * structure, then put a definition in the keys
583 structure.
584 * The keys structure contains a keyphrase such as
585 * "[DATE]", a format like "%s", a datatype (see the
586 * union in the TIDE_HEADER_DATA structure, a pointer to
587 * the location at which to store the value(s), a count
588 * if it is a repeating field (array), and a version
589 * dependency flag (major.minor * 10).
590 *
591 *
592 *
593 *****************************************************************************
594
595 This header file uses the NAVO standard data types. You must set one of
596 the following options on the compile command line:
597
598 NVDOS, NVHPUX, NVIRIX, NVCLIX, NVLinux, NVSUNOS, NVWINNT, or NVWIN3X
599
600 The only one referenced in libtcd is NVWIN3X. -- DWF, 2004-09-29
601
602 \***************************************************************************/
603
604#ifndef __TIDE_HEADER__
605#define __TIDE_HEADER__
606
607// #include "tcd.h"
608
609typedef struct {
610 const NV_CHAR *keyphrase;
611 const NV_CHAR *datatype;
612 union {
613 const NV_CHAR *cstr;
614 NV_INT32 *i32;
615 NV_U_INT32 *ui32;
616 } address;
617} KEY;
618
619typedef struct {
621 NV_CHAR **constituent;
622 NV_FLOAT64 *speed;
623 NV_FLOAT32 **equilibrium;
624 NV_FLOAT32 **node_factor;
625 NV_CHAR **level_unit;
626 NV_CHAR **dir_unit;
627 NV_CHAR **restriction;
628 NV_CHAR **tzfile;
629 NV_CHAR **country;
630 NV_CHAR **datum;
631 NV_CHAR **legalese;
632 NV_U_INT32 header_size;
633 NV_U_INT32 speed_bits;
634 NV_U_INT32 speed_scale;
635 NV_INT32 speed_offset;
636 NV_U_INT32 equilibrium_bits;
637 NV_U_INT32 equilibrium_scale;
638 NV_INT32 equilibrium_offset;
639 NV_U_INT32 node_bits;
640 NV_U_INT32 node_scale;
641 NV_INT32 node_offset;
642 NV_U_INT32 amplitude_bits;
643 NV_U_INT32 amplitude_scale;
644 NV_U_INT32 epoch_bits;
645 NV_U_INT32 epoch_scale;
646 NV_U_INT32 constituent_bits;
647 NV_U_INT32 record_type_bits;
648 NV_U_INT32 latitude_scale;
649 NV_U_INT32 latitude_bits;
650 NV_U_INT32 longitude_scale;
651 NV_U_INT32 longitude_bits;
652 NV_U_INT32 record_size_bits;
653 NV_U_INT32 station_bits;
654 NV_U_INT32 level_unit_bits;
655 NV_U_INT32 dir_unit_bits;
656 NV_U_INT32 restriction_bits;
657 NV_U_INT32 max_restriction_types;
658 NV_U_INT32 tzfile_bits;
659 NV_U_INT32 max_tzfiles;
660 NV_U_INT32 country_bits;
661 NV_U_INT32 max_countries;
662 NV_U_INT32 datum_bits;
663 NV_U_INT32 max_datum_types;
664 NV_U_INT32 legalese_bits;
665 NV_U_INT32 max_legaleses;
666 NV_U_INT32 datum_offset_bits;
667 NV_U_INT32 datum_offset_scale;
668 NV_U_INT32 date_bits;
669 NV_U_INT32 months_on_station_bits;
670 NV_U_INT32 confidence_value_bits;
671 NV_U_INT32 time_bits;
672 NV_U_INT32 level_add_bits;
673 NV_U_INT32 level_add_scale;
674 NV_U_INT32 level_multiply_bits;
675 NV_U_INT32 level_multiply_scale;
676 NV_U_INT32 direction_bits;
677 NV_U_INT32 constituent_size;
678 NV_U_INT32 level_unit_size;
679 NV_U_INT32 dir_unit_size;
680 NV_U_INT32 restriction_size;
681 NV_U_INT32 tzfile_size;
682 NV_U_INT32 country_size;
683 NV_U_INT32 datum_size;
684 NV_U_INT32 legalese_size;
685 NV_U_INT32 end_of_file;
686
687 /* Need these to read V1 files. */
688 NV_U_INT32 pedigree_bits;
689 NV_U_INT32 pedigree_size;
691
692static TIDE_HEADER_DATA hd;
693
694/* "The initializer for a union with no constructor is either a single
695 * expression of the same type, or a brace-enclosed initializer for
696 * the first member of the union." -- Ellis & Stroustrup, The Annotated
697 * C++ Reference Manual, 1990, Section 8.4.1. */
698
699static KEY keys[] = {{
700 "[VERSION]",
701 "cstr",
702 {(NV_CHAR *)hd.pub.version},
703 },
704 {
705 "[MAJOR REV]",
706 "ui32",
707 {(NV_CHAR *)&hd.pub.major_rev},
708 },
709 {
710 "[MINOR REV]",
711 "ui32",
712 {(NV_CHAR *)&hd.pub.minor_rev},
713 },
714 {
715 "[LAST MODIFIED]",
716 "cstr",
717 {(NV_CHAR *)hd.pub.last_modified},
718 },
719 {
720 "[NUMBER OF RECORDS]",
721 "ui32",
722 {(NV_CHAR *)&hd.pub.number_of_records},
723 },
724 {
725 "[START YEAR]",
726 "i32",
727 {(NV_CHAR *)&hd.pub.start_year},
728 },
729 {
730 "[NUMBER OF YEARS]",
731 "ui32",
732 {(NV_CHAR *)&hd.pub.number_of_years},
733 },
734 {
735 "[CONSTITUENTS]",
736 "ui32",
737 {(NV_CHAR *)&hd.pub.constituents},
738 },
739 {
740 "[LEVEL UNIT TYPES]",
741 "ui32",
742 {(NV_CHAR *)&hd.pub.level_unit_types},
743 },
744 {
745 "[DIRECTION UNIT TYPES]",
746 "ui32",
747 {(NV_CHAR *)&hd.pub.dir_unit_types},
748 },
749 {
750 "[RESTRICTION TYPES]",
751 "ui32",
752 {(NV_CHAR *)&hd.pub.restriction_types},
753 },
754 {
755 "[PEDIGREE TYPES]",
756 "ui32",
757 {(NV_CHAR *)&hd.pub.pedigree_types},
758 },
759 {
760 "[TZFILES]",
761 "ui32",
762 {(NV_CHAR *)&hd.pub.tzfiles},
763 },
764 {
765 "[COUNTRIES]",
766 "ui32",
767 {(NV_CHAR *)&hd.pub.countries},
768 },
769 {
770 "[DATUM TYPES]",
771 "ui32",
772 {(NV_CHAR *)&hd.pub.datum_types},
773 },
774 {
775 "[LEGALESES]",
776 "ui32",
777 {(NV_CHAR *)&hd.pub.legaleses},
778 },
779 {
780 "[HEADER SIZE]",
781 "ui32",
782 {(NV_CHAR *)&hd.header_size},
783 },
784 {
785 "[SPEED BITS]",
786 "ui32",
787 {(NV_CHAR *)&hd.speed_bits},
788 },
789 {
790 "[SPEED SCALE]",
791 "ui32",
792 {(NV_CHAR *)&hd.speed_scale},
793 },
794 {
795 "[SPEED OFFSET]",
796 "i32",
797 {(NV_CHAR *)&hd.speed_offset},
798 },
799 {
800 "[EQUILIBRIUM BITS]",
801 "ui32",
802 {(NV_CHAR *)&hd.equilibrium_bits},
803 },
804 {
805 "[EQUILIBRIUM SCALE]",
806 "ui32",
807 {(NV_CHAR *)&hd.equilibrium_scale},
808 },
809 {
810 "[EQUILIBRIUM OFFSET]",
811 "i32",
812 {(NV_CHAR *)&hd.equilibrium_offset},
813 },
814 {
815 "[NODE BITS]",
816 "ui32",
817 {(NV_CHAR *)&hd.node_bits},
818 },
819 {
820 "[NODE SCALE]",
821 "ui32",
822 {(NV_CHAR *)&hd.node_scale},
823 },
824 {
825 "[NODE OFFSET]",
826 "i32",
827 {(NV_CHAR *)&hd.node_offset},
828 },
829 {
830 "[AMPLITUDE BITS]",
831 "ui32",
832 {(NV_CHAR *)&hd.amplitude_bits},
833 },
834 {
835 "[AMPLITUDE SCALE]",
836 "ui32",
837 {(NV_CHAR *)&hd.amplitude_scale},
838 },
839 {
840 "[EPOCH BITS]",
841 "ui32",
842 {(NV_CHAR *)&hd.epoch_bits},
843 },
844 {
845 "[EPOCH SCALE]",
846 "ui32",
847 {(NV_CHAR *)&hd.epoch_scale},
848 },
849 {
850 "[CONSTITUENT BITS]",
851 "ui32",
852 {(NV_CHAR *)&hd.constituent_bits},
853 },
854 {
855 "[LEVEL UNIT BITS]",
856 "ui32",
857 {(NV_CHAR *)&hd.level_unit_bits},
858 },
859 {
860 "[DIRECTION UNIT BITS]",
861 "ui32",
862 {(NV_CHAR *)&hd.dir_unit_bits},
863 },
864 {
865 "[RESTRICTION BITS]",
866 "ui32",
867 {(NV_CHAR *)&hd.restriction_bits},
868 },
869 {
870 "[PEDIGREE BITS]",
871 "ui32",
872 {(NV_CHAR *)&hd.pedigree_bits},
873 },
874 {
875 "[TZFILE BITS]",
876 "ui32",
877 {(NV_CHAR *)&hd.tzfile_bits},
878 },
879 {
880 "[COUNTRY BITS]",
881 "ui32",
882 {(NV_CHAR *)&hd.country_bits},
883 },
884 {
885 "[DATUM BITS]",
886 "ui32",
887 {(NV_CHAR *)&hd.datum_bits},
888 },
889 {
890 "[LEGALESE BITS]",
891 "ui32",
892 {(NV_CHAR *)&hd.legalese_bits},
893 },
894 {
895 "[RECORD TYPE BITS]",
896 "ui32",
897 {(NV_CHAR *)&hd.record_type_bits},
898 },
899 {
900 "[LATITUDE SCALE]",
901 "ui32",
902 {(NV_CHAR *)&hd.latitude_scale},
903 },
904 {
905 "[LATITUDE BITS]",
906 "ui32",
907 {(NV_CHAR *)&hd.latitude_bits},
908 },
909 {
910 "[LONGITUDE SCALE]",
911 "ui32",
912 {(NV_CHAR *)&hd.longitude_scale},
913 },
914 {
915 "[LONGITUDE BITS]",
916 "ui32",
917 {(NV_CHAR *)&hd.longitude_bits},
918 },
919 {
920 "[RECORD SIZE BITS]",
921 "ui32",
922 {(NV_CHAR *)&hd.record_size_bits},
923 },
924 {
925 "[STATION BITS]",
926 "ui32",
927 {(NV_CHAR *)&hd.station_bits},
928 },
929 {
930 "[DATUM OFFSET BITS]",
931 "ui32",
932 {(NV_CHAR *)&hd.datum_offset_bits},
933 },
934 {
935 "[DATUM OFFSET SCALE]",
936 "ui32",
937 {(NV_CHAR *)&hd.datum_offset_scale},
938 },
939 {
940 "[DATE BITS]",
941 "ui32",
942 {(NV_CHAR *)&hd.date_bits},
943 },
944 {
945 "[MONTHS ON STATION BITS]",
946 "ui32",
947 {(NV_CHAR *)&hd.months_on_station_bits},
948 },
949 {
950 "[CONFIDENCE VALUE BITS]",
951 "ui32",
952 {(NV_CHAR *)&hd.confidence_value_bits},
953 },
954 {
955 "[TIME BITS]",
956 "ui32",
957 {(NV_CHAR *)&hd.time_bits},
958 },
959 {
960 "[LEVEL ADD BITS]",
961 "ui32",
962 {(NV_CHAR *)&hd.level_add_bits},
963 },
964 {
965 "[LEVEL ADD SCALE]",
966 "ui32",
967 {(NV_CHAR *)&hd.level_add_scale},
968 },
969 {
970 "[LEVEL MULTIPLY BITS]",
971 "ui32",
972 {(NV_CHAR *)&hd.level_multiply_bits},
973 },
974 {
975 "[LEVEL MULTIPLY SCALE]",
976 "ui32",
977 {(NV_CHAR *)&hd.level_multiply_scale},
978 },
979 {
980 "[DIRECTION BITS]",
981 "ui32",
982 {(NV_CHAR *)&hd.direction_bits},
983 },
984 {
985 "[CONSTITUENT SIZE]",
986 "ui32",
987 {(NV_CHAR *)&hd.constituent_size},
988 },
989 {
990 "[LEVEL UNIT SIZE]",
991 "ui32",
992 {(NV_CHAR *)&hd.level_unit_size},
993 },
994 {
995 "[DIRECTION UNIT SIZE]",
996 "ui32",
997 {(NV_CHAR *)&hd.dir_unit_size},
998 },
999 {
1000 "[RESTRICTION SIZE]",
1001 "ui32",
1002 {(NV_CHAR *)&hd.restriction_size},
1003 },
1004 {
1005 "[PEDIGREE SIZE]",
1006 "ui32",
1007 {(NV_CHAR *)&hd.pedigree_size},
1008 },
1009 {
1010 "[TZFILE SIZE]",
1011 "ui32",
1012 {(NV_CHAR *)&hd.tzfile_size},
1013 },
1014 {
1015 "[COUNTRY SIZE]",
1016 "ui32",
1017 {(NV_CHAR *)&hd.country_size},
1018 },
1019 {
1020 "[DATUM SIZE]",
1021 "ui32",
1022 {(NV_CHAR *)&hd.datum_size},
1023 },
1024 {
1025 "[LEGALESE SIZE]",
1026 "ui32",
1027 {(NV_CHAR *)&hd.legalese_size},
1028 },
1029 {
1030 "[END OF FILE]",
1031 "ui32",
1032 {(NV_CHAR *)&hd.end_of_file},
1033 }};
1034#endif
1035
1036#endif
Represents an index entry for tidal and current data.
Definition idx_entry.h:48
Definition tcmgr.h:89
Tidal data container.
Amplitude measurement container.
Definition tcmgr.h:609
Definition tcmgr.h:80
Tide datasource container on top of TCDataSource.
TCMgr * ptcmgr
Global instance.
Definition tcmgr.cpp:42