PGROUTING  3.2
pgrouting::trsp::Rule Class Reference

#include "rule.h"

Collaboration diagram for pgrouting::trsp::Rule:

Public Member Functions

 Rule (Restriction_t r)
 
iterator begin ()
 
constiterator begin () const
 
double cost () const
 
int64_t dest_id () const
 
iterator end ()
 
constiterator end () const
 
const std::vector< int64_t > precedencelist () const
 

Private Types

using constiterator = std::vector< int64_t >::const_iterator
 
using iterator = std::vector< int64_t >::iterator
 

Private Attributes

std::vector< int64_t > m_all
 
double m_cost
 
int64_t m_dest_id
 
std::vector< int64_t > m_precedencelist
 

Friends

std::ostream & operator<< (std::ostream &log, const Rule &r)
 

Detailed Description

Definition at line 39 of file rule.h.

Member Typedef Documentation

◆ constiterator

using pgrouting::trsp::Rule::constiterator = std::vector<int64_t>::const_iterator
private

Definition at line 41 of file rule.h.

◆ iterator

using pgrouting::trsp::Rule::iterator = std::vector<int64_t>::iterator
private

Definition at line 40 of file rule.h.

Constructor & Destructor Documentation

◆ Rule()

Rule::Rule ( Restriction_t  r)
explicit

Definition at line 36 of file rule.cpp.

36  :
37  m_cost(r.cost),
38  m_precedencelist(r.via, r.via + r.via_size),
39  m_all(r.via, r.via + r.via_size) {
40  m_dest_id = m_precedencelist.back();
41  m_precedencelist.pop_back();
42  std::reverse(m_precedencelist.begin(), m_precedencelist.end());
43  }

References m_dest_id, and m_precedencelist.

Member Function Documentation

◆ begin() [1/2]

iterator pgrouting::trsp::Rule::begin ( )
inline

Definition at line 55 of file rule.h.

55 { return m_all.begin(); }

References m_all.

◆ begin() [2/2]

constiterator pgrouting::trsp::Rule::begin ( ) const
inline

Definition at line 52 of file rule.h.

52 { return m_all.begin(); }

References m_all.

Referenced by Path::find_restriction(), and Path::inf_cost_on_restriction().

◆ cost()

double pgrouting::trsp::Rule::cost ( ) const
inline

Definition at line 46 of file rule.h.

46  {
47  return m_cost;
48  }

References m_cost.

◆ dest_id()

int64_t pgrouting::trsp::Rule::dest_id ( ) const
inline

Definition at line 58 of file rule.h.

58  {
59  return m_dest_id;
60  }

References m_dest_id.

◆ end() [1/2]

iterator pgrouting::trsp::Rule::end ( )
inline

Definition at line 56 of file rule.h.

56 { return m_all.end(); }

References m_all.

◆ end() [2/2]

constiterator pgrouting::trsp::Rule::end ( ) const
inline

Definition at line 53 of file rule.h.

53 { return m_all.end(); }

References m_all.

Referenced by Path::find_restriction(), and Path::inf_cost_on_restriction().

◆ precedencelist()

const std::vector< int64_t > Rule::precedencelist ( ) const

Definition at line 46 of file rule.cpp.

46  {
47  return m_precedencelist;
48  }

References m_precedencelist.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  log,
const Rule r 
)
friend

Definition at line 51 of file rule.cpp.

51  {
52  log << "(";
53  for (const auto e : r.m_all) {
54  log << e << ",";
55  }
56  log << ")";
57  return log;
58  }

Member Data Documentation

◆ m_all

std::vector<int64_t> pgrouting::trsp::Rule::m_all
private

Definition at line 69 of file rule.h.

Referenced by begin(), end(), and pgrouting::trsp::operator<<().

◆ m_cost

double pgrouting::trsp::Rule::m_cost
private

Definition at line 67 of file rule.h.

Referenced by cost().

◆ m_dest_id

int64_t pgrouting::trsp::Rule::m_dest_id
private

Definition at line 66 of file rule.h.

Referenced by dest_id(), and Rule().

◆ m_precedencelist

std::vector<int64_t> pgrouting::trsp::Rule::m_precedencelist
private

Definition at line 68 of file rule.h.

Referenced by precedencelist(), and Rule().


The documentation for this class was generated from the following files:
Restriction_t::cost
double cost
Definition: restriction_t.h:39
pgrouting::trsp::Rule::m_dest_id
int64_t m_dest_id
Definition: rule.h:66
pgrouting::trsp::Rule::m_precedencelist
std::vector< int64_t > m_precedencelist
Definition: rule.h:68
pgrouting::trsp::Rule::m_all
std::vector< int64_t > m_all
Definition: rule.h:69
Restriction_t::via
int64_t * via
Definition: restriction_t.h:40
pgrouting::trsp::Rule::m_cost
double m_cost
Definition: rule.h:67
Restriction_t::via_size
uint64_t via_size
Definition: restriction_t.h:41