PGROUTING  3.2
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

constructors
 Identifiers ()=default
 
 Identifiers (const Identifiers< T > &)=default
 
 Identifiers (const std::set< T > &data)
 
 Identifiers (const size_t number)
 

Friends

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

set like operators

std::set< T > m_ids
 
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 ()
 
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...
 

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 49 of file identifiers.hpp.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 52 of file identifiers.hpp.

◆ iterator

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

Definition at line 51 of file identifiers.hpp.

Constructor & Destructor Documentation

◆ Identifiers() [1/4]

template<typename T >
Identifiers< T >::Identifiers ( )
default

◆ Identifiers() [2/4]

template<typename T >
Identifiers< T >::Identifiers ( const Identifiers< T > &  )
default

◆ Identifiers() [3/4]

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

Definition at line 59 of file identifiers.hpp.

59  {
60  m_ids = data;
61  }

◆ Identifiers() [4/4]

template<typename T >
Identifiers< T >::Identifiers ( const size_t  number)
inlineexplicit

Definition at line 67 of file identifiers.hpp.

67  {
68  size_t i(0);
69  std::generate_n(std::inserter(m_ids, m_ids.begin()),
70  number,
71  [&i](){ return i++; });
72  }

Member Function Documentation

◆ begin() [1/2]

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

Definition at line 85 of file identifiers.hpp.

85 {return m_ids.begin();}

◆ begin() [2/2]

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

◆ clear()

◆ empty()

◆ end() [1/2]

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

Definition at line 86 of file identifiers.hpp.

86 {return m_ids.end();}

◆ end() [2/2]

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

Definition at line 82 of file identifiers.hpp.

82 {return m_ids.end();}

Referenced by anonymous_namespace{contractGraph_driver.cpp}::get_shortcuts().

◆ front()

◆ has()

◆ operator*=() [1/2]

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 174 of file identifiers.hpp.

175  {
176  *this = *this * other;
177  return *this;
178  }

◆ operator*=() [2/2]

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 184 of file identifiers.hpp.

184  {
185  if (has(element)) {
186  m_ids.clear();
187  m_ids.insert(element);
188  } else {
189  m_ids.clear();
190  }
191  return *this;
192  }

◆ operator+=() [1/2]

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 131 of file identifiers.hpp.

132  {
133  m_ids.insert(other.m_ids.begin(), other.m_ids.end());
134  return *this;
135  }

◆ operator+=() [2/2]

template<typename T >
Identifiers<T>& Identifiers< T >::operator+= ( const T &  element)
inline

compound set UNION element

Parameters
[in]elementof type T

Definition at line 140 of file identifiers.hpp.

140  {
141  m_ids.insert(element);
142  return *this;
143  }

◆ operator-=() [1/2]

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 224 of file identifiers.hpp.

224  {
225  *this = *this - other;
226  return *this;
227  }

◆ operator-=() [2/2]

template<typename T >
Identifiers<T>& Identifiers< T >::operator-= ( const T &  element)
inline

compund set DIFFERENCE element

Parameters
[in]elementto be removed

Definition at line 233 of file identifiers.hpp.

233  {
234  m_ids.erase(element);
235  return *this;
236  }

◆ operator==()

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 107 of file identifiers.hpp.

107  {
108  return std::equal(m_ids.begin(), m_ids.end(), rhs.m_ids.begin());
109  }

◆ pop_front()

template<typename T >
void Identifiers< T >::pop_front ( )
inline

◆ size()

Friends And Related Function Documentation

◆ operator*

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 159 of file identifiers.hpp.

161  {
162  std::set<T> result;
163  std::set_intersection(
164  lhs.m_ids.begin(), lhs.m_ids.end(),
165  rhs.m_ids.begin(), rhs.m_ids.end(),
166  std::inserter(result, result.begin()));
167  return Identifiers<T>(result);
168  }

◆ operator+

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 119 of file identifiers.hpp.

121  {
122  Identifiers<T> union_ids(lhs);
123  union_ids += rhs;
124  return union_ids;
125  }

◆ operator-

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

Definition at line 206 of file identifiers.hpp.

208  {
209  std::set<T> result;
210  std::set_difference(
211  lhs.m_ids.begin(), lhs.m_ids.end(),
212  rhs.m_ids.begin(), rhs.m_ids.end(),
213  std::inserter(result, result.begin()));
214  return Identifiers<T>(result);
215  }

◆ operator<<

template<typename T >
std::ostream& operator<< ( std::ostream &  os,
const Identifiers< T > &  identifiers 
)
friend

Prints the set of identifiers.

Definition at line 243 of file identifiers.hpp.

243  {
244  os << "{";
245  for (auto identifier : identifiers.m_ids) {
246  os << identifier << ", ";
247  }
248  os << "}";
249  return os;
250  }

Member Data Documentation

◆ m_ids


The documentation for this class was generated from the following file:
Identifiers::m_ids
std::set< T > m_ids
Definition: identifiers.hpp:91
Identifiers::has
bool has(const T other) const
true ids() has element
Definition: identifiers.hpp:98
Identifiers
Definition: identifiers.hpp:49