![]() |
MobilityDB 1.3
|
Implementation of a cache storing the route records read from a ways CSV file. More...
#include <assert.h>
#include <float.h>
#include <postgres.h>
#include <liblwgeom.h>
#include <meos.h>
#include "geo/tgeo_spatialfuncs.h"
#include "npoint/tnpoint.h"
Data Structures | |
struct | struct_WaysCache |
The ways cache holds a fixed number of ways records read from the ways table or CSV file. More... | |
struct | struct_WaysCacheEntry |
Structure to represent an entry in the ways cache. More... | |
struct | ways_record |
Structure to represent a record in the ways CSV file. More... | |
Macros | |
#define | MAX_LENGTH_GEOM 100001 |
#define | WAYS_CACHE_SIZE 128 |
#define | WAYS_CSV "/usr/local/share/ways1000.csv" |
Typedefs | |
typedef struct struct_WaysCache | WaysCache |
The ways cache holds a fixed number of ways records read from the ways CSV file. More... | |
typedef struct struct_WaysCacheEntry | WaysCacheEntry |
Structure to represent an entry in the ways cache. More... | |
Functions | |
static WaysCacheEntry * | AddRouteToWaysCache (WaysCache *ways_cache, ways_record *rec) |
Add a route to the ways cache. More... | |
static void | DeleteRouteFromWaysCache (WaysCache *ways_cache, uint32_t position) |
Remove from the ways cache the route in a given position. More... | |
static void | DestroyWaysCache (WaysCache *ways_cache) |
Free all the malloc'ed geometries stored in the ways cache and free the cache. More... | |
Npoint * | geompoint_to_npoint (const GSERIALIZED *gs) |
Transform a geometry into a network point. More... | |
int32_t | get_srid_ways () |
Return the SRID of the routes in the ways table. More... | |
static bool | get_ways_record (int64 rid, ways_record *rec) |
Access the ways CSV file to get the geometry of a route and compute its length. More... | |
static WaysCacheEntry * | GetRouteFromWaysCache (WaysCache *ways_cache, int64 gid, bool any_gid) |
Get a route from the ways cache, if not found return NULL More... | |
static WaysCache * | GetWaysCache () |
Get the ways cache variable from the global variable if one exists. More... | |
void | meos_finalize_ways (void) |
Destroy the ways cache. More... | |
bool | route_exists (int64 rid) |
Return true if the edge table contains a route with the route identifier. More... | |
GSERIALIZED * | route_geom (int64 rid) |
Access the edge table to get the route geometry from corresponding route identifier. More... | |
double | route_length (int64 rid) |
Access the edge table to return the route length from the corresponding route identifier. More... | |
static bool | route_lookup (int64 gid, bool any_gid, ways_record *rec) |
Return true if a Ways entry was read from the ways cache, return false otherwise. More... | |
Variables | |
WaysCache * | MEOS_WAYS_CACHE = NULL |
Implementation of a cache storing the route records read from a ways CSV file.