PGROUTING  3.2
isPlanar.c File Reference
#include <stdbool.h>
#include "c_common/postgres_connection.h"
#include "utils/array.h"
#include "c_common/debug_macro.h"
#include "c_common/e_report.h"
#include "c_common/time_msg.h"
#include "c_common/edges_input.h"
#include "drivers/planar/isPlanar_driver.h"
Include dependency graph for isPlanar.c:

Go to the source code of this file.

Functions

PGDLLEXPORT Datum _pgr_isplanar (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (_pgr_isplanar)
 
static bool process (char *edges_sql)
 

Function Documentation

◆ _pgr_isplanar()

PGDLLEXPORT Datum _pgr_isplanar ( PG_FUNCTION_ARGS  )

Definition at line 94 of file isPlanar.c.

94  {
95  /**********************************************************************/
96  /*
97  pgr_isPlanar(
98  edge_sql TEXT)
99  */
100  /**********************************************************************/
101  PG_RETURN_BOOL(process(text_to_cstring(PG_GETARG_TEXT_P(0))));
102  /**********************************************************************/
103 }

References process().

◆ PG_FUNCTION_INFO_V1()

PG_FUNCTION_INFO_V1 ( _pgr_isplanar  )

◆ process()

static bool process ( char *  edges_sql)
static

Definition at line 46 of file isPlanar.c.

48  {
49  bool planarity = false;
51 
52  pgr_edge_t *edges = NULL;
53  size_t total_edges = 0;
54 
55  pgr_get_edges(edges_sql, &edges, &total_edges);
56 
57  if (total_edges == 0) {
59  return (false);
60  }
61 
62  clock_t start_t = clock();
63  char *log_msg = NULL;
64  char *notice_msg = NULL;
65  char *err_msg = NULL;
66 
67 
68  planarity = do_pgr_isPlanar(
69  edges,
70  total_edges,
71 
72  &log_msg,
73  &notice_msg,
74  &err_msg);
75 
76  time_msg(" processing pgr_isPlanar", start_t, clock());
77 
78  pgr_global_report(log_msg, notice_msg, err_msg);
79 
80  if (edges)
81  pfree(edges);
82  if (log_msg)
83  pfree(log_msg);
84  if (notice_msg)
85  pfree(notice_msg);
86  if (err_msg)
87  pfree(err_msg);
88 
90 
91  return planarity;
92 }

References do_pgr_isPlanar(), pgr_get_edges(), pgr_global_report(), pgr_SPI_connect(), pgr_SPI_finish(), and time_msg().

Referenced by _pgr_isplanar().

pgr_edge_t
Definition: pgr_edge_t.h:37
pgr_SPI_connect
void pgr_SPI_connect(void)
Definition: postgres_connection.c:82
do_pgr_isPlanar
bool do_pgr_isPlanar(pgr_edge_t *data_edges, size_t total_edges, char **log_msg, char **notice_msg, char **err_msg)
Definition: isPlanar_driver.cpp:45
pgr_SPI_finish
void pgr_SPI_finish(void)
Definition: postgres_connection.c:71
pgr_get_edges
void pgr_get_edges(char *edges_sql, pgr_edge_t **edges, size_t *total_edges)
basic edge_sql
Definition: edges_input.c:711
time_msg
void time_msg(char *msg, clock_t start_t, clock_t end_t)
Definition: time_msg.c:32
process
static bool process(char *edges_sql)
Definition: isPlanar.c:46
pgr_global_report
void pgr_global_report(char *log, char *notice, char *err)
notice & error
Definition: e_report.c:93