vrpRouting  0.3
vehicles_input.c File Reference
#include "c_common/vehicles_input.h"
#include <limits.h>
#include <float.h>
#include "c_types/column_info_t.h"
#include "c_types/vehicle_t.h"
#include "c_common/get_check_data.h"
Include dependency graph for vehicles_input.c:

Go to the source code of this file.

Functions

static void check_pairs (Column_info_t lhs, Column_info_t rhs)
 
static void db_get_vehicles (char *vehicles_sql, Vehicle_t **vehicles, size_t *total_vehicles, Column_info_t *info, const int column_count, int kind, bool with_stops)
 
static void fetch_euclidean (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t *info, Vehicle_t *vehicle, bool with_stops)
 
static void fetch_raw (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t *info, Vehicle_t *vehicle, bool with_stops)
 
static void fetch_timestamps (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t *info, Vehicle_t *vehicle, bool with_stops)
 
void get_vehicles (char *sql, Vehicle_t **rows, size_t *total_rows, bool with_stops)
 Reads the vehicles information. More...
 
void get_vehicles_euclidean (char *sql, Vehicle_t **rows, size_t *total_rows, bool with_stops)
 Reads the vehicles information. More...
 
void get_vehicles_raw (char *sql, Vehicle_t **rows, size_t *total_rows, bool with_stops)
 Reads the vehicles information. More...
 

Function Documentation

◆ check_pairs()

static void check_pairs ( Column_info_t  lhs,
Column_info_t  rhs 
)
static

Definition at line 194 of file vehicles_input.c.

194  {
195  if (!(column_found(lhs.colNumber)) && column_found(rhs.colNumber)) {
196  ereport(ERROR,
197  (errmsg("Column \'%s\' not Found", lhs.name),
198  errhint("%s was found, also column is expected %s ",
199  rhs.name, lhs.name)));
200  }
201 }

References Column_info_t::colNumber, column_found(), and Column_info_t::name.

Referenced by fetch_euclidean(), fetch_raw(), and fetch_timestamps().

◆ db_get_vehicles()

static void db_get_vehicles ( char *  vehicles_sql,
Vehicle_t **  vehicles,
size_t *  total_vehicles,
Column_info_t info,
const int  column_count,
int  kind,
bool  with_stops 
)
static

Definition at line 377 of file vehicles_input.c.

386  {
387 #ifdef PROFILE
388  clock_t start_t = clock();
389  PGR_DBG("%s", vehicles_sql);
390 #endif
391 
392  const int tuple_limit = 1000000;
393 
394  size_t total_tuples;
395 
396  void *SPIplan;
397  SPIplan = pgr_SPI_prepare(vehicles_sql);
398  Portal SPIportal;
399  SPIportal = pgr_SPI_cursor_open(SPIplan);
400 
401  bool moredata = true;
402  (*total_vehicles) = total_tuples = 0;
403 
404  /* on the first tuple get the column numbers */
405 
406  while (moredata == true) {
407  SPI_cursor_fetch(SPIportal, true, tuple_limit);
408  if (total_tuples == 0) {
409  pgr_fetch_column_info(info, column_count);
410  }
411  size_t ntuples = SPI_processed;
412  total_tuples += ntuples;
413  if (ntuples > 0) {
414  if ((*vehicles) == NULL)
415  (*vehicles) = (Vehicle_t *)palloc0(
416  total_tuples * sizeof(Vehicle_t));
417  else
418  (*vehicles) = (Vehicle_t *)repalloc(
419  (*vehicles),
420  total_tuples * sizeof(Vehicle_t));
421 
422  if ((*vehicles) == NULL) {
423  elog(ERROR, "Out of memory");
424  }
425 
426  size_t t;
427  SPITupleTable *tuptable = SPI_tuptable;
428  TupleDesc tupdesc = SPI_tuptable->tupdesc;
429  for (t = 0; t < ntuples; t++) {
430  HeapTuple tuple = tuptable->vals[t];
431  switch (kind) {
432  case 0 : fetch_timestamps(&tuple, &tupdesc, info,
433  &(*vehicles)[total_tuples - ntuples + t], with_stops);
434  break;
435  case 1 : fetch_raw(&tuple, &tupdesc, info,
436  &(*vehicles)[total_tuples - ntuples + t], with_stops);
437  break;
438  case 2 : fetch_euclidean(&tuple, &tupdesc, info,
439  &(*vehicles)[total_tuples - ntuples + t], with_stops);
440  break;
441  }
442  }
443  SPI_freetuptable(tuptable);
444  } else {
445  moredata = false;
446  }
447  }
448 
449  SPI_cursor_close(SPIportal);
450 
451  if (total_tuples == 0) {
452  (*total_vehicles) = 0;
453  return;
454  }
455 
456  (*total_vehicles) = total_tuples;
457 #ifdef PROFILE
458  time_msg("reading vehicles", start_t, clock());
459 #endif
460 }

References fetch_euclidean(), fetch_raw(), fetch_timestamps(), PGR_DBG, pgr_fetch_column_info(), pgr_SPI_cursor_open(), pgr_SPI_prepare(), and time_msg().

Referenced by get_vehicles(), get_vehicles_euclidean(), and get_vehicles_raw().

◆ fetch_euclidean()

static void fetch_euclidean ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t info,
Vehicle_t vehicle,
bool  with_stops 
)
static

Definition at line 204 of file vehicles_input.c.

209  {
210  bool with_id = false;
211  /*
212  * s_tw_open, s_tw_close must exist or non at all
213  */
214  check_pairs(info[4], info[5]);
215  check_pairs(info[5], info[4]);
216  /*
217  * e_tw_open, e_tw_close must exist or non at all
218  */
219  check_pairs(info[6], info[7]);
220  check_pairs(info[7], info[6]);
221 
222  /*
223  * e_x, e_y must exist or non at all
224  */
225  check_pairs(info[13], info[14]);
226  check_pairs(info[14], info[13]);
227 
228  vehicle->id = get_Id(tuple, tupdesc, info[0], -1);
229  vehicle->capacity = get_PositiveAmount(tuple, tupdesc, info[1], 0);
230  vehicle->cant_v = get_PositiveAmount(tuple, tupdesc, info[2], 1);
231  vehicle->speed = column_found(info[3].colNumber) ? spi_getFloat8(tuple, tupdesc, info[3]) : 1;
232 
233  /*
234  * start values
235  */
236  vehicle->start_open_t = get_TTimestamp_plain(tuple, tupdesc, info[4], 0);
237  vehicle->start_close_t = get_TTimestamp_plain(tuple, tupdesc, info[5], INT64_MAX);
238 
239  /*
240  * end values
241  */
242  vehicle->end_open_t = get_TTimestamp_plain(tuple, tupdesc, info[6], vehicle->start_open_t);
243  vehicle->end_close_t = get_TTimestamp_plain(tuple, tupdesc, info[7], vehicle->start_close_t);
244 
245  /*
246  * service time values
247  */
248  vehicle->start_service_t = get_PositiveTInterval_plain(tuple, tupdesc, info[9], 0);
249  vehicle->end_service_t = get_PositiveTInterval_plain(tuple, tupdesc, info[10], 0);
250 
251  /*
252  * stops
253  */
254  vehicle->stops = NULL;
255  vehicle->stops_size = 0;
256  if (with_stops && column_found(info[8].colNumber)) {
257  vehicle->stops = spi_getBigIntArr_allowEmpty(tuple, tupdesc, info[8], &vehicle->stops_size);
258  }
259 
260  /*
261  * Values for eucledian
262  */
263  vehicle->start_x = with_id ? 0 : spi_getCoordinate(tuple, tupdesc, info[11], 0);
264  vehicle->start_y = with_id ? 0 : spi_getCoordinate(tuple, tupdesc, info[12], 0);
265  vehicle->end_x = with_id ? 0 : spi_getCoordinate(tuple, tupdesc, info[13], vehicle->start_x);
266  vehicle->end_y = with_id ? 0 : spi_getCoordinate(tuple, tupdesc, info[14], vehicle->start_y);
267 }

References Vehicle_t::cant_v, Vehicle_t::capacity, check_pairs(), column_found(), Vehicle_t::end_close_t, Vehicle_t::end_open_t, Vehicle_t::end_service_t, Vehicle_t::end_x, Vehicle_t::end_y, get_Id(), get_PositiveAmount(), get_PositiveTInterval_plain(), get_TTimestamp_plain(), Vehicle_t::id, Vehicle_t::speed, spi_getBigIntArr_allowEmpty(), spi_getCoordinate(), spi_getFloat8(), Vehicle_t::start_close_t, Vehicle_t::start_open_t, Vehicle_t::start_service_t, Vehicle_t::start_x, Vehicle_t::start_y, Vehicle_t::stops, and Vehicle_t::stops_size.

Referenced by db_get_vehicles().

◆ fetch_raw()

static void fetch_raw ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t info,
Vehicle_t vehicle,
bool  with_stops 
)
static

Definition at line 270 of file vehicles_input.c.

275  {
276  /*
277  * s_tw_open, s_tw_close must exist or non at all
278  */
279  check_pairs(info[6], info[7]);
280  check_pairs(info[7], info[6]);
281  /*
282  * e_tw_open, e_tw_close must exist or non at all
283  */
284  check_pairs(info[10], info[11]);
285  check_pairs(info[10], info[11]);
286 
287  vehicle->id = get_Id(tuple, tupdesc, info[0], -1);
288  vehicle->capacity = get_PositiveAmount(tuple, tupdesc, info[1], 0);
289  vehicle->cant_v = get_PositiveAmount(tuple, tupdesc, info[2], 1);
290  vehicle->speed = column_found(info[3].colNumber) ? spi_getFloat8(tuple, tupdesc, info[3]) : 1;
291  vehicle->stops = NULL;
292  vehicle->stops_size = 0;
293  if (with_stops && column_found(info[4].colNumber)) {
294  vehicle->stops = spi_getBigIntArr_allowEmpty(tuple, tupdesc, info[4], &vehicle->stops_size);
295  }
296 
297  /*
298  * start values
299  */
300  vehicle->start_node_id = get_Id(tuple, tupdesc, info[5], -1);
301  vehicle->start_open_t = get_TTimestamp_plain(tuple, tupdesc, info[6], 0);
302  vehicle->start_close_t = get_TTimestamp_plain(tuple, tupdesc, info[7], INT64_MAX);
303  vehicle->start_service_t = get_PositiveTInterval_plain(tuple, tupdesc, info[8], 0);
304 
305  /*
306  * end values
307  */
308  vehicle->end_node_id = get_Id(tuple, tupdesc, info[9], vehicle->start_node_id);
309  vehicle->end_open_t = get_TTimestamp_plain(tuple, tupdesc, info[10], vehicle->start_open_t);
310  vehicle->end_close_t = get_TTimestamp_plain(tuple, tupdesc, info[11], vehicle->start_close_t);
311  vehicle->end_service_t = get_PositiveTInterval_plain(tuple, tupdesc, info[12], 0);
312 
313  /*
314  * Ignored values
315  */
316  vehicle->start_x = 0;
317  vehicle->start_y = 0;
318  vehicle->end_x = 0;
319  vehicle->end_y = 0;
320 }

References Vehicle_t::cant_v, Vehicle_t::capacity, check_pairs(), column_found(), Vehicle_t::end_close_t, Vehicle_t::end_node_id, Vehicle_t::end_open_t, Vehicle_t::end_service_t, Vehicle_t::end_x, Vehicle_t::end_y, get_Id(), get_PositiveAmount(), get_PositiveTInterval_plain(), get_TTimestamp_plain(), Vehicle_t::id, Vehicle_t::speed, spi_getBigIntArr_allowEmpty(), spi_getFloat8(), Vehicle_t::start_close_t, Vehicle_t::start_node_id, Vehicle_t::start_open_t, Vehicle_t::start_service_t, Vehicle_t::start_x, Vehicle_t::start_y, Vehicle_t::stops, and Vehicle_t::stops_size.

Referenced by db_get_vehicles().

◆ fetch_timestamps()

static void fetch_timestamps ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t info,
Vehicle_t vehicle,
bool  with_stops 
)
static

Definition at line 323 of file vehicles_input.c.

328  {
329  /*
330  * s_tw_open, s_tw_close must exist or non at all
331  */
332  check_pairs(info[6], info[7]);
333  check_pairs(info[7], info[6]);
334  /*
335  * e_tw_open, e_tw_close must exist or non at all
336  */
337  check_pairs(info[10], info[11]);
338  check_pairs(info[10], info[11]);
339 
340  vehicle->id = get_Id(tuple, tupdesc, info[0], -1);
341  vehicle->capacity = get_PositiveAmount(tuple, tupdesc, info[1], 0);
342  vehicle->cant_v = get_PositiveAmount(tuple, tupdesc, info[2], 1);
343  vehicle->speed = column_found(info[3].colNumber) ? spi_getFloat8(tuple, tupdesc, info[3]) : 1;
344  vehicle->stops = NULL;
345  vehicle->stops_size = 0;
346  if (with_stops && column_found(info[4].colNumber)) {
347  vehicle->stops = spi_getBigIntArr_allowEmpty(tuple, tupdesc, info[4], &vehicle->stops_size);
348  }
349 
350  /*
351  * start values
352  */
353  vehicle->start_node_id = get_Id(tuple, tupdesc, info[5], -1);
354  vehicle->start_open_t = get_TTimestamp(tuple, tupdesc, info[6], 0);
355  vehicle->start_close_t = get_TTimestamp(tuple, tupdesc, info[7], INT64_MAX);
356  vehicle->start_service_t = get_PositiveTInterval(tuple, tupdesc, info[8], 0);
357 
358  /*
359  * end values
360  */
361  vehicle->end_node_id = get_Id(tuple, tupdesc, info[9], vehicle->start_node_id);
362  vehicle->end_open_t = get_TTimestamp(tuple, tupdesc, info[10], vehicle->start_open_t);
363  vehicle->end_close_t = get_TTimestamp(tuple, tupdesc, info[11], vehicle->start_close_t);
364  vehicle->end_service_t = get_PositiveTInterval(tuple, tupdesc, info[12], 0);
365 
366  /*
367  * Ignored values
368  */
369  vehicle->start_x = 0;
370  vehicle->start_y = 0;
371  vehicle->end_x = 0;
372  vehicle->end_y = 0;
373 }

References Vehicle_t::cant_v, Vehicle_t::capacity, check_pairs(), column_found(), Vehicle_t::end_close_t, Vehicle_t::end_node_id, Vehicle_t::end_open_t, Vehicle_t::end_service_t, Vehicle_t::end_x, Vehicle_t::end_y, get_Id(), get_PositiveAmount(), get_PositiveTInterval(), get_TTimestamp(), Vehicle_t::id, Vehicle_t::speed, spi_getBigIntArr_allowEmpty(), spi_getFloat8(), Vehicle_t::start_close_t, Vehicle_t::start_node_id, Vehicle_t::start_open_t, Vehicle_t::start_service_t, Vehicle_t::start_x, Vehicle_t::start_y, Vehicle_t::stops, and Vehicle_t::stops_size.

Referenced by db_get_vehicles().

◆ get_vehicles()

void get_vehicles ( char *  sql,
Vehicle_t **  rows,
size_t *  total_rows,
bool  with_stops 
)

Reads the vehicles information.

Parameters
[in]sqlSQL query to execute
[in]with_stopsdo not ignore stops column
[out]rowsC Container that holds the data
[out]total_rowsTotal rows recieved

Definition at line 469 of file vehicles_input.c.

473  {
474  const int column_count = 13;
475  Column_info_t info[13];
476 
477  for (int i = 0; i < column_count; ++i) {
478  info[i].colNumber = -1;
479  info[i].type = 0;
480  info[i].strict = false;
481  info[i].eType = ANY_INTEGER;
482  }
483 
484  info[0].name = "id";
485  info[1].name = "capacity";
486  info[2].name = "number";
487  info[3].name = "speed";
488  info[4].name = "stops";
489  info[5].name = "s_id";
490  info[6].name = "s_tw_open";
491  info[7].name = "s_tw_close";
492  info[8].name = "s_t_service";
493  info[9].name = "e_id";
494  info[10].name = "e_tw_open";
495  info[11].name = "e_tw_close";
496  info[12].name = "e_t_service";
497 
498  info[6].eType = TIMESTAMP;
499  info[7].eType = TIMESTAMP;
500  info[10].eType = TIMESTAMP;
501  info[11].eType = TIMESTAMP;
502  info[8].eType = INTERVAL;
503  info[12].eType = INTERVAL;
504 
505  info[4].eType = ANY_INTEGER_ARRAY; // stops
506  info[3].eType = ANY_NUMERICAL; // speed
507 
508  info[0].strict = true;
509  info[1].strict = true;
510  info[5].strict = true;
511 
512  db_get_vehicles(sql, rows, total_rows, info, column_count, 0, with_stops);
513 }

References ANY_INTEGER, ANY_INTEGER_ARRAY, ANY_NUMERICAL, Column_info_t::colNumber, db_get_vehicles(), Column_info_t::eType, INTERVAL, Column_info_t::name, Column_info_t::strict, TIMESTAMP, and Column_info_t::type.

Referenced by process().

◆ get_vehicles_euclidean()

void get_vehicles_euclidean ( char *  sql,
Vehicle_t **  rows,
size_t *  total_rows,
bool  with_stops 
)

Reads the vehicles information.

Parameters
[in]sqlSQL query to execute
[in]with_stopsdo not ignore stops column
[out]rowsC Container that holds the data
[out]total_rowsTotal rows recieved

Definition at line 569 of file vehicles_input.c.

573  {
574  const int column_count = 15;
575  Column_info_t info[15];
576 
577  for (int i = 0; i < column_count; ++i) {
578  info[i].colNumber = -1;
579  info[i].type = 0;
580  info[i].strict = false;
581  info[i].eType = ANY_INTEGER;
582  }
583 
584  info[0].name = "id";
585  info[1].name = "capacity";
586  info[2].name = "number";
587  info[3].name = "speed";
588  info[4].name = "s_open";
589  info[5].name = "s_close";
590  info[6].name = "e_open";
591  info[7].name = "e_close";
592  info[8].name = "stops";
593  info[9].name = "s_service";
594  info[10].name = "e_service";
595  info[11].name = "s_x";
596  info[12].name = "s_y";
597  info[13].name = "e_x";
598  info[14].name = "e_y";
599 
600 
601  info[8].eType = ANY_INTEGER_ARRAY; // stops
602  info[11].eType = ANY_NUMERICAL; // s_x
603  info[12].eType = ANY_NUMERICAL; // s_y
604  info[13].eType = ANY_NUMERICAL; // e_x
605  info[14].eType = ANY_NUMERICAL; // e_y
606 
607  info[0].strict = true;
608  info[1].strict = true;
609  info[11].strict = true;
610  info[12].strict = true;
611 
612  db_get_vehicles(sql, rows, total_rows, info, column_count, 2, with_stops);
613 }

References ANY_INTEGER, ANY_INTEGER_ARRAY, ANY_NUMERICAL, Column_info_t::colNumber, db_get_vehicles(), Column_info_t::eType, Column_info_t::name, Column_info_t::strict, and Column_info_t::type.

Referenced by process().

◆ get_vehicles_raw()

void get_vehicles_raw ( char *  sql,
Vehicle_t **  rows,
size_t *  total_rows,
bool  with_stops 
)

Reads the vehicles information.

Parameters
[in]sqlSQL query to execute
[in]with_stopsdo not ignore stops column
[out]rowsC Container that holds the data
[out]total_rowsTotal rows recieved

Definition at line 522 of file vehicles_input.c.

526  {
527  const int column_count = 13;
528  Column_info_t info[13];
529 
530  for (int i = 0; i < column_count; ++i) {
531  info[i].colNumber = -1;
532  info[i].type = 0;
533  info[i].strict = false;
534  info[i].eType = ANY_INTEGER;
535  }
536 
537  info[0].name = "id";
538  info[1].name = "capacity";
539  info[2].name = "number";
540  info[3].name = "speed";
541  info[4].name = "stops";
542  info[5].name = "s_id";
543  info[6].name = "s_open";
544  info[7].name = "s_close";
545  info[8].name = "s_service";
546  info[9].name = "e_id";
547  info[10].name = "e_open";
548  info[11].name = "e_close";
549  info[12].name = "e_service";
550 
551 
552  info[4].eType = ANY_INTEGER_ARRAY; // stops
553  info[3].eType = ANY_NUMERICAL; // speed
554 
555  info[0].strict = true;
556  info[1].strict = true;
557  info[5].strict = true;
558 
559  db_get_vehicles(sql, rows, total_rows, info, column_count, 1, with_stops);
560 }

References ANY_INTEGER, ANY_INTEGER_ARRAY, ANY_NUMERICAL, Column_info_t::colNumber, db_get_vehicles(), Column_info_t::eType, Column_info_t::name, Column_info_t::strict, and Column_info_t::type.

Referenced by process().

Column_info_t::colNumber
int colNumber
Definition: column_info_t.h:54
Vehicle_t::start_node_id
Id start_node_id
Stops size.
Definition: vehicle_t.h:58
check_pairs
static void check_pairs(Column_info_t lhs, Column_info_t rhs)
Definition: vehicles_input.c:194
Vehicle_t::stops
Id * stops
Number of vehicles with same description.
Definition: vehicle_t.h:55
Column_info_t::strict
bool strict
Definition: column_info_t.h:56
Vehicle_t::end_node_id
Id end_node_id
Definition: vehicle_t.h:65
pgr_SPI_prepare
SPIPlanPtr pgr_SPI_prepare(char *sql)
Definition: postgres_connection.c:88
get_TTimestamp
TTimestamp get_TTimestamp(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TTimestamp opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:457
get_Id
Id get_Id(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Id opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:562
Vehicle_t
vehicles's attributes
Definition: vehicle_t.h:50
fetch_timestamps
static void fetch_timestamps(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t *info, Vehicle_t *vehicle, bool with_stops)
Definition: vehicles_input.c:323
spi_getBigIntArr_allowEmpty
int64_t * spi_getBigIntArr_allowEmpty(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
Function returns the values of specified columns in array.
Definition: get_check_data.c:354
Vehicle_t::start_open_t
TTimestamp start_open_t
Start node's identifier.
Definition: vehicle_t.h:59
pgr_fetch_column_info
void pgr_fetch_column_info(Column_info_t info[], int info_size)
Function tells expected type of each column and then check the correspondence type of each column.
Definition: get_check_data.c:905
Vehicle_t
struct Vehicle_t Vehicle_t
Definition: vehicles_input.h:32
Vehicle_t::end_open_t
TTimestamp end_open_t
End node's identifier.
Definition: vehicle_t.h:66
Vehicle_t::start_y
Coordinate start_y
Definition: vehicle_t.h:63
Column_info_t::name
char * name
Definition: column_info_t.h:57
pgr_SPI_cursor_open
Portal pgr_SPI_cursor_open(SPIPlanPtr SPIplan)
Definition: postgres_connection.c:98
Vehicle_t::start_x
Coordinate start_x
Start service duration.
Definition: vehicle_t.h:62
PGR_DBG
#define PGR_DBG(...)
Definition: debug_macro.h:34
INTERVAL
@ INTERVAL
Definition: column_info_t.h:48
get_PositiveTInterval
TInterval get_PositiveTInterval(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:511
Vehicle_t::start_close_t
TTimestamp start_close_t
Start open time.
Definition: vehicle_t.h:60
ANY_INTEGER_ARRAY
@ ANY_INTEGER_ARRAY
Definition: column_info_t.h:46
Vehicle_t::speed
Speed speed
Vehicle's capacity.
Definition: vehicle_t.h:53
Column_info_t::eType
expectType eType
Definition: column_info_t.h:58
spi_getCoordinate
Coordinate spi_getCoordinate(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Coordinate opt_value)
get a coordinate value
Definition: get_check_data.c:819
time_msg
void time_msg(char *msg, clock_t start_t, clock_t end_t)
Definition: time_msg.c:32
ANY_INTEGER
@ ANY_INTEGER
Definition: column_info_t.h:40
Vehicle_t::end_close_t
TTimestamp end_close_t
End open time.
Definition: vehicle_t.h:67
get_PositiveTInterval_plain
TInterval get_PositiveTInterval_plain(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:546
db_get_vehicles
static void db_get_vehicles(char *vehicles_sql, Vehicle_t **vehicles, size_t *total_vehicles, Column_info_t *info, const int column_count, int kind, bool with_stops)
Definition: vehicles_input.c:377
Vehicle_t::capacity
PAmount capacity
Vehicle's identifier.
Definition: vehicle_t.h:52
Vehicle_t::end_y
Coordinate end_y
Definition: vehicle_t.h:70
Vehicle_t::cant_v
PAmount cant_v
Definition: vehicle_t.h:54
get_PositiveAmount
PAmount get_PositiveAmount(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, PAmount opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:638
ANY_NUMERICAL
@ ANY_NUMERICAL
Definition: column_info_t.h:41
column_found
bool column_found(int colNumber)
Check whether the colNumber represent any specific column or NULL (SPI_ERROR_NOATTRIBUTE).
Definition: get_check_data.c:900
Vehicle_t::stops_size
size_t stops_size
Stops.
Definition: vehicle_t.h:56
Vehicle_t::end_x
Coordinate end_x
End service time.
Definition: vehicle_t.h:69
Vehicle_t::id
Id id
Definition: vehicle_t.h:51
Column_info_t::type
uint64_t type
Definition: column_info_t.h:55
TIMESTAMP
@ TIMESTAMP
Definition: column_info_t.h:47
Column_info_t
Definition: column_info_t.h:52
Vehicle_t::end_service_t
TInterval end_service_t
End close time.
Definition: vehicle_t.h:68
get_TTimestamp_plain
TTimestamp get_TTimestamp_plain(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TTimestamp opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:422
Vehicle_t::start_service_t
TInterval start_service_t
Start close time.
Definition: vehicle_t.h:61
fetch_euclidean
static void fetch_euclidean(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t *info, Vehicle_t *vehicle, bool with_stops)
Definition: vehicles_input.c:204
spi_getFloat8
double spi_getFloat8(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
gets value of specified column in double type.
Definition: get_check_data.c:782
fetch_raw
static void fetch_raw(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t *info, Vehicle_t *vehicle, bool with_stops)
Definition: vehicles_input.c:270