Skip to content

Commit 1f73cd6

Browse files
authored
To cpp arrays input (#2497)
* 🚚 moving arrays_input for cpp compilation * 🔨 arrays_input is compiled as cpp and linked as C * 🔧 adjusting code to the one function for getting integer arrays from postgres * 📚 🐛 fixing doxygen documentation
1 parent 2c04ee5 commit 1f73cd6

35 files changed

+105
-124
lines changed

include/c_common/arrays_input.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/*PGR-GNU*****************************************************************
22
File: arrays_input.h
33
4+
Copyright (c) 2023 Celia Virginia Vergara Castillo
45
Copyright (c) 2015 Celia Virginia Vergara Castillo
5-
6+
mail: vicky at erosion.dev
67
78
------
89
@@ -26,15 +27,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2627
#define INCLUDE_C_COMMON_ARRAYS_INPUT_H_
2728
#pragma once
2829

29-
30+
#include <stddef.h>
3031
#include <stdint.h>
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
3137
#include <postgres.h>
3238
#include <utils/array.h>
3339

3440
/** @brief Enforces the input array to be @b NOT empty */
35-
int64_t* pgr_get_bigIntArray(size_t *arrlen, ArrayType *input);
41+
int64_t* pgr_get_bigIntArray(size_t*, ArrayType*, bool);
3642

37-
/** @brief Allows the input array to be empty */
38-
int64_t* pgr_get_bigIntArray_allowEmpty(size_t *arrlen, ArrayType *input);
43+
#ifdef __cplusplus
44+
}
45+
#endif
3946

4047
#endif // INCLUDE_C_COMMON_ARRAYS_INPUT_H_

src/astar/astar.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ process(char* edges_sql,
102102
pgr_get_edges_xy(edges_sql, &edges, &total_edges, true);
103103
if (starts && ends) {
104104
start_vidsArr = (int64_t*)
105-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
105+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
106106
end_vidsArr = (int64_t*)
107-
pgr_get_bigIntArray(&size_end_vidsArr, ends);
107+
pgr_get_bigIntArray(&size_end_vidsArr, ends, false);
108108
} else if (combinations_sql) {
109109
pgr_get_combinations(combinations_sql, &combinations, &total_combinations);
110110
}
111111
} else {
112112
pgr_get_edges_xy(edges_sql, &edges, &total_edges, false);
113113
end_vidsArr = (int64_t*)
114-
pgr_get_bigIntArray(&size_end_vidsArr, starts);
114+
pgr_get_bigIntArray(&size_end_vidsArr, starts, false);
115115
start_vidsArr = (int64_t*)
116-
pgr_get_bigIntArray(&size_start_vidsArr, ends);
116+
pgr_get_bigIntArray(&size_start_vidsArr, ends, false);
117117
}
118118

119119
if (total_edges == 0) {

src/bdAstar/bdAstar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ process(char* edges_sql,
7777

7878
if (starts && ends) {
7979
start_vidsArr = (int64_t*)
80-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
80+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
8181
end_vidsArr = (int64_t*)
82-
pgr_get_bigIntArray(&size_end_vidsArr, ends);
82+
pgr_get_bigIntArray(&size_end_vidsArr, ends, false);
8383
} else if (combinations_sql) {
8484
pgr_get_combinations(combinations_sql, &combinations, &total_combinations);
8585
}

src/bdDijkstra/bdDijkstra.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ process(
7575

7676
if (starts && ends) {
7777
start_vidsArr = (int64_t*)
78-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
78+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
7979
end_vidsArr = (int64_t*)
80-
pgr_get_bigIntArray(&size_end_vidsArr, ends);
80+
pgr_get_bigIntArray(&size_end_vidsArr, ends, false);
8181
} else if (combinations_sql) {
8282
pgr_get_combinations(combinations_sql, &combinations, &total_combinations);
8383
}

src/bellman_ford/bellman_ford.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ process(
7272

7373
if (starts && ends) {
7474
start_vidsArr = (int64_t*)
75-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
75+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
7676
end_vidsArr = (int64_t*)
77-
pgr_get_bigIntArray(&size_end_vidsArr, ends);
77+
pgr_get_bigIntArray(&size_end_vidsArr, ends, false);
7878
} else if (combinations_sql) {
7979
pgr_get_combinations(combinations_sql, &combinations, &total_combinations);
8080
if (total_combinations == 0) {

src/bellman_ford/bellman_ford_neg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ process(
7272

7373
if (starts && ends) {
7474
start_vidsArr = (int64_t*)
75-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
75+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
7676
end_vidsArr = (int64_t*)
77-
pgr_get_bigIntArray(&size_end_vidsArr, ends);
77+
pgr_get_bigIntArray(&size_end_vidsArr, ends, false);
7878
} else if (combinations_sql) {
7979
pgr_get_combinations(combinations_sql, &combinations, &total_combinations);
8080
if (total_combinations == 0) {

src/bellman_ford/edwardMoore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ process(
7070

7171
if (starts && ends) {
7272
start_vidsArr = (int64_t*)
73-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
73+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
7474
end_vidsArr = (int64_t*)
75-
pgr_get_bigIntArray(&size_end_vidsArr, ends);
75+
pgr_get_bigIntArray(&size_end_vidsArr, ends, false);
7676
} else if (combinations_sql) {
7777
pgr_get_combinations(combinations_sql, &combinations, &total_combinations);
7878
if (total_combinations == 0) {

src/breadthFirstSearch/binaryBreadthFirstSearch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ process(
7070

7171
if (starts && ends) {
7272
start_vidsArr = (int64_t*)
73-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
73+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
7474
end_vidsArr = (int64_t*)
75-
pgr_get_bigIntArray(&size_end_vidsArr, ends);
75+
pgr_get_bigIntArray(&size_end_vidsArr, ends, false);
7676
} else if (combinations_sql) {
7777
pgr_get_combinations(combinations_sql, &combinations, &total_combinations);
7878
if (total_combinations == 0) {

src/breadthFirstSearch/breadthFirstSearch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ process(
6161

6262
size_t size_start_vidsArr = 0;
6363
int64_t *start_vidsArr = (int64_t *)
64-
pgr_get_bigIntArray(&size_start_vidsArr, starts);
64+
pgr_get_bigIntArray(&size_start_vidsArr, starts, false);
6565
PGR_DBG("start_vidsArr size %ld ", size_start_vidsArr);
6666

6767

src/circuits/hawickCircuits.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ PG_FUNCTION_INFO_V1(_pgr_hawickcircuits);
5454
* @param edges_sql the edges of the SQL query
5555
* @param result_tuples the rows in the result
5656
* @param result_count the count of rows in the result
57-
*
58-
* @returns void
5957
*/
6058

6159
static void

0 commit comments

Comments
 (0)