22#include <grass/dgl/graph.h>
39 int count, last, cur, result, index, more;
58 if (
count == 0 || cur != last) {
83 if (
count != 0 && cur != last)
85 if (
count == 0 || cur != last)
95static int cmp_int(
const void *a,
const void *
b)
97 return *(
int *)a - *(
int *)
b;
119 char *
to_stop,
char *walk_length,
142 Fi->database,
Fi->driver);
153 snprintf(buf,
sizeof(buf),
"select %s from %s order by %s",
Fi->key,
175 for (i = 0; i <
timetable->routes; i++) {
201 snprintf(buf,
sizeof(buf),
"select %s, %s, %s from %s order by %s",
Fi->key,
225 sizeof(
int), cmp_int) -
239 snprintf(buf,
sizeof(buf),
"select %s, %s, %s from %s",
Fi->key,
245 G_warning(
_(
"Unable to open select cursor: %s"),
257 sizeof(
int), cmp_int);
262 sizeof(
int), cmp_int);
285 G_warning(
_(
"Unable to open select cursor: %s"),
298 sizeof(
int), cmp_int);
304 sizeof(
int), cmp_int);
331static neta_heap_data *new_heap_data(
int conns,
int v)
333 neta_heap_data *d = (neta_heap_data *)
G_calloc(1,
sizeof(neta_heap_data));
404 result->
dst = (
int **)
G_calloc(rows,
sizeof(
int *));
415 for (i = 0; i < rows; i++) {
441 for (i = 0; i < rows; i++)
460 v = ((neta_heap_data *)(
heap_node.value.pv))->v;
461 conns = ((neta_heap_data *)(
heap_node.value.pv))->conns;
464 if (dist > result->
dst[conns][v])
476 for (i = 0; i <
timetable->walk_length[v]; i++) {
481 rows, update, result, &
heap);
488 for (i = 0; i <
timetable->stop_length[v]; i++)
508 for (i = 0; i < rows; i++)
552 for (i = 0; i < result->
rows; i++) {
Main header of GRASS DataBase Management Interface.
dbColumn * db_get_table_column(dbTable *, int)
Returns column structure for given table and column number.
dbValue * db_get_column_value(dbColumn *)
Returns column value for given column structure.
int db_close_database_shutdown_driver(dbDriver *)
Close driver/database connection.
char * db_get_string(const dbString *)
Get string.
dbTable * db_get_cursor_table(dbCursor *)
Get table allocated by cursor.
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
int db_get_value_int(dbValue *)
Get integer value.
void db_init_string(dbString *)
Initialize dbString.
int db_close_cursor(dbCursor *)
Close cursor.
int db_open_select_cursor(dbDriver *, dbString *, dbCursor *, int)
Open select cursor.
dbDriver * db_start_driver_open_database(const char *, const char *)
Open driver/database connection.
int db_fetch(dbCursor *, int, int *)
Fetch data from open cursor.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
struct field_info * Vect_get_field(struct Map_info *, int)
Get information about link to database (by layer number)
void Vect_destroy_field_info(struct field_info *)
Free a struct field_info and all memory associated with it.
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
void dglHeapInit(dglHeap_s *pheap)
int dglHeapInsertMin(dglHeap_s *pheap, long key, unsigned char flags, dglHeapData_u value)
void dglHeapFree(dglHeap_s *pheap, dglHeapCancelItem_fn pfnCancelItem)
int dglHeapExtractMin(dglHeap_s *pheap, dglHeapNode_s *pnoderet)
Layer (old: field) information.
char * table
Name of DB table.