Skip to content

Commit 46adce3

Browse files
committed
Fixed all compilation warnings
1 parent 992e784 commit 46adce3

6 files changed

Lines changed: 89 additions & 18 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*PGR-GNU*****************************************************************
2+
File: line_graph_full_rt.h
3+
4+
Generated with Template by:
5+
Copyright (c) 2015 pgRouting developers
6+
Mail: project@pgrouting.org
7+
8+
Function's developer:
9+
Copyright (c) 2018 Anthony Tasca
10+
Mail: atasca10@gmail.com
11+
12+
------
13+
14+
This program is free software; you can redistribute it and/or modify
15+
it under the terms of the GNU General Public License as published by
16+
the Free Software Foundation; either version 2 of the License, or
17+
(at your option) any later version.
18+
19+
This program is distributed in the hope that it will be useful,
20+
but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
GNU General Public License for more details.
23+
24+
You should have received a copy of the GNU General Public License
25+
along with this program; if not, write to the Free Software
26+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27+
28+
********************************************************************PGR-GNU*/
29+
/*! @file */
30+
31+
#ifndef INCLUDE_C_TYPES_LINE_GRAPH_FULL_RT_H_
32+
#define INCLUDE_C_TYPES_LINE_GRAPH_FULL_RT_H_
33+
#pragma once
34+
35+
36+
#ifdef __cplusplus
37+
38+
#include <cstddef>
39+
40+
#else // __cplusplus
41+
42+
// for bool
43+
#ifdef __GNUC__
44+
#pragma GCC diagnostic ignored "-pedantic"
45+
#endif
46+
47+
#include <postgres.h>
48+
49+
#ifdef __GNUC__
50+
#pragma GCC diagnostic pop
51+
#endif
52+
53+
// For NULL & size_t
54+
#include <stdlib.h>
55+
56+
57+
#endif // __cplusplus
58+
59+
// For int64_t etc
60+
#include <stdint.h>
61+
62+
63+
typedef struct {
64+
int64_t id;
65+
int64_t source;
66+
int64_t target;
67+
double cost;
68+
int64_t edge;
69+
} Line_graph_full_rt;
70+
71+
#endif // INCLUDE_C_TYPES_LINE_GRAPH_FULL_RT_H_

include/drivers/lineGraph/lineGraphFull_driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3232
#pragma once
3333

3434
#include "c_types/pgr_edge_t.h"
35-
#include "c_types/line_graph_rt.h"
35+
#include "c_types/line_graph_full_rt.h"
3636

3737
#ifdef __cplusplus
3838
extern "C" {
@@ -48,7 +48,7 @@ extern "C" {
4848
do_pgr_lineGraphFull(
4949
pgr_edge_t *data_edges,
5050
size_t total_edges,
51-
Line_graph_rt **return_tuples,
51+
Line_graph_full_rt **return_tuples,
5252
size_t *return_count,
5353
char ** log_msg,
5454
char ** notice_msg,

include/lineGraph/pgr_lineGraphFull.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ class Pgr_lineGraphFull : public Pgr_base_graph<G, T_V, T_E> {
8080
return log;
8181
}
8282

83-
std::vector< Line_graph_rt >
83+
std::vector< Line_graph_full_rt >
8484
get_postgres_results_directed() {
85-
std::vector< Line_graph_rt > results;
85+
std::vector< Line_graph_full_rt > results;
8686

8787
typename boost::graph_traits < G >::edge_iterator edgeIt, edgeEnd;
8888
std::map <
8989
std::pair<int64_t, int64_t >,
90-
Line_graph_rt > unique;
90+
Line_graph_full_rt > unique;
9191
auto count = 0;
9292
auto vertex_count = 0;
9393
std::map < int64_t, int64_t > vertex_id_map;
@@ -107,7 +107,7 @@ class Pgr_lineGraphFull : public Pgr_base_graph<G, T_V, T_E> {
107107
auto source_vertex_id = source_vertex_edge_pair.first;
108108
auto source_edge_id = source_vertex_edge_pair.second;
109109

110-
auto edge_id = 0.0;
110+
int64_t edge_id = 0;
111111
auto e_cost = 0.0;
112112
if (source_edge_id == target_edge_id) {
113113
e_cost = m_edge_costs[source_edge_id];
@@ -143,7 +143,7 @@ class Pgr_lineGraphFull : public Pgr_base_graph<G, T_V, T_E> {
143143
<< " e_target = " << e_target
144144
<< "\n";
145145
#endif
146-
Line_graph_rt edge = {
146+
Line_graph_full_rt edge = {
147147
++count,
148148
vertex_id_map[e_source],
149149
vertex_id_map[e_target],

sql/lineGraph/lineGraphFull.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CREATE OR REPLACE FUNCTION pgr_lineGraphFull(
3333
OUT source BIGINT,
3434
OUT target BIGINT,
3535
OUT cost FLOAT,
36-
OUT edge FLOAT)
36+
OUT edge BIGINT)
3737

3838
RETURNS SETOF RECORD AS
3939
'$libdir/${PGROUTING_LIBRARY_NAME}', 'lineGraphFull'

src/lineGraph/lineGraphFull.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static
5757
void
5858
process(
5959
char* edges_sql,
60-
Line_graph_rt **result_tuples,
60+
Line_graph_full_rt **result_tuples,
6161
size_t *result_count) {
6262
/*
6363
* https://www.postgresql.org/docs/current/static/spi-spi-connect.html
@@ -122,7 +122,7 @@ PGDLLEXPORT Datum lineGraphFull(PG_FUNCTION_ARGS) {
122122
/**************************************************************************/
123123
/* MODIFY AS NEEDED */
124124
/* */
125-
Line_graph_rt *result_tuples = NULL;
125+
Line_graph_full_rt *result_tuples = NULL;
126126
size_t result_count = 0;
127127
/* */
128128
/**************************************************************************/
@@ -169,7 +169,7 @@ PGDLLEXPORT Datum lineGraphFull(PG_FUNCTION_ARGS) {
169169

170170
funcctx = SRF_PERCALL_SETUP();
171171
tuple_desc = funcctx->tuple_desc;
172-
result_tuples = (Line_graph_rt*) funcctx->user_fctx;
172+
result_tuples = (Line_graph_full_rt*) funcctx->user_fctx;
173173

174174
if (funcctx->call_cntr < funcctx->max_calls) {
175175
HeapTuple tuple;
@@ -193,7 +193,7 @@ PGDLLEXPORT Datum lineGraphFull(PG_FUNCTION_ARGS) {
193193
values[1] = Int64GetDatum(result_tuples[c_cntr].source);
194194
values[2] = Int64GetDatum(result_tuples[c_cntr].target);
195195
values[3] = Float8GetDatum(result_tuples[c_cntr].cost);
196-
values[4] = Float8GetDatum(result_tuples[c_cntr].reverse_cost);
196+
values[4] = Int64GetDatum(result_tuples[c_cntr].edge);
197197

198198
tuple = heap_form_tuple(tuple_desc, values, nulls);
199199
result = HeapTupleGetDatum(tuple);

src/lineGraph/lineGraphFull_driver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4242
#include "cpp_common/linear_directed_graph.h"
4343

4444
void get_turn_penalty_postgres_result(
45-
std::vector< Line_graph_rt > edge_result,
46-
Line_graph_rt **return_tuples,
45+
std::vector< Line_graph_full_rt > edge_result,
46+
Line_graph_full_rt **return_tuples,
4747
size_t &sequence) {
4848
(*return_tuples) = pgr_alloc(
4949
static_cast<int>(edge_result.size()),
@@ -55,7 +55,7 @@ void get_turn_penalty_postgres_result(
5555
edge.source,
5656
edge.target,
5757
edge.cost,
58-
edge.reverse_cost};
58+
edge.edge};
5959
sequence++;
6060
}
6161
}
@@ -64,7 +64,7 @@ void
6464
do_pgr_lineGraphFull(
6565
pgr_edge_t *data_edges,
6666
size_t total_edges,
67-
Line_graph_rt **return_tuples,
67+
Line_graph_full_rt **return_tuples,
6868
size_t *return_count,
6969
char ** log_msg,
7070
char ** notice_msg,
@@ -80,7 +80,7 @@ do_pgr_lineGraphFull(
8080
pgassert(*return_count == 0);
8181
pgassert(total_edges != 0);
8282

83-
std::vector< Line_graph_rt > results;
83+
std::vector< Line_graph_full_rt > results;
8484
graphType gType = DIRECTED;
8585

8686
pgrouting::DirectedGraph digraph(gType);
@@ -94,7 +94,7 @@ do_pgr_lineGraphFull(
9494
pgrouting::Line_vertex,
9595
pgrouting::Basic_edge > line(digraph);
9696

97-
std::vector< Line_graph_rt > line_graph_edges;
97+
std::vector< Line_graph_full_rt > line_graph_edges;
9898
line_graph_edges = line.get_postgres_results_directed();
9999

100100
auto count = line_graph_edges.size();

0 commit comments

Comments
 (0)