PGROUTING  3.2
pgrouting::functions::Pgr_makeConnected< G > Class Template Reference

#include "pgr_makeConnected.hpp"

Inheritance diagram for pgrouting::functions::Pgr_makeConnected< G >:
Collaboration diagram for pgrouting::functions::Pgr_makeConnected< G >:

Public Types

typedef G::E E
 
typedef G::E_i E_i
 
typedef G::V V
 

Public Member Functions

void clear ()
 clear More...
 
std::string get_error () const
 get_error More...
 
std::string get_log () const
 get_log More...
 
std::string get_notice () const
 get_notice More...
 
bool has_error () const
 get_error More...
 
std::vector< pgr_makeConnected_tmakeConnected (G &graph)
 

Public Attributes

std::ostringstream error
 Stores the error information. More...
 
std::ostringstream log
 Stores the hint information. More...
 
std::ostringstream notice
 Stores the notice information. More...
 

Private Member Functions

std::vector< pgr_makeConnected_tgeneratemakeConnected (G &graph)
 

Detailed Description

template<class G>
class pgrouting::functions::Pgr_makeConnected< G >

Definition at line 49 of file pgr_makeConnected.hpp.

Member Typedef Documentation

◆ E

template<class G >
typedef G::E pgrouting::functions::Pgr_makeConnected< G >::E

Definition at line 52 of file pgr_makeConnected.hpp.

◆ E_i

template<class G >
typedef G::E_i pgrouting::functions::Pgr_makeConnected< G >::E_i

Definition at line 53 of file pgr_makeConnected.hpp.

◆ V

template<class G >
typedef G::V pgrouting::functions::Pgr_makeConnected< G >::V

Definition at line 51 of file pgr_makeConnected.hpp.

Member Function Documentation

◆ clear()

void pgrouting::Pgr_messages::clear ( )
inherited

clear

Clears All the messages

Definition at line 59 of file pgr_messages.cpp.

59  {
60  log.str("");
61  log.clear();
62 
63  notice.str("");
64  notice.clear();
65 
66  error.str("");
67  error.clear();
68 }

References pgrouting::Pgr_messages::error, pgrouting::Pgr_messages::log, and pgrouting::Pgr_messages::notice.

Referenced by do_pgr_pickDeliver().

◆ generatemakeConnected()

template<class G >
std::vector< pgr_makeConnected_t > pgrouting::functions::Pgr_makeConnected< G >::generatemakeConnected ( G &  graph)
inlineprivate

Definition at line 59 of file pgr_makeConnected.hpp.

59  {
60  std::vector<size_t> component(boost::num_vertices(graph.graph));
61  auto comp = boost::connected_components(graph.graph, &component[0]);
62  comp--;
63  auto edgeCount = boost::num_edges(graph.graph);
64  size_t newEdge = 0;
65  log << "Number of Components before: " << boost::connected_components(graph.graph, &component[0]) << "\n";
66  size_t i = 0;
67 
68  /* abort in case of an interruption occurs (e.g. the query is being cancelled) */
69  CHECK_FOR_INTERRUPTS();
70  try {
71  boost::make_connected(graph.graph);
72  } catch (boost::exception const& ex) {
73  (void)ex;
74  throw;
75  } catch (std::exception &e) {
76  (void)e;
77  throw;
78  } catch (...) {
79  throw;
80  }
81 
82  log << "Number of Components after: " << boost::connected_components(graph.graph, &component[0]) << "\n";
83  E_i ei, ei_end;
84  std::vector< pgr_makeConnected_t > results(comp);
85  for (boost::tie(ei, ei_end) = edges(graph.graph); ei != ei_end; ++ei) {
86  int64_t src = graph[graph.source(*ei)].id;
87  int64_t tgt = graph[graph.target(*ei)].id;
88  log<< "src:" << src<< "tgt:" << tgt <<"\n";
89  if (newEdge >= edgeCount) {
90  results[i].start_vid = src;
91  results[i].end_vid = tgt;
92  i++;
93  }
94  newEdge++;
95  }
96  return results;
97  }

References pgrouting::Pgr_messages::log.

Referenced by pgrouting::functions::Pgr_makeConnected< G >::makeConnected().

◆ get_error()

std::string pgrouting::Pgr_messages::get_error ( ) const
inherited

get_error

Returns
the current contents of the log and clears the log

Definition at line 53 of file pgr_messages.cpp.

53  {
54  auto str = error.str();
55  return str;
56 }

References pgrouting::Pgr_messages::error.

Referenced by do_pgr_many_withPointsDD(), do_pgr_pickDeliver(), do_pgr_pickDeliverEuclidean(), do_pgr_withPoints(), do_pgr_withPointsKsp(), and pgrouting::vrp::Pgr_pickDeliver::Pgr_pickDeliver().

◆ get_log()

std::string pgrouting::Pgr_messages::get_log ( ) const
inherited

◆ get_notice()

std::string pgrouting::Pgr_messages::get_notice ( ) const
inherited

get_notice

Returns
the current contents of the log and clears the log

Definition at line 42 of file pgr_messages.cpp.

42  {
43  auto str = notice.str();
44  return str;
45 }

References pgrouting::Pgr_messages::notice.

◆ has_error()

bool pgrouting::Pgr_messages::has_error ( ) const
inherited

get_error

Returns
the current contents of the log and clears the log

Definition at line 48 of file pgr_messages.cpp.

48  {
49  return !error.str().empty();
50 }

References pgrouting::Pgr_messages::error.

Referenced by do_pgr_many_withPointsDD(), do_pgr_withPoints(), and do_pgr_withPointsKsp().

◆ makeConnected()

template<class G >
std::vector<pgr_makeConnected_t> pgrouting::functions::Pgr_makeConnected< G >::makeConnected ( G &  graph)
inline

Definition at line 54 of file pgr_makeConnected.hpp.

54  {
55  return generatemakeConnected(graph);
56  }

References pgrouting::functions::Pgr_makeConnected< G >::generatemakeConnected().

Referenced by do_pgr_makeConnected().

Member Data Documentation

◆ error

◆ log

◆ notice

std::ostringstream pgrouting::Pgr_messages::notice
mutableinherited

Stores the notice information.

Definition at line 83 of file pgr_messages.h.

Referenced by pgrouting::Pgr_messages::clear(), and pgrouting::Pgr_messages::get_notice().


The documentation for this class was generated from the following file:
pgrouting::Pgr_messages::error
std::ostringstream error
Stores the error information.
Definition: pgr_messages.h:85
pgrouting::Pgr_messages::log
std::ostringstream log
Stores the hint information.
Definition: pgr_messages.h:81
pgrouting::functions::Pgr_makeConnected::generatemakeConnected
std::vector< pgr_makeConnected_t > generatemakeConnected(G &graph)
Definition: pgr_makeConnected.hpp:59
pgrouting::Pgr_messages::notice
std::ostringstream notice
Stores the notice information.
Definition: pgr_messages.h:83
pgrouting::functions::Pgr_makeConnected::E_i
G::E_i E_i
Definition: pgr_makeConnected.hpp:53