PGROUTING  2.6
Identifiers< T > Class Template Reference

#include "identifiers.hpp"

Inheritance diagram for Identifiers< T >:
Collaboration diagram for Identifiers< T >:

Public Types

typedef std::set< T >::const_iterator const_iterator
 
typedef std::set< T >::iterator iterator
 

Public Member Functions

bool has (const T other) const
 true ids() has element More...
 
bool operator== (const Identifiers< T > &rhs) const
 true when both sets are equal More...
 
constructors
 Identifiers ()=default
 
 Identifiers (const Identifiers< T > &)=default
 
 Identifiers (const std::set< T > &data)
 
 Identifiers (const size_t number)
 
set like operators
size_t size () const
 
bool empty () const
 
front () const
 
const_iterator begin () const
 
const_iterator end () const
 
void pop_front ()
 
void clear ()
 
iterator begin ()
 
iterator end ()
 

Private Attributes

std::set< T > m_ids
 

Friends

std::ostream & operator<< (std::ostream &os, const Identifiers< T > &identifiers)
 Prints the set of identifiers. More...
 

set UNION

Identifiers< T > & operator+= (const Identifiers< T > &other)
 compound set UNION set More...
 
Identifiers< T > & operator+= (const T &element)
 compound set UNION element More...
 
Identifiers< T > operator+ (const Identifiers< T > &lhs, const Identifiers< T > &rhs)
 set UNION set More...
 

set INTERSECTION

Identifiers< T > & operator*= (const Identifiers< T > &other)
 coumpound set INTERSECTION set More...
 
Identifiers< T > & operator*= (const T &element)
 compund set INTERSECTION element More...
 
Identifiers< T > operator* (const Identifiers< T > &lhs, const Identifiers< T > &rhs)
 set INTERSECTION More...
 

set DIFFERENCE

Identifiers< T > & operator-= (const Identifiers< T > &other)
 compound set DIFFERENCE set More...
 
Identifiers< T > & operator-= (const T &element)
 compund set DIFFERENCE element More...
 
Identifiers< T > operator- (const Identifiers< T > &lhs, const Identifiers< T > &rhs)
 

Detailed Description

template<typename T>
class Identifiers< T >

Definition at line 48 of file identifiers.hpp.

Member Typedef Documentation

template<typename T>
typedef std::set<T>::const_iterator Identifiers< T >::const_iterator

Definition at line 51 of file identifiers.hpp.

template<typename T>
typedef std::set<T>::iterator Identifiers< T >::iterator

Definition at line 50 of file identifiers.hpp.

Constructor & Destructor Documentation

template<typename T>
Identifiers< T >::Identifiers ( )
default
template<typename T>
Identifiers< T >::Identifiers ( const Identifiers< T > &  )
default
template<typename T>
Identifiers< T >::Identifiers ( const std::set< T > &  data)
inline

Definition at line 58 of file identifiers.hpp.

58  {
59  m_ids = data;
60  }
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
Identifiers< T >::Identifiers ( const size_t  number)
inlineexplicit

Definition at line 66 of file identifiers.hpp.

66  {
67  size_t i(0);
68  std::generate_n(std::inserter(m_ids, m_ids.begin()),
69  number,
70  [&i](){ return i++; });
71  }
std::set< T > m_ids
Definition: identifiers.hpp:90

Member Function Documentation

template<typename T>
const_iterator Identifiers< T >::begin ( ) const
inline

Definition at line 80 of file identifiers.hpp.

Referenced by pgrouting::vrp::Vehicle_pickDeliver::get_worse_order(), and pgrouting::vrp::Initial_solution::one_truck_all_orders().

80 {return m_ids.begin();}
std::set< T > m_ids
Definition: identifiers.hpp:90

Here is the caller graph for this function:

template<typename T>
iterator Identifiers< T >::begin ( )
inline

Definition at line 84 of file identifiers.hpp.

84 {return m_ids.begin();}
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
void Identifiers< T >::clear ( )
inline

Definition at line 83 of file identifiers.hpp.

Referenced by pgrouting::CH_vertex::clear_contracted_vertices(), pgrouting::CH_edge::clear_contracted_vertices(), and pgrouting::vrp::Vehicle_pickDeliver::Vehicle_pickDeliver().

83 {m_ids.clear();}
std::set< T > m_ids
Definition: identifiers.hpp:90

Here is the caller graph for this function:

template<typename T>
const_iterator Identifiers< T >::end ( ) const
inline

Definition at line 81 of file identifiers.hpp.

81 {return m_ids.end();}
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
iterator Identifiers< T >::end ( )
inline

Definition at line 85 of file identifiers.hpp.

85 {return m_ids.end();}
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
bool Identifiers< T >::has ( const T  other) const
inline
template<typename T>
Identifiers<T>& Identifiers< T >::operator*= ( const Identifiers< T > &  other)
inline

coumpound set INTERSECTION set

Parameters
[in]otheris a set of identifiers of type Identifiers<T>

Definition at line 173 of file identifiers.hpp.

174  {
175  *this = *this * other;
176  return *this;
177  }
template<typename T>
Identifiers<T>& Identifiers< T >::operator*= ( const T &  element)
inline

compund set INTERSECTION element

Parameters
[in]elementis an identifiers of type T

Definition at line 183 of file identifiers.hpp.

183  {
184  if (has(element)) {
185  m_ids.clear();
186  m_ids.insert(element);
187  } else {
188  m_ids.clear();
189  }
190  return *this;
191  }
bool has(const T other) const
true ids() has element
Definition: identifiers.hpp:97
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
Identifiers<T>& Identifiers< T >::operator+= ( const Identifiers< T > &  other)
inline

compound set UNION set

Parameters
[in]otherset of identifiers

Definition at line 130 of file identifiers.hpp.

131  {
132  m_ids.insert(other.m_ids.begin(), other.m_ids.end());
133  return *this;
134  }
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
Identifiers<T>& Identifiers< T >::operator+= ( const T &  element)
inline

compound set UNION element

Parameters
[in]elementof type T

Definition at line 139 of file identifiers.hpp.

139  {
140  m_ids.insert(element);
141  return *this;
142  }
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
Identifiers<T>& Identifiers< T >::operator-= ( const Identifiers< T > &  other)
inline

compound set DIFFERENCE set

Parameters
[in]otheris a set of identifiers of type Identifiers<T> Replaces this set with the set difference between this set and other

Definition at line 223 of file identifiers.hpp.

223  {
224  *this = *this - other;
225  return *this;
226  }
template<typename T>
Identifiers<T>& Identifiers< T >::operator-= ( const T &  element)
inline

compund set DIFFERENCE element

Parameters
[in]elementto be removed

Definition at line 232 of file identifiers.hpp.

232  {
233  m_ids.erase(element);
234  return *this;
235  }
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
bool Identifiers< T >::operator== ( const Identifiers< T > &  rhs) const
inline

true when both sets are equal

Parameters
[in]rhsset of identifiers to be compared

Definition at line 106 of file identifiers.hpp.

106  {
107  return std::equal(m_ids.begin(), m_ids.end(), rhs.m_ids.begin());
108  }
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
void Identifiers< T >::pop_front ( )
inline

Definition at line 82 of file identifiers.hpp.

Referenced by pgrouting::contraction::Pgr_linear< G >::add_shortcut(), pgrouting::contraction::Pgr_linear< G >::doContraction(), and pgrouting::vrp::Initial_solution::one_truck_all_orders().

82 {m_ids.erase(m_ids.begin());}
std::set< T > m_ids
Definition: identifiers.hpp:90

Here is the caller graph for this function:

Friends And Related Function Documentation

template<typename T>
Identifiers<T> operator* ( const Identifiers< T > &  lhs,
const Identifiers< T > &  rhs 
)
friend

set INTERSECTION

Parameters
[in]lhsIdentifiers
[in]rhsIdentifiers

Definition at line 158 of file identifiers.hpp.

160  {
161  std::set<T> result;
162  std::set_intersection(
163  lhs.m_ids.begin(), lhs.m_ids.end(),
164  rhs.m_ids.begin(), rhs.m_ids.end(),
165  std::inserter(result, result.begin()));
166  return Identifiers<T>(result);
167  }
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
Identifiers<T> operator+ ( const Identifiers< T > &  lhs,
const Identifiers< T > &  rhs 
)
friend

set UNION set

Parameters
[in]lhsIdentifiers
[in]rhsIdentifiers

Definition at line 118 of file identifiers.hpp.

120  {
121  Identifiers<T> union_ids(lhs);
122  union_ids += rhs;
123  return union_ids;
124  }
template<typename T>
Identifiers<T> operator- ( const Identifiers< T > &  lhs,
const Identifiers< T > &  rhs 
)
friend

Definition at line 205 of file identifiers.hpp.

207  {
208  std::set<T> result;
209  std::set_difference(
210  lhs.m_ids.begin(), lhs.m_ids.end(),
211  rhs.m_ids.begin(), rhs.m_ids.end(),
212  std::inserter(result, result.begin()));
213  return Identifiers<T>(result);
214  }
std::set< T > m_ids
Definition: identifiers.hpp:90
template<typename T>
std::ostream& operator<< ( std::ostream &  os,
const Identifiers< T > &  identifiers 
)
friend

Prints the set of identifiers.

Definition at line 242 of file identifiers.hpp.

242  {
243  os << "{";
244  for (auto identifier : identifiers.m_ids) {
245  os << identifier << ", ";
246  }
247  os << "}";
248  return os;
249  }
std::set< T > m_ids
Definition: identifiers.hpp:90

Member Data Documentation


The documentation for this class was generated from the following file: