vrpRouting  0.3
matrix_input.h File Reference
#include <stddef.h>
#include "c_common/get_check_data.h"
#include "c_types/column_info_t.h"
#include "c_types/vroom/vroom_matrix_t.h"
Include dependency graph for matrix_input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void get_vroom_matrix (char *matrix_sql, Vroom_matrix_t **matrix, size_t *total_matrix_rows, bool is_plain)
 Reads the VROOM matrix. More...
 

Function Documentation

◆ get_vroom_matrix()

void get_vroom_matrix ( char *  sql,
Vroom_matrix_t **  rows,
size_t *  total_rows,
bool  is_plain 
)

Reads the VROOM matrix.

Parameters
[in]sqlSQL query that has the following columns: start_id, end_id, duration, cost
[in]is_plainWhether the plain or timestamp function is used
[out]rowsC Container that holds all the matrix rows
[out]total_rowsTotal rows recieved

cost is not mandatory

Definition at line 159 of file matrix_input.c.

163  {
164  int kColumnCount = 4;
165  Column_info_t info[kColumnCount];
166 
167  for (int i = 0; i < kColumnCount; ++i) {
168  info[i].colNumber = -1;
169  info[i].type = 0;
170  info[i].strict = true;
171  info[i].eType = ANY_INTEGER;
172  }
173  info[0].name = "start_id";
174  info[1].name = "end_id";
175  info[2].name = "duration";
176  info[3].name = "cost";
177 
178  info[2].eType = INTEGER; // duration
179  info[3].eType = INTEGER; // cost
180 
181  if (!is_plain) {
182  info[2].eType = INTERVAL; // duration
183  }
184 
188  info[3].strict = false;
189 
190  db_get_matrix(sql, rows, total_rows, info, kColumnCount, is_plain);
191 }

References ANY_INTEGER, Column_info_t::colNumber, db_get_matrix(), Column_info_t::eType, INTEGER, INTERVAL, 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
db_get_matrix
static void db_get_matrix(char *matrix_sql, Vroom_matrix_t **matrix, size_t *total_matrix_rows, Column_info_t *info, const int column_count, bool is_plain)
Definition: matrix_input.c:77
Column_info_t::name
char * name
Definition: column_info_t.h:57
INTERVAL
@ INTERVAL
Definition: column_info_t.h:48
Column_info_t::eType
expectType eType
Definition: column_info_t.h:58
ANY_INTEGER
@ ANY_INTEGER
Definition: column_info_t.h:40
Column_info_t::type
uint64_t type
Definition: column_info_t.h:55
Column_info_t
Definition: column_info_t.h:52
INTEGER
@ INTEGER
Definition: column_info_t.h:39