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