vrpRouting  0.3
vehicles_input.h File Reference
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for vehicles_input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct Vehicle_t Vehicle_t
 

Functions

void get_vehicles (char *, Vehicle_t **, size_t *, bool)
 Reads the vehicles information. More...
 
void get_vehicles_euclidean (char *, Vehicle_t **, size_t *, bool)
 Reads the vehicles information. More...
 
void get_vehicles_raw (char *, Vehicle_t **, size_t *, bool)
 Reads the vehicles information. More...
 

Typedef Documentation

◆ Vehicle_t

typedef struct Vehicle_t Vehicle_t

Definition at line 32 of file vehicles_input.h.

Function Documentation

◆ 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
Column_info_t::strict
bool strict
Definition: column_info_t.h:56
Column_info_t::name
char * name
Definition: column_info_t.h:57
INTERVAL
@ INTERVAL
Definition: column_info_t.h:48
ANY_INTEGER_ARRAY
@ ANY_INTEGER_ARRAY
Definition: column_info_t.h:46
Column_info_t::eType
expectType eType
Definition: column_info_t.h:58
ANY_INTEGER
@ ANY_INTEGER
Definition: column_info_t.h:40
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
ANY_NUMERICAL
@ ANY_NUMERICAL
Definition: column_info_t.h:41
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