PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bdastar_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 *
9 
10 ------
11 MIT/X license
12 
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the Software is
18 furnished to do so, subject to the following conditions:
19 
20 
21 The above copyright notice and this permission notice shall be included in
22 all copies or substantial portions of the Software.
23 
24 
25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31 THE SOFTWARE.
32 
33 ********************************************************************PGR-MIT*/
34 
35 
36 
37 #include "./bdastar_driver.h"
38 #include <exception>
39 #include "./BiDirAStar.h"
40 
41 int bdastar_wrapper(edge_astar_t *edges, size_t edge_count, int maxnode,
42  int source_vertex_id, int target_vertex_id,
43  bool directed, bool has_reverse_cost,
44  path_element_t **path, size_t *path_count, char **err_msg) {
45  int res;
46 
47  try {
48  BiDirAStar bdastar;
49  res = bdastar.bidir_astar(edges, edge_count, maxnode, source_vertex_id, target_vertex_id, path, path_count, err_msg);
50  // TODO(someone) this are an unused parameters have to be used
51  if (has_reverse_cost) {}
52  if (directed) {}
53  }
54  catch(std::exception& e) {
55  *err_msg = (char *) e.what();
56  return -1;
57  }
58  catch(...) {
59  *err_msg = (char *) "Caught unknown exception!";
60  return -1;
61  }
62 
63  if (res < 0)
64  return res;
65  else
66  return EXIT_SUCCESS;
67 }
68 
int path_count
Definition: BDATester.cpp:51
int bdastar_wrapper(edge_astar_t *edges, size_t edge_count, int maxnode, int source_vertex_id, int target_vertex_id, bool directed, bool has_reverse_cost, path_element_t **path, size_t *path_count, char **err_msg)
int bidir_astar(edge_astar_t *edges, size_t edge_count, int maxNode, int start_vertex, int end_vertex, path_element_t **path, size_t *path_count, char **err_msg)
int edge_count
Definition: BDATester.cpp:47
edge_astar_t * edges
Definition: BDATester.cpp:46
path_element_t * path
Definition: BDATester.cpp:49
char * err_msg
Definition: BDATester.cpp:50