pgRouting
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bdsp_driver.cpp
Go to the documentation of this file.
1 /*PGR-MIT*****************************************************************
2 
3 * $Id$
4 *
5 * Project: pgRouting bdsp and bdastar algorithms
6 * Purpose:
7 * Author: Razequl Islam <ziboncsedu@gmail.com>
8 Copyright (c) 2015 pgRouting developers
9 Mail: project@pgrouting.org
10 
11 ------
12 
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17 
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22 
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 
27 ********************************************************************PGR-MIT*/
28 
29 #if defined(__MINGW32__) || defined(_MSC_VER)
30 #include <winsock2.h>
31 #include <windows.h>
32 #endif
33 
34 #include "./bdsp_driver.h"
35 
36 #include <exception>
37 #include "./BiDirDijkstra.h"
38 
39 
40 
42  edge_t *edges,
43  unsigned int edge_count,
44  int maxNode,
45  int start_vertex,
46  int end_vertex,
47  bool directed,
48  bool has_reverse_cost,
50  int *path_count,
51  char **err_msg
52  ) {
53  int res;
54 
55  try {
56  // DBG("Calling BiDirDijkstra initializer.\n");
57  BiDirDijkstra bddijkstra;
58  // DBG("BiDirDijkstra initialized\n");
59  res = bddijkstra.bidir_dijkstra(edges, edge_count, maxNode, start_vertex, end_vertex, path, path_count, err_msg);
60  // TODO(someone) this are an unused parameters have to be used
61  if (has_reverse_cost) {}
62  if (directed) {}
63  }
64  catch(std::exception& e) {
65  // DBG("catch(std::exception e.what: %s\n", e.what());
66  *err_msg = (char *) e.what();
67  return -1;
68  }
69  catch(...) {
70  // DBG("catch(...\n");
71  *err_msg = (char *) "Caught unknown exception!";
72  return -1;
73  }
74 
75  // DBG("Back from bddijkstra.bidir_dijkstra()\n");
76  if (res < 0)
77  return res;
78  return 0;
79 }
int path_count
Definition: BDATester.cpp:51
int maxNode
Definition: BDATester.cpp:47
int edge_count
Definition: BDATester.cpp:47
edge_astar_t * edges
Definition: BDATester.cpp:46
int bidirsp_wrapper(edge_t *edges, unsigned int edge_count, int maxNode, int start_vertex, int end_vertex, bool directed, bool has_reverse_cost, path_element_t **path, int *path_count, char **err_msg)
Definition: bdsp_driver.cpp:41
int bidir_dijkstra(edge_t *edges, unsigned int edge_count, int maxNode, int start_vertex, int end_vertex, path_element_t **path, int *path_count, char **err_msg)
path_element_t * path
Definition: BDATester.cpp:49
char * err_msg
Definition: BDATester.cpp:50