pgRouting  2.2
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Functions Variables Pages
bdsp_core.cpp
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 #ifdef __MINGW32__
30 #include <winsock2.h>
31 #include <windows.h>
32 #endif
33 
34 #include <exception>
35 #include "BiDirDijkstra.h"
36 #include "bdsp.h"
37 
38 
39 
40 int bidirsp_wrapper(
41  edge_t *edges,
42  unsigned int edge_count,
43  int maxNode,
44  int start_vertex,
45  int end_vertex,
46  bool directed,
47  bool has_reverse_cost,
48  path_element_t **path,
49  int *path_count,
50  char **err_msg
51  )
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 this are an unused parameters have to be used
61  if (has_reverse_cost) {};
62  if (directed) {};
63 
64  }
65  catch(std::exception& e) {
66  // DBG("catch(std::exception e.what: %s\n", e.what());
67  *err_msg = (char *) e.what();
68  return -1;
69  }
70  catch(...) {
71  // DBG("catch(...\n");
72  *err_msg = (char *) "Caught unknown exception!";
73  return -1;
74  }
75 
76  // DBG("Back from bddijkstra.bidir_dijkstra()\n");
77  if (res < 0)
78  return res;
79  return 0;
80 }
81