OpenCPN Partial API docs
Loading...
Searching...
No Matches
tcmgr.h File Reference

Tide and Current Manager @TODO Add original author copyright. More...

#include <map>
#include <vector>
#include <wx/datetime.h>
#include "station_data.h"
#include "idx_entry.h"
#include "tc_error_code.h"
#include "tc_data_source.h"
#include <sys/types.h>
#include <inttypes.h>

Go to the source code of this file.

Classes

struct  mru_entry
 
class  TCMgr
 
struct  DB_HEADER_PUBLIC
 
struct  TIDE_STATION_HEADER
 
struct  TIDE_RECORD
 
struct  KEY
 
struct  TIDE_HEADER_DATA
 

Macros

#define USF_REMOVE   1
 
#define USF_UPDATE   2
 
#define USF_WRITE   3
 
#define M_PI   3.141592654
 
#define TIDE_MAX_DERIV   (2)
 
#define TIDE_TIME_PREC   (15)
 
#define TIDE_BLEND_TIME   (3600)
 
#define TIDE_TIME_STEP   (TIDE_TIME_PREC)
 
#define TIDE_BAD_TIME   ((time_t) - 1)
 
#define __OAML_TIDES_H__
 
#define NV_BYTE   int8_t
 
#define NV_INT16   int16_t
 
#define NV_INT32   int32_t
 
#define NV_INT64   int64_t
 
#define NV_U_BYTE   uint8_t
 
#define NV_U_INT16   uint16_t
 
#define NV_U_INT32   uint32_t
 
#define NV_U_INT64   uint64_t
 
#define NV_BOOL   unsigned char
 
#define NV_CHAR   char
 
#define NV_U_CHAR   unsigned char
 
#define NV_FLOAT32   float
 
#define NV_FLOAT64   double
 
#define NVFalse   0
 
#define NVTrue   1
 
#define NV_U_INT32_MAX   4294967295
 
#define NV_INT32_MAX   2147483647
 
#define NV_U_INT16_MAX   65535
 
#define NV_INT16_MAX   32767
 
#define LIBTCD_VERSION   "PFM Software - libtcd v2.2.5 - 2010-08-17"
 
#define LIBTCD_MAJOR_REV   2
 
#define LIBTCD_MINOR_REV   2
 
#define ONELINER_LENGTH   90
 
#define MONOLOGUE_LENGTH   10000
 
#define MAX_CONSTITUENTS   255
 
#define NULLSLACKOFFSET   0xA00
 
#define AMPLITUDE_EPSILON   0.00005
 
#define NINT(a)   ((a) < 0.0 ? (NV_INT32)((a) - 0.5) : (NV_INT32)((a) + 0.5))
 
#define __TIDE_HEADER__
 

Enumerations

enum  TIDE_RECORD_TYPE { REFERENCE_STATION = 1 , SUBORDINATE_STATION = 2 }
 

Functions

void dump_tide_record (const TIDE_RECORD *rec)
 
const NV_CHAR * get_country (NV_INT32 num)
 
const NV_CHAR * get_tzfile (NV_INT32 num)
 
const NV_CHAR * get_level_units (NV_INT32 num)
 
const NV_CHAR * get_dir_units (NV_INT32 num)
 
const NV_CHAR * get_restriction (NV_INT32 num)
 
const NV_CHAR * get_datum (NV_INT32 num)
 
const NV_CHAR * get_legalese (NV_INT32 num)
 
const NV_CHAR * get_constituent (NV_INT32 num)
 
const NV_CHAR * get_station (NV_INT32 num)
 
NV_FLOAT64 get_speed (NV_INT32 num)
 
NV_FLOAT32 get_equilibrium (NV_INT32 num, NV_INT32 year)
 
NV_FLOAT32 get_node_factor (NV_INT32 num, NV_INT32 year)
 
NV_FLOAT32 * get_equilibriums (NV_INT32 num)
 
NV_FLOAT32 * get_node_factors (NV_INT32 num)
 
NV_INT32 get_time (const NV_CHAR *string)
 
NV_CHAR * ret_time (NV_INT32 time)
 
NV_CHAR * ret_time_neat (NV_INT32 time)
 
NV_CHAR * ret_date (NV_U_INT32 date)
 
NV_INT32 search_station (const NV_CHAR *string)
 
NV_INT32 find_station (const NV_CHAR *name)
 
NV_INT32 find_tzfile (const NV_CHAR *name)
 
NV_INT32 find_country (const NV_CHAR *name)
 
NV_INT32 find_level_units (const NV_CHAR *name)
 
NV_INT32 find_dir_units (const NV_CHAR *name)
 
NV_INT32 find_restriction (const NV_CHAR *name)
 
NV_INT32 find_datum (const NV_CHAR *name)
 
NV_INT32 find_constituent (const NV_CHAR *name)
 
NV_INT32 find_legalese (const NV_CHAR *name)
 
NV_INT32 add_restriction (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 add_tzfile (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 add_country (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 add_datum (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 add_legalese (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 find_or_add_restriction (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 find_or_add_tzfile (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 find_or_add_country (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 find_or_add_datum (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
NV_INT32 find_or_add_legalese (const NV_CHAR *name, DB_HEADER_PUBLIC *db)
 
void set_speed (NV_INT32 num, NV_FLOAT64 value)
 
void set_equilibrium (NV_INT32 num, NV_INT32 year, NV_FLOAT32 value)
 
void set_node_factor (NV_INT32 num, NV_INT32 year, NV_FLOAT32 value)
 
NV_BOOL open_tide_db (const NV_CHAR *file)
 
void close_tide_db ()
 
NV_BOOL create_tide_db (const NV_CHAR *file, NV_U_INT32 constituents, NV_CHAR const *const constituent[], const NV_FLOAT64 *speed, NV_INT32 start_year, NV_U_INT32 num_years, NV_FLOAT32 const *const equilibrium[], NV_FLOAT32 const *const node_factor[])
 
DB_HEADER_PUBLIC get_tide_db_header ()
 
NV_BOOL get_partial_tide_record (NV_INT32 num, TIDE_STATION_HEADER *rec)
 
NV_INT32 get_next_partial_tide_record (TIDE_STATION_HEADER *rec)
 
NV_INT32 get_nearest_partial_tide_record (NV_FLOAT64 lat, NV_FLOAT64 lon, TIDE_STATION_HEADER *rec)
 
NV_INT32 read_tide_record (NV_INT32 num, TIDE_RECORD *rec)
 
NV_INT32 read_next_tide_record (TIDE_RECORD *rec)
 
NV_BOOL add_tide_record (TIDE_RECORD *rec, DB_HEADER_PUBLIC *db)
 
NV_BOOL update_tide_record (NV_INT32 num, TIDE_RECORD *rec, DB_HEADER_PUBLIC *db)
 
NV_BOOL delete_tide_record (NV_INT32 num, DB_HEADER_PUBLIC *db)
 
NV_BOOL infer_constituents (TIDE_RECORD *rec)
 

Variables

TCMgrptcmgr
 Global instance.
 

Detailed Description

Tide and Current Manager @TODO Add original author copyright.

Definition in file tcmgr.h.

Macro Definition Documentation

◆ __OAML_TIDES_H__

#define __OAML_TIDES_H__

Definition at line 149 of file tcmgr.h.

◆ __TIDE_HEADER__

#define __TIDE_HEADER__

Definition at line 604 of file tcmgr.h.

◆ AMPLITUDE_EPSILON

#define AMPLITUDE_EPSILON   0.00005

Definition at line 353 of file tcmgr.h.

◆ LIBTCD_MAJOR_REV

#define LIBTCD_MAJOR_REV   2

Definition at line 214 of file tcmgr.h.

◆ LIBTCD_MINOR_REV

#define LIBTCD_MINOR_REV   2

Definition at line 215 of file tcmgr.h.

◆ LIBTCD_VERSION

#define LIBTCD_VERSION   "PFM Software - libtcd v2.2.5 - 2010-08-17"

Definition at line 213 of file tcmgr.h.

◆ M_PI

#define M_PI   3.141592654

Definition at line 51 of file tcmgr.h.

◆ MAX_CONSTITUENTS

#define MAX_CONSTITUENTS   255

Definition at line 244 of file tcmgr.h.

◆ MONOLOGUE_LENGTH

#define MONOLOGUE_LENGTH   10000

Definition at line 243 of file tcmgr.h.

◆ NINT

#define NINT (   a)    ((a) < 0.0 ? (NV_INT32)((a) - 0.5) : (NV_INT32)((a) + 0.5))

Definition at line 356 of file tcmgr.h.

◆ NULLSLACKOFFSET

#define NULLSLACKOFFSET   0xA00

Definition at line 349 of file tcmgr.h.

◆ NV_BOOL

#define NV_BOOL   unsigned char

Definition at line 199 of file tcmgr.h.

◆ NV_BYTE

#define NV_BYTE   int8_t

Definition at line 178 of file tcmgr.h.

◆ NV_CHAR

#define NV_CHAR   char

Definition at line 200 of file tcmgr.h.

◆ NV_FLOAT32

#define NV_FLOAT32   float

Definition at line 202 of file tcmgr.h.

◆ NV_FLOAT64

#define NV_FLOAT64   double

Definition at line 203 of file tcmgr.h.

◆ NV_INT16

#define NV_INT16   int16_t

Definition at line 179 of file tcmgr.h.

◆ NV_INT16_MAX

#define NV_INT16_MAX   32767

Definition at line 211 of file tcmgr.h.

◆ NV_INT32

#define NV_INT32   int32_t

Definition at line 180 of file tcmgr.h.

◆ NV_INT32_MAX

#define NV_INT32_MAX   2147483647

Definition at line 209 of file tcmgr.h.

◆ NV_INT64

#define NV_INT64   int64_t

Definition at line 181 of file tcmgr.h.

◆ NV_U_BYTE

#define NV_U_BYTE   uint8_t

Definition at line 182 of file tcmgr.h.

◆ NV_U_CHAR

#define NV_U_CHAR   unsigned char

Definition at line 201 of file tcmgr.h.

◆ NV_U_INT16

#define NV_U_INT16   uint16_t

Definition at line 183 of file tcmgr.h.

◆ NV_U_INT16_MAX

#define NV_U_INT16_MAX   65535

Definition at line 210 of file tcmgr.h.

◆ NV_U_INT32

#define NV_U_INT32   uint32_t

Definition at line 184 of file tcmgr.h.

◆ NV_U_INT32_MAX

#define NV_U_INT32_MAX   4294967295

Definition at line 208 of file tcmgr.h.

◆ NV_U_INT64

#define NV_U_INT64   uint64_t

Definition at line 185 of file tcmgr.h.

◆ NVFalse

#define NVFalse   0

Definition at line 206 of file tcmgr.h.

◆ NVTrue

#define NVTrue   1

Definition at line 207 of file tcmgr.h.

◆ ONELINER_LENGTH

#define ONELINER_LENGTH   90

Definition at line 241 of file tcmgr.h.

◆ TIDE_BAD_TIME

#define TIDE_BAD_TIME   ((time_t) - 1)

Definition at line 71 of file tcmgr.h.

◆ TIDE_BLEND_TIME

#define TIDE_BLEND_TIME   (3600)

Definition at line 64 of file tcmgr.h.

◆ TIDE_MAX_DERIV

#define TIDE_MAX_DERIV   (2)

Definition at line 54 of file tcmgr.h.

◆ TIDE_TIME_PREC

#define TIDE_TIME_PREC   (15)

Definition at line 58 of file tcmgr.h.

◆ TIDE_TIME_STEP

#define TIDE_TIME_STEP   (TIDE_TIME_PREC)

Definition at line 70 of file tcmgr.h.

◆ USF_REMOVE

#define USF_REMOVE   1

Definition at line 46 of file tcmgr.h.

◆ USF_UPDATE

#define USF_UPDATE   2

Definition at line 47 of file tcmgr.h.

◆ USF_WRITE

#define USF_WRITE   3

Definition at line 48 of file tcmgr.h.

Enumeration Type Documentation

◆ TIDE_RECORD_TYPE

enum TIDE_RECORD_TYPE

Definition at line 277 of file tcmgr.h.

Function Documentation

◆ add_country()

NV_INT32 add_country ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3754 of file tcmgr.cpp.

◆ add_datum()

NV_INT32 add_datum ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3813 of file tcmgr.cpp.

◆ add_legalese()

NV_INT32 add_legalese ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3856 of file tcmgr.cpp.

◆ add_restriction()

NV_INT32 add_restriction ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3915 of file tcmgr.cpp.

◆ add_tide_record()

NV_BOOL add_tide_record ( TIDE_RECORD rec,
DB_HEADER_PUBLIC db 
)

Definition at line 6743 of file tcmgr.cpp.

◆ add_tzfile()

NV_INT32 add_tzfile ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3695 of file tcmgr.cpp.

◆ close_tide_db()

void close_tide_db ( )

Definition at line 5335 of file tcmgr.cpp.

◆ create_tide_db()

NV_BOOL create_tide_db ( const NV_CHAR *  file,
NV_U_INT32  constituents,
NV_CHAR const *const  constituent[],
const NV_FLOAT64 *  speed,
NV_INT32  start_year,
NV_U_INT32  num_years,
NV_FLOAT32 const *const  equilibrium[],
NV_FLOAT32 const *const  node_factor[] 
)

Definition at line 5466 of file tcmgr.cpp.

◆ dump_tide_record()

void dump_tide_record ( const TIDE_RECORD rec)

Definition at line 2338 of file tcmgr.cpp.

◆ find_constituent()

NV_INT32 find_constituent ( const NV_CHAR *  name)

Definition at line 3485 of file tcmgr.cpp.

◆ find_country()

NV_INT32 find_country ( const NV_CHAR *  name)

Definition at line 3267 of file tcmgr.cpp.

◆ find_datum()

NV_INT32 find_datum ( const NV_CHAR *  name)

Definition at line 3415 of file tcmgr.cpp.

◆ find_dir_units()

NV_INT32 find_dir_units ( const NV_CHAR *  name)

Definition at line 3351 of file tcmgr.cpp.

◆ find_legalese()

NV_INT32 find_legalese ( const NV_CHAR *  name)

Definition at line 3442 of file tcmgr.cpp.

◆ find_level_units()

NV_INT32 find_level_units ( const NV_CHAR *  name)

Definition at line 3309 of file tcmgr.cpp.

◆ find_or_add_country()

NV_INT32 find_or_add_country ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3982 of file tcmgr.cpp.

◆ find_or_add_datum()

NV_INT32 find_or_add_datum ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3993 of file tcmgr.cpp.

◆ find_or_add_legalese()

NV_INT32 find_or_add_legalese ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 4004 of file tcmgr.cpp.

◆ find_or_add_restriction()

NV_INT32 find_or_add_restriction ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3960 of file tcmgr.cpp.

◆ find_or_add_tzfile()

NV_INT32 find_or_add_tzfile ( const NV_CHAR *  name,
DB_HEADER_PUBLIC db 
)

Definition at line 3971 of file tcmgr.cpp.

◆ find_restriction()

NV_INT32 find_restriction ( const NV_CHAR *  name)

Definition at line 3522 of file tcmgr.cpp.

◆ find_station()

NV_INT32 find_station ( const NV_CHAR *  name)

Definition at line 3190 of file tcmgr.cpp.

◆ find_tzfile()

NV_INT32 find_tzfile ( const NV_CHAR *  name)

Definition at line 3225 of file tcmgr.cpp.

◆ get_constituent()

const NV_CHAR * get_constituent ( NV_INT32  num)

Definition at line 2516 of file tcmgr.cpp.

◆ get_country()

const NV_CHAR * get_country ( NV_INT32  num)

Definition at line 2433 of file tcmgr.cpp.

◆ get_datum()

const NV_CHAR * get_datum ( NV_INT32  num)

Definition at line 2653 of file tcmgr.cpp.

◆ get_dir_units()

const NV_CHAR * get_dir_units ( NV_INT32  num)

Definition at line 2574 of file tcmgr.cpp.

◆ get_equilibrium()

NV_FLOAT32 get_equilibrium ( NV_INT32  num,
NV_INT32  year 
)

Definition at line 2723 of file tcmgr.cpp.

◆ get_equilibriums()

NV_FLOAT32 * get_equilibriums ( NV_INT32  num)

Definition at line 2737 of file tcmgr.cpp.

◆ get_legalese()

const NV_CHAR * get_legalese ( NV_INT32  num)

Definition at line 2666 of file tcmgr.cpp.

◆ get_level_units()

const NV_CHAR * get_level_units ( NV_INT32  num)

Definition at line 2545 of file tcmgr.cpp.

◆ get_nearest_partial_tide_record()

NV_INT32 get_nearest_partial_tide_record ( NV_FLOAT64  lat,
NV_FLOAT64  lon,
TIDE_STATION_HEADER rec 
)

Definition at line 2882 of file tcmgr.cpp.

◆ get_next_partial_tide_record()

NV_INT32 get_next_partial_tide_record ( TIDE_STATION_HEADER rec)

Definition at line 2856 of file tcmgr.cpp.

◆ get_node_factor()

NV_FLOAT32 get_node_factor ( NV_INT32  num,
NV_INT32  year 
)

Definition at line 2766 of file tcmgr.cpp.

◆ get_node_factors()

NV_FLOAT32 * get_node_factors ( NV_INT32  num)

Definition at line 2780 of file tcmgr.cpp.

◆ get_partial_tide_record()

NV_BOOL get_partial_tide_record ( NV_INT32  num,
TIDE_STATION_HEADER rec 
)

Definition at line 2813 of file tcmgr.cpp.

◆ get_restriction()

const NV_CHAR * get_restriction ( NV_INT32  num)

Definition at line 2603 of file tcmgr.cpp.

◆ get_speed()

NV_FLOAT64 get_speed ( NV_INT32  num)

Definition at line 2694 of file tcmgr.cpp.

◆ get_station()

const NV_CHAR * get_station ( NV_INT32  num)

Definition at line 2487 of file tcmgr.cpp.

◆ get_tide_db_header()

DB_HEADER_PUBLIC get_tide_db_header ( )

Definition at line 3031 of file tcmgr.cpp.

◆ get_time()

NV_INT32 get_time ( const NV_CHAR *  string)

Definition at line 2922 of file tcmgr.cpp.

◆ get_tzfile()

const NV_CHAR * get_tzfile ( NV_INT32  num)

Definition at line 2460 of file tcmgr.cpp.

◆ infer_constituents()

NV_BOOL infer_constituents ( TIDE_RECORD rec)

Definition at line 7050 of file tcmgr.cpp.

◆ open_tide_db()

NV_BOOL open_tide_db ( const NV_CHAR *  file)

Definition at line 5299 of file tcmgr.cpp.

◆ read_next_tide_record()

NV_INT32 read_next_tide_record ( TIDE_RECORD rec)

Definition at line 6355 of file tcmgr.cpp.

◆ read_tide_record()

NV_INT32 read_tide_record ( NV_INT32  num,
TIDE_RECORD rec 
)

Definition at line 6699 of file tcmgr.cpp.

◆ ret_date()

NV_CHAR * ret_date ( NV_U_INT32  date)

Definition at line 3000 of file tcmgr.cpp.

◆ ret_time()

NV_CHAR * ret_time ( NV_INT32  time)

Definition at line 2959 of file tcmgr.cpp.

◆ ret_time_neat()

NV_CHAR * ret_time_neat ( NV_INT32  time)

Definition at line 2979 of file tcmgr.cpp.

◆ search_station()

NV_INT32 search_station ( const NV_CHAR *  string)

Definition at line 3140 of file tcmgr.cpp.

◆ set_equilibrium()

void set_equilibrium ( NV_INT32  num,
NV_INT32  year,
NV_FLOAT32  value 
)

Definition at line 3600 of file tcmgr.cpp.

◆ set_node_factor()

void set_node_factor ( NV_INT32  num,
NV_INT32  year,
NV_FLOAT32  value 
)

Definition at line 3633 of file tcmgr.cpp.

◆ set_speed()

void set_speed ( NV_INT32  num,
NV_FLOAT64  value 
)

Definition at line 3563 of file tcmgr.cpp.

◆ update_tide_record()

NV_BOOL update_tide_record ( NV_INT32  num,
TIDE_RECORD rec,
DB_HEADER_PUBLIC db 
)

Definition at line 6935 of file tcmgr.cpp.

Variable Documentation

◆ ptcmgr

TCMgr* ptcmgr
extern

Global instance.

Definition at line 42 of file tcmgr.cpp.