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