Skip to content

Commit

Permalink
[c_types] line_graph_rt -> edge_t
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Aug 28, 2021
1 parent 7f73279 commit ec5b05e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 70 deletions.
50 changes: 0 additions & 50 deletions include/c_types/line_graph_rt.h

This file was deleted.

3 changes: 1 addition & 2 deletions include/drivers/lineGraph/lineGraph_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#endif

typedef struct Edge_t Edge_t;
typedef struct Line_graph_rt Line_graph_rt;

#ifdef __cplusplus
extern "C" {
Expand All @@ -56,7 +55,7 @@ extern "C" {
Edge_t *data_edges,
size_t total_edges,
bool directed,
Line_graph_rt **return_tuples,
Edge_t **return_tuples,
size_t *return_count,
char ** log_msg,
char ** notice_msg,
Expand Down
8 changes: 4 additions & 4 deletions include/lineGraph/pgr_lineGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ class Pgr_lineGraph : public Pgr_base_graph<G, T_V, T_E> {
}


std::vector< Line_graph_rt >
std::vector< Edge_t >
get_postgres_results_directed() {
std::vector< Line_graph_rt > results;
std::vector< Edge_t > results;

typename boost::graph_traits < G >::edge_iterator edgeIt, edgeEnd;
std::map < std::pair<int64_t, int64_t >, Line_graph_rt > unique;
std::map < std::pair<int64_t, int64_t >, Edge_t > unique;
int64_t count = 0;

for (boost::tie(edgeIt, edgeEnd) = boost::edges(this->graph);
Expand All @@ -116,7 +116,7 @@ class Pgr_lineGraph : public Pgr_base_graph<G, T_V, T_E> {
e_source *= -1;
e_target *= -1;

Line_graph_rt edge = {
Edge_t edge = {
++count,
e_source,
e_target,
Expand Down
1 change: 0 additions & 1 deletion include/yen/pgr_turnRestrictedPath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include "cpp_common/compPaths.h"
#include "cpp_common/pgr_messages.h"
#include "cpp_common/rule.h"
#include "c_types/line_graph_rt.h"

namespace pgrouting {
namespace yen {
Expand Down
12 changes: 4 additions & 8 deletions src/lineGraph/lineGraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include "c_common/postgres_connection.h"


#include "c_types/line_graph_rt.h"
/* for macro PGR_DBG */
#include "c_types/edge_t.h"
#include "c_common/debug_macro.h"
/* for pgr_global_report */
#include "c_common/e_report.h"
/* for time_msg & clock */
#include "c_common/time_msg.h"
/* for functions to get edges information */
#include "c_common/edges_input.h"

#include "drivers/lineGraph/lineGraph_driver.h" // the link to the C++ code of the function
Expand All @@ -69,7 +65,7 @@ void
process(
char* edges_sql,
bool directed,
Line_graph_rt **result_tuples,
Edge_t **result_tuples,
size_t *result_count) {
/*
* https://www.postgresql.org/docs/current/static/spi-spi-connect.html
Expand Down Expand Up @@ -138,7 +134,7 @@ PGDLLEXPORT Datum _pgr_linegraph(PG_FUNCTION_ARGS) {
/**************************************************************************/
/* MODIFY AS NEEDED */
/* */
Line_graph_rt *result_tuples = NULL;
Edge_t *result_tuples = NULL;
size_t result_count = 0;
/* */
/**************************************************************************/
Expand Down Expand Up @@ -184,7 +180,7 @@ PGDLLEXPORT Datum _pgr_linegraph(PG_FUNCTION_ARGS) {

funcctx = SRF_PERCALL_SETUP();
tuple_desc = funcctx->tuple_desc;
result_tuples = (Line_graph_rt*) funcctx->user_fctx;
result_tuples = (Edge_t*) funcctx->user_fctx;

if (funcctx->call_cntr < funcctx->max_calls) {
HeapTuple tuple;
Expand Down
9 changes: 4 additions & 5 deletions src/lineGraph/lineGraph_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "dijkstra/pgr_dijkstra.hpp"

#include "c_types/line_graph_rt.h"
#include "cpp_common/pgr_alloc.hpp"
#include "cpp_common/pgr_assert.h"

Expand All @@ -45,8 +44,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


void get_postgres_result(
std::vector< Line_graph_rt > edge_result,
Line_graph_rt **return_tuples,
std::vector< Edge_t > edge_result,
Edge_t **return_tuples,
size_t &sequence) {
(*return_tuples) = pgr_alloc(edge_result.size(), (*return_tuples));

Expand All @@ -62,7 +61,7 @@ do_pgr_lineGraph(
Edge_t *data_edges,
size_t total_edges,
bool directed,
Line_graph_rt **return_tuples,
Edge_t **return_tuples,
size_t *return_count,
char ** log_msg,
char ** notice_msg,
Expand All @@ -88,7 +87,7 @@ do_pgr_lineGraph(
pgrouting::LinearDirectedGraph,
pgrouting::Line_vertex,
pgrouting::Basic_edge> line(digraph);
std::vector< Line_graph_rt > line_graph_edges;
std::vector< Edge_t > line_graph_edges;
line_graph_edges = line.get_postgres_results_directed();
auto count = line_graph_edges.size();

Expand Down

0 comments on commit ec5b05e

Please sign in to comment.