1 #ifndef DataFormats_Common_View_h
2 #define DataFormats_Common_View_h
23 #include "boost/iterator/indirect_iterator.hpp"
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,
140 return refs_.product();
153 template<
typename T>
bool operator< (View<T>
const&,
View<T> const&);
154 template<
typename T>
bool operator<=(View<T>
const&,
View<T> const&);
181 if(helpers.get() != 0) {
182 assert(numElements == helpers->size());
184 items_.reserve(numElements);
187 void const*
p = pointers[
i];
188 items_.push_back(static_cast<pointer>(p));
190 ptrs_.push_back(Ptr<T>(helpers->id(),
static_cast<T const*
>(
p), helpers->keyForIndex(
i)));
191 }
else if(helpers->productGetter() != 0) {
192 ptrs_.push_back(Ptr<T>(helpers->id(), helpers->keyForIndex(
i), helpers->productGetter()));
194 ptrs_.push_back(Ptr<T>(helpers->id(), 0, helpers->keyForIndex(
i)));
211 items_.swap(other.items_);
212 refs_.swap(other.refs_);
213 ptrs_.swap(other.ptrs_);
225 typename View<T>::const_iterator
232 typename View<T>::const_iterator
239 typename View<T>::const_reverse_iterator
246 typename View<T>::const_reverse_iterator
274 typename View<T>::const_reference
281 typename View<T>::const_reference
298 return Ptr<T>(ref.id(), (ref.isAvailable() ? ref.get(): 0), ref.key());
303 typename View<T>::const_reference
310 typename View<T>::const_reference
332 return refs_.productGetter();
340 output.items_.resize(std::distance(first, last));
342 output.items_[i] = first;
348 return new View(*
this);
365 lhs.size() == rhs.size() &&
366 std::equal(lhs.begin(), lhs.end(), rhs.begin());
373 return !(lhs == rhs);
379 operator<(View<T>
const& lhs,
View<T> const& rhs) {
380 return std::lexicographical_compare(lhs.begin(), lhs.end(),
381 rhs.begin(), rhs.end());
387 operator<=(View<T>
const& lhs,
View<T> const& rhs) {
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
const_reference front() const
const_reverse_iterator rbegin() const
virtual ViewBase * doClone() const =0
View & operator=(View const &rhs)
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
size_type capacity() const
const_reverse_iterator rend() const
RefToBase< value_type > refAt(size_type i) const
T const & const_reference
void swap(Association< C > &lhs, Association< C > &rhs)
ViewBase * doClone() const
seq_t::difference_type difference_type
bool operator>=(View< T > const &, View< T > const &)
Ptr< value_type > ptrAt(size_type i) const
RefToBaseVector< T > refs_
static void fill_from_range(T *first, T *last, View &output)
size_type max_size() const
boost::indirect_iterator< typename seq_t::const_reverse_iterator > const_reverse_iterator
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
bool operator>(View< T > const &, View< T > const &)
void const * product() const
const_reference back() const
ViewBase & operator=(ViewBase const &)
const_reference operator[](size_type pos) const
const_reference at(size_type pos) const
std::vector< T const * > seq_t
const_iterator begin() const
const_iterator end() const
PtrVector< T > const & ptrVector() const
T first(std::pair< T, U > const &p)
EDProductGetter const * productGetter() const
RefToBaseVector< T > const & refVector() const