Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
cet::map_vector< Value > Class Template Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/cetlib/v3_06_01/source/cetlib/map_vector.h"

Public Types

using key_type = map_vector_key
 
using mapped_type = Value
 
using value_type = std::pair< key_type, mapped_type >
 
using impl_type = std::vector< value_type >
 
using size_type = typename impl_type::size_type
 
using difference_type = typename impl_type::difference_type
 
using iterator = typename impl_type::iterator
 
using const_iterator = typename impl_type::const_iterator
 
using reverse_iterator = typename impl_type::reverse_iterator
 
using const_reverse_iterator = typename impl_type::const_reverse_iterator
 
using allocator_type = typename impl_type::allocator_type
 
using pointer = typename allocator_type::pointer
 
using const_pointer = typename allocator_type::const_pointer
 
using reference = typename allocator_type::reference
 
using const_reference = typename allocator_type::const_reference
 

Public Member Functions

 map_vector ()=default
 
template<class InIter >
 map_vector (InIter const b, InIter const e)
 
bool empty () const noexcept
 
size_type size () const noexcept
 
size_type max_size () const noexcept
 
size_type capacity () const noexcept
 
allocator_type get_allocator () const noexcept
 
value_type const & front () const
 
value_type const & back () const
 
size_t delta () const
 
bool has (key_type key) const
 
iterator find (key_type key)
 
const_iterator find (key_type key) const
 
const_iterator findOrThrow (key_type key) const
 
mapped_typegetOrNull (key_type key)
 
mapped_type const * getOrNull (key_type key) const
 
mapped_typegetOrThrow (key_type key)
 
mapped_type const & getOrThrow (key_type key) const
 
mapped_typeoperator[] (key_type key)
 
mapped_type const & operator[] (key_type key) const
 
mapped_type const & at (key_type key) const
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_reverse_iterator rbegin () const noexcept
 
reverse_iterator rend () noexcept
 
const_reverse_iterator rend () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const noexcept
 
void clear () noexcept
 
void reserve (size_type const n)
 
void swap (map_vector< mapped_type > &other)
 
std::pair< iterator, bool > insert (value_type const &x)
 
template<class InIter >
void insert (InIter b, InIter e)
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

bool class_invariant () const
 

Static Private Member Functions

static bool lt (value_type const &, value_type const &) noexcept
 
static bool eq (value_type const &, value_type const &) noexcept
 

Private Attributes

impl_type v_ {}
 

Detailed Description

template<class Value>
class cet::map_vector< Value >

Definition at line 29 of file map_vector.h.

Member Typedef Documentation

template<class Value>
using cet::map_vector< Value >::allocator_type = typename impl_type::allocator_type

Definition at line 100 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::const_iterator = typename impl_type::const_iterator

Definition at line 96 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::const_pointer = typename allocator_type::const_pointer

Definition at line 102 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::const_reference = typename allocator_type::const_reference

Definition at line 104 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::const_reverse_iterator = typename impl_type::const_reverse_iterator

Definition at line 98 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::difference_type = typename impl_type::difference_type

Definition at line 93 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::impl_type = std::vector<value_type>

Definition at line 90 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::iterator = typename impl_type::iterator

Definition at line 95 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::key_type = map_vector_key

Definition at line 87 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::mapped_type = Value

Definition at line 88 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::pointer = typename allocator_type::pointer

Definition at line 101 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::reference = typename allocator_type::reference

Definition at line 103 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::reverse_iterator = typename impl_type::reverse_iterator

Definition at line 97 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::size_type = typename impl_type::size_type

Definition at line 92 of file map_vector.h.

template<class Value>
using cet::map_vector< Value >::value_type = std::pair<key_type, mapped_type>

Definition at line 89 of file map_vector.h.

Constructor & Destructor Documentation

template<class Value>
cet::map_vector< Value >::map_vector ( )
default
template<class Value>
template<class InIter >
cet::map_vector< Value >::map_vector ( InIter const  b,
InIter const  e 
)
inline

Definition at line 110 of file map_vector.h.

111  {
112  insert(b, e);
113  }
std::pair< iterator, bool > insert(value_type const &x)
Definition: map_vector.h:459
const hit & b
Definition: hits.cxx:21
Float_t e
Definition: plot.C:35

Member Function Documentation

template<class Value>
mapped_type const& cet::map_vector< Value >::at ( key_type  key) const
inline

Definition at line 172 of file map_vector.h.

173  {
174  return getOrThrow(key);
175  }
mapped_type & getOrThrow(key_type key)
Definition: map_vector.h:421
template<class Value >
cet::map_vector< Value >::value_type const & cet::map_vector< Value >::back ( ) const

Definition at line 352 of file map_vector.h.

References v_.

353 {
354  if (v_.empty())
355  throw cet::exception("map_vector::back") << "container is empty!\n";
356  return v_.back();
357 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
impl_type v_
Definition: map_vector.h:275
template<class Value>
iterator cet::map_vector< Value >::begin ( )
inlinenoexcept

Definition at line 179 of file map_vector.h.

References v_.

180  {
181  return v_.begin();
182  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_iterator cet::map_vector< Value >::begin ( ) const
inlinenoexcept

Definition at line 184 of file map_vector.h.

References v_.

185  {
186  return v_.begin();
187  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
size_type cet::map_vector< Value >::capacity ( ) const
inlinenoexcept

Definition at line 134 of file map_vector.h.

References v_.

135  {
136  return v_.capacity();
137  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_iterator cet::map_vector< Value >::cbegin ( ) const
inlinenoexcept

Definition at line 223 of file map_vector.h.

References v_.

Referenced by art::detail::CanBeAggregated< cet::map_vector< T > >::aggregate().

224  {
225  return v_.cbegin();
226  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_iterator cet::map_vector< Value >::cend ( ) const
inlinenoexcept

Definition at line 228 of file map_vector.h.

References v_.

Referenced by art::detail::CanBeAggregated< cet::map_vector< T > >::aggregate().

229  {
230  return v_.cend();
231  }
impl_type v_
Definition: map_vector.h:275
template<class Value >
bool cet::map_vector< Value >::class_invariant ( ) const
private

Definition at line 487 of file map_vector.h.

References lt, and v_.

488 {
489  return std::is_sorted(v_.begin(), v_.end(), lt);
490 }
static bool lt(value_type const &, value_type const &) noexcept
Definition: map_vector.h:496
impl_type v_
Definition: map_vector.h:275
template<class Value>
static short cet::map_vector< Value >::Class_Version ( )
inlinestatic

Definition at line 269 of file map_vector.h.

270  {
271  return 10;
272  }
template<class Value>
void cet::map_vector< Value >::clear ( )
inlinenoexcept

Definition at line 245 of file map_vector.h.

References v_.

246  {
247  v_.clear();
248  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_reverse_iterator cet::map_vector< Value >::crbegin ( ) const
inline

Definition at line 233 of file map_vector.h.

References v_.

234  {
235  return v_.crbegin();
236  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_reverse_iterator cet::map_vector< Value >::crend ( ) const
inlinenoexcept

Definition at line 238 of file map_vector.h.

References v_.

239  {
240  return v_.crend();
241  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
size_t cet::map_vector< Value >::delta ( ) const
inline

Definition at line 152 of file map_vector.h.

References findDuplicateFiles::key, and v_.

Referenced by art::detail::mix_offset< cet::map_vector< P > >::offset().

153  {
154  return v_.empty() ? 0 : 1 + v_.back().first.asInt();
155  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
bool cet::map_vector< Value >::empty ( ) const
inlinenoexcept

Definition at line 119 of file map_vector.h.

References v_.

120  {
121  return v_.empty();
122  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
iterator cet::map_vector< Value >::end ( )
inlinenoexcept

Definition at line 190 of file map_vector.h.

References v_.

Referenced by art::getElementAddresses(), and art::setPtr().

191  {
192  return v_.end();
193  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_iterator cet::map_vector< Value >::end ( ) const
inlinenoexcept

Definition at line 195 of file map_vector.h.

References v_.

196  {
197  return v_.end();
198  }
impl_type v_
Definition: map_vector.h:275
template<class Value >
bool cet::map_vector< Value >::eq ( value_type const &  v1,
value_type const &  v2 
)
staticprivatenoexcept

Definition at line 503 of file map_vector.h.

504 {
505  return v1.first == v2.first;
506 }
template<class Value >
cet::map_vector< Value >::iterator cet::map_vector< Value >::find ( key_type  key)

Definition at line 369 of file map_vector.h.

References febshutoff_auto::end, it, findDuplicateFiles::key, lt, registry_explorer::v, and v_.

Referenced by art::getElementAddresses().

370 {
371  value_type const v{key, mapped_type{}};
372  auto const begin = v_.begin(), end = v_.end();
373  auto it = std::lower_bound(begin, end, v, lt);
374  if (it != end && it->first != key)
375  it = end;
376  return it;
377 }
set< int >::iterator it
std::pair< key_type, mapped_type > value_type
Definition: map_vector.h:89
iterator end() noexcept
Definition: map_vector.h:190
Value mapped_type
Definition: map_vector.h:88
static bool lt(value_type const &, value_type const &) noexcept
Definition: map_vector.h:496
impl_type v_
Definition: map_vector.h:275
iterator begin() noexcept
Definition: map_vector.h:179
template<class Value >
cet::map_vector< Value >::const_iterator cet::map_vector< Value >::find ( key_type  key) const

Definition at line 381 of file map_vector.h.

References febshutoff_auto::end, it, findDuplicateFiles::key, lt, registry_explorer::v, and v_.

382 {
383  value_type const v{key, mapped_type{}};
384  auto const begin = v_.cbegin(), end = v_.cend();
385  auto it = std::lower_bound(begin, end, v, lt);
386  if (it != end && it->first != key)
387  it = end;
388  return it;
389 }
set< int >::iterator it
std::pair< key_type, mapped_type > value_type
Definition: map_vector.h:89
iterator end() noexcept
Definition: map_vector.h:190
Value mapped_type
Definition: map_vector.h:88
static bool lt(value_type const &, value_type const &) noexcept
Definition: map_vector.h:496
impl_type v_
Definition: map_vector.h:275
iterator begin() noexcept
Definition: map_vector.h:179
template<class Value >
cet::map_vector< Value >::const_iterator cet::map_vector< Value >::findOrThrow ( key_type  key) const

Definition at line 393 of file map_vector.h.

References cet::map_vector_key::asInt(), allTimeWatchdog::endl, and v_.

Referenced by art::setPtr().

394 {
395  auto p = find(key);
396  if (p == v_.cend())
397  throw cet::exception("map_vector::getOrThrow")
398  << "out of range (no such key): " << key.asInt() << std::endl;
399 
400  return p;
401 }
const char * p
Definition: xmltok.h:285
iterator find(key_type key)
Definition: map_vector.h:369
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
impl_type v_
Definition: map_vector.h:275
template<class Value >
cet::map_vector< Value >::value_type const & cet::map_vector< Value >::front ( ) const

Definition at line 343 of file map_vector.h.

References v_.

344 {
345  if (v_.empty())
346  throw cet::exception("map_vector::front") << "container is empty!\n";
347  return v_.front();
348 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
impl_type v_
Definition: map_vector.h:275
template<class Value>
allocator_type cet::map_vector< Value >::get_allocator ( ) const
inlinenoexcept

Definition at line 140 of file map_vector.h.

References v_.

141  {
142  return v_.get_allocator();
143  }
impl_type v_
Definition: map_vector.h:275
template<class Value >
Value * cet::map_vector< Value >::getOrNull ( key_type  key)

Definition at line 405 of file map_vector.h.

References it, and v_.

Referenced by art::getElementAddresses().

406 {
407  auto it = find(key);
408  return it == v_.end() ? nullptr : &it->second;
409 }
set< int >::iterator it
iterator find(key_type key)
Definition: map_vector.h:369
impl_type v_
Definition: map_vector.h:275
template<class Value >
Value const * cet::map_vector< Value >::getOrNull ( key_type  key) const

Definition at line 413 of file map_vector.h.

References it, and v_.

414 {
415  auto it = find(key);
416  return it == v_.cend() ? nullptr : &it->second;
417 }
set< int >::iterator it
iterator find(key_type key)
Definition: map_vector.h:369
impl_type v_
Definition: map_vector.h:275
template<class Value >
Value & cet::map_vector< Value >::getOrThrow ( key_type  key)

Definition at line 421 of file map_vector.h.

References cet::map_vector_key::asInt(), and allTimeWatchdog::endl.

422 {
423  auto* p = getOrNull(key);
424  if (p == nullptr)
425  throw cet::exception("map_vector::getOrThrow")
426  << "out of range (no such key): " << key.asInt() << std::endl;
427 
428  return *p;
429 }
const char * p
Definition: xmltok.h:285
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
mapped_type * getOrNull(key_type key)
Definition: map_vector.h:405
template<class Value >
Value const & cet::map_vector< Value >::getOrThrow ( key_type  key) const

Definition at line 433 of file map_vector.h.

References cet::map_vector_key::asInt(), and allTimeWatchdog::endl.

434 {
435  auto const* p = getOrNull(key);
436  if (p == nullptr)
437  throw cet::exception("map_vector::getOrThrow")
438  << "out of range (no such key): " << key.asInt() << std::endl;
439 
440  return *p;
441 }
const char * p
Definition: xmltok.h:285
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
mapped_type * getOrNull(key_type key)
Definition: map_vector.h:405
template<class Value >
bool cet::map_vector< Value >::has ( key_type  key) const

Definition at line 361 of file map_vector.h.

References findDuplicateFiles::key, lt, registry_explorer::v, and v_.

362 {
363  value_type const v{key, mapped_type{}};
364  return std::binary_search(v_.begin(), v_.end(), v, lt);
365 }
std::pair< key_type, mapped_type > value_type
Definition: map_vector.h:89
Value mapped_type
Definition: map_vector.h:88
static bool lt(value_type const &, value_type const &) noexcept
Definition: map_vector.h:496
impl_type v_
Definition: map_vector.h:275
template<class Value >
std::pair< typename cet::map_vector< Value >::iterator, bool > cet::map_vector< Value >::insert ( value_type const &  x)

Definition at line 459 of file map_vector.h.

References febshutoff_auto::end, it, lt, make_pair(), and v_.

Referenced by art::detail::CanBeAggregated< cet::map_vector< T > >::aggregate(), and art::detail::TwoArgInsert< cet::map_vector< T > >::concatenate().

460 {
461  v.first.ensure_valid();
462  auto const begin = v_.begin(), end = v_.end();
463  auto it = std::lower_bound(begin, end, v, lt);
464  if (it == end || it->first != v.first)
465  return std::make_pair(v_.insert(it, v), true);
466  return std::make_pair(it, false);
467 }
set< int >::iterator it
iterator end() noexcept
Definition: map_vector.h:190
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
static bool lt(value_type const &, value_type const &) noexcept
Definition: map_vector.h:496
impl_type v_
Definition: map_vector.h:275
iterator begin() noexcept
Definition: map_vector.h:179
template<class Value >
template<class InIter >
void cet::map_vector< Value >::insert ( InIter  b,
InIter  e 
)

Definition at line 472 of file map_vector.h.

References b, e, lt, gammaraytel::pr, fillBadChanDBTables::result, and v_.

473 {
474  std::for_each(b, e, [](auto const& pr) { return pr.first.ensure_valid(); });
476  std::merge(v_.cbegin(), v_.cend(), b, e, back_inserter(result), lt);
477  auto new_end = std::unique(result.begin(), result.end(), eq);
478  result.erase(new_end, result.end());
479  v_.swap(result);
480 }
std::vector< value_type > impl_type
Definition: map_vector.h:90
static bool lt(value_type const &, value_type const &) noexcept
Definition: map_vector.h:496
impl_type v_
Definition: map_vector.h:275
const hit & b
Definition: hits.cxx:21
static bool eq(value_type const &, value_type const &) noexcept
Definition: map_vector.h:503
Float_t e
Definition: plot.C:35
template<class Value >
bool cet::map_vector< Value >::lt ( value_type const &  v1,
value_type const &  v2 
)
staticprivatenoexcept

Definition at line 496 of file map_vector.h.

497 {
498  return v1.first < v2.first;
499 }
template<class Value>
size_type cet::map_vector< Value >::max_size ( ) const
inlinenoexcept

Definition at line 129 of file map_vector.h.

References v_.

130  {
131  return v_.max_size();
132  }
impl_type v_
Definition: map_vector.h:275
template<class Value >
Value & cet::map_vector< Value >::operator[] ( key_type  key)

Definition at line 444 of file map_vector.h.

References febshutoff_auto::end, it, findDuplicateFiles::key, lt, registry_explorer::v, and v_.

445 {
446  value_type const v{key, mapped_type{}};
447  auto const begin = v_.begin(), end = v_.end();
448  auto it = std::lower_bound(begin, end, v, lt);
449  if (it == end || it->first != key)
450  it = v_.insert(it, std::move(v));
451  return it->second;
452 }
set< int >::iterator it
std::pair< key_type, mapped_type > value_type
Definition: map_vector.h:89
iterator end() noexcept
Definition: map_vector.h:190
Value mapped_type
Definition: map_vector.h:88
static bool lt(value_type const &, value_type const &) noexcept
Definition: map_vector.h:496
impl_type v_
Definition: map_vector.h:275
iterator begin() noexcept
Definition: map_vector.h:179
template<class Value>
mapped_type const& cet::map_vector< Value >::operator[] ( key_type  key) const
inline

Definition at line 170 of file map_vector.h.

170 { return getOrThrow(key); }
mapped_type & getOrThrow(key_type key)
Definition: map_vector.h:421
template<class Value>
reverse_iterator cet::map_vector< Value >::rbegin ( )
inlinenoexcept

Definition at line 201 of file map_vector.h.

References v_.

202  {
203  return v_.rbegin();
204  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_reverse_iterator cet::map_vector< Value >::rbegin ( ) const
inlinenoexcept

Definition at line 206 of file map_vector.h.

References v_.

207  {
208  return v_.rbegin();
209  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
reverse_iterator cet::map_vector< Value >::rend ( )
inlinenoexcept

Definition at line 212 of file map_vector.h.

References v_.

213  {
214  return v_.rend();
215  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
const_reverse_iterator cet::map_vector< Value >::rend ( ) const
inlinenoexcept

Definition at line 217 of file map_vector.h.

References v_.

218  {
219  return v_.rend();
220  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
void cet::map_vector< Value >::reserve ( size_type const  n)
inline

Definition at line 251 of file map_vector.h.

References v_.

252  {
253  v_.reserve(n);
254  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
size_type cet::map_vector< Value >::size ( void  ) const
inlinenoexcept

Definition at line 124 of file map_vector.h.

References v_.

125  {
126  return v_.size();
127  }
impl_type v_
Definition: map_vector.h:275
template<class Value>
void cet::map_vector< Value >::swap ( map_vector< mapped_type > &  other)
inline

Definition at line 257 of file map_vector.h.

References b, e, v_, cet::map_vector< Value >::v_, and submit_syst::x.

258  {
259  v_.swap(other.v_);
260  }
impl_type v_
Definition: map_vector.h:275

Member Data Documentation

template<class Value>
impl_type cet::map_vector< Value >::v_ {}
private

Definition at line 275 of file map_vector.h.

Referenced by cet::map_vector< Value >::swap().


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