1 #ifndef DataFormats_Common_View_h
2 #define DataFormats_Common_View_h
22 #include "boost/iterator/indirect_iterator.hpp"
41 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
42 std::unique_ptr<ViewBase>
clone()
const;
49 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
50 virtual std::unique_ptr<ViewBase>
doClone()
const = 0;
74 class View :
public ViewBase {
75 typedef std::vector<T const*>
seq_t;
85 typedef boost::indirect_iterator<typename seq_t::const_iterator>
const_iterator;
101 View(std::vector<void const*>
const& pointers,
129 std::vector<Ptr<value_type> >
const&
ptrs()
const;
143 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
144 std::unique_ptr<ViewBase>
doClone()
const override;
151 template<
typename T>
bool operator< (View<T>
const&,
View<T> const&);
152 template<
typename T>
bool operator<=(View<T>
const&,
View<T> const&);
179 assert(numElements == helpers.size());
181 items_.reserve(numElements);
182 vPtrs_.reserve(numElements);
184 void const*
p = pointers[
i];
185 auto const&
h = helpers[
i];
186 items_.push_back(static_cast<pointer>(p));
188 vPtrs_.push_back(Ptr<T>(
h.first, static_cast<T const*>(p),
h.second));
189 }
else if(getter !=
nullptr) {
190 vPtrs_.push_back(Ptr<T>(
h.first,
h.second, getter));
192 vPtrs_.push_back(Ptr<T>(
h.first,
nullptr,
h.second));
207 items_.swap(other.items_);
208 vPtrs_.swap(other.vPtrs_);
214 View<T>::capacity()
const {
215 return items_.capacity();
220 typename View<T>::const_iterator
222 return items_.begin();
227 typename View<T>::const_iterator
234 typename View<T>::const_reverse_iterator
235 View<T>::rbegin()
const {
236 return items_.rbegin();
241 typename View<T>::const_reverse_iterator
242 View<T>::rend()
const {
243 return items_.rend();
250 return items_.size();
256 View<T>::max_size()
const {
257 return items_.max_size();
264 return items_.empty();
269 typename View<T>::const_reference
271 return *items_.at(pos);
276 typename View<T>::const_reference
290 return RefToBase<T>(std::unique_ptr<reftobase::BaseHolder<T>>{
291 new reftobase::IndirectHolder<T>{
292 std::unique_ptr<reftobase::RefHolder<edm::Ptr<T>>>{
293 new reftobase::RefHolder<Ptr<T>>{ptrAt(i)}
309 std::vector<Ptr<T> >
const&
310 View<T>::ptrs()
const {
317 typename View<T>::const_reference
319 return *items_.front();
324 typename View<T>::const_reference
326 return *items_.back();
336 output.items_[
i] = first;
339 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
341 std::unique_ptr<ViewBase>
342 View<T>::doClone()
const {
343 return std::unique_ptr<ViewBase>{
new View(*
this)};
350 View<T>::operator=(View<T>
const& rhs) {
361 lhs.size() == rhs.size() &&
362 std::equal(lhs.begin(), lhs.end(), rhs.begin());
369 return !(lhs == rhs);
375 operator<(View<T>
const& lhs,
View<T> const& rhs) {
376 return std::lexicographical_compare(lhs.begin(), lhs.end(),
377 rhs.begin(), rhs.end());
383 operator<=(View<T>
const& lhs,
View<T> const& rhs) {
void swap(ora::Record &rh, ora::Record &lh)
const_reverse_iterator rbegin() const
Ptr< value_type > ptrAt(size_type i) const
const_reference back() const
std::vector< T const * > seq_t
bool operator>(l1t::Jet &a, l1t::Jet &b)
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
size_type max_size() const
seq_t::difference_type difference_type
virtual std::unique_ptr< ViewBase > doClone() const =0
bool equal(const T &first, const T &second)
RefToBase< value_type > refAt(size_type i) const
bool operator>=(View< T > const &, View< T > const &)
const_iterator begin() const
View & operator=(View const &rhs)
std::vector< Ptr< value_type > > vPtrs_
std::unique_ptr< ViewBase > clone() const
const_reference operator[](size_type pos) const
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
bool operator>(View< T > const &, View< T > const &)
T operator[](int i) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const_reverse_iterator rend() const
size_type capacity() const
ViewBase & operator=(ViewBase const &)
std::vector< Ptr< value_type > > const & ptrs() const
static void fill_from_range(T *first, T *last, View &output)
boost::indirect_iterator< typename seq_t::const_reverse_iterator > const_reverse_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_reference at(size_type pos) const
const_iterator end() const
const_reference front() const
T first(std::pair< T, U > const &p)
T const & const_reference
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
tuple size
Write out results.
std::unique_ptr< ViewBase > doClone() const override