1 #ifndef DataFormats_Common_View_h
2 #define DataFormats_Common_View_h
22 #include "boost/iterator/indirect_iterator.hpp"
41 std::unique_ptr<ViewBase>
clone()
const;
47 virtual std::unique_ptr<ViewBase>
doClone()
const = 0;
70 class View :
public ViewBase {
71 typedef std::vector<T const*>
seq_t;
81 typedef boost::indirect_iterator<typename seq_t::const_iterator>
const_iterator;
97 View(std::vector<void const*>
const& pointers,
125 std::vector<Ptr<value_type> >
const&
ptrs()
const;
139 std::unique_ptr<ViewBase>
doClone()
const override;
145 template<
typename T>
bool operator< (View<T>
const&,
View<T> const&);
146 template<
typename T>
bool operator<=(View<T>
const&,
View<T> const&);
172 assert(numElements == helpers.size());
174 items_.reserve(numElements);
175 vPtrs_.reserve(numElements);
177 void const*
p = pointers[
i];
178 auto const&
h = helpers[
i];
179 items_.push_back(static_cast<pointer>(p));
181 vPtrs_.push_back(Ptr<T>(
h.first, static_cast<T const*>(p),
h.second));
182 }
else if(getter !=
nullptr) {
183 vPtrs_.push_back(Ptr<T>(
h.first,
h.second, getter));
185 vPtrs_.push_back(Ptr<T>(
h.first,
nullptr,
h.second));
199 items_.swap(other.items_);
200 vPtrs_.swap(other.vPtrs_);
206 View<T>::capacity()
const {
207 return items_.capacity();
212 typename View<T>::const_iterator
214 return items_.begin();
219 typename View<T>::const_iterator
226 typename View<T>::const_reverse_iterator
227 View<T>::rbegin()
const {
228 return items_.rbegin();
233 typename View<T>::const_reverse_iterator
234 View<T>::rend()
const {
235 return items_.rend();
242 return items_.size();
248 View<T>::max_size()
const {
249 return items_.max_size();
256 return items_.empty();
261 typename View<T>::const_reference
263 return *items_.at(pos);
268 typename View<T>::const_reference
281 return RefToBase<T>(std::unique_ptr<reftobase::BaseHolder<T>>{
282 new reftobase::IndirectHolder<T>{
283 std::unique_ptr<reftobase::RefHolder<edm::Ptr<T>>>{
284 new reftobase::RefHolder<Ptr<T>>{ptrAt(i)}
299 std::vector<Ptr<T> >
const&
300 View<T>::ptrs()
const {
307 typename View<T>::const_reference
308 View<T>::front()
const {
309 return *items_.front();
314 typename View<T>::const_reference
315 View<T>::back()
const {
316 return *items_.back();
326 output.items_[
i] = first;
330 std::unique_ptr<ViewBase>
331 View<T>::doClone()
const {
332 return std::unique_ptr<ViewBase>{
new View(*
this)};
338 View<T>::operator=(View<T>
const& rhs) {
349 lhs.size() == rhs.size() &&
350 std::equal(lhs.begin(), lhs.end(), rhs.begin());
357 return !(lhs == rhs);
363 operator<(View<T>
const& lhs,
View<T> const& rhs) {
364 return std::lexicographical_compare(lhs.begin(), lhs.end(),
365 rhs.begin(), rhs.end());
371 operator<=(View<T>
const& lhs,
View<T> const& rhs) {
void swap(ora::Record &rh, ora::Record &lh)
const_reverse_iterator rbegin() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
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