|
|
Go to the documentation of this file. 1 #ifndef DataFormats_Common_View_h
2 #define DataFormats_Common_View_h
22 #include "boost/iterator/indirect_iterator.hpp"
46 std::unique_ptr<ViewBase>
clone()
const;
52 virtual std::unique_ptr<ViewBase>
doClone()
const = 0;
74 class View :
public ViewBase {
75 typedef std::vector<T const*>
seq_t;
86 typedef boost::indirect_iterator<typename seq_t::const_iterator>
const_iterator;
128 std::vector<Ptr<value_type>>
const&
ptrs()
const;
142 std::unique_ptr<ViewBase>
doClone()
const override;
146 template <
typename T>
148 template <
typename T>
150 template <
typename T>
152 template <
typename T>
154 template <
typename T>
156 template <
typename T>
163 template <
typename T>
166 template <
typename T>
170 : items_(), vPtrs_() {
178 items_.reserve(numElements);
179 vPtrs_.reserve(numElements);
181 void const*
p = pointers[
i];
183 items_.push_back(static_cast<pointer>(
p));
185 vPtrs_.push_back(Ptr<T>(
h.first, static_cast<T const*>(
p),
h.second));
186 }
else if (getter !=
nullptr) {
187 vPtrs_.push_back(Ptr<T>(
h.first,
h.second, getter));
189 vPtrs_.push_back(Ptr<T>(
h.first,
nullptr,
h.second));
194 template <
typename T>
197 template <
typename T>
200 items_.swap(
other.items_);
201 vPtrs_.swap(
other.vPtrs_);
204 template <
typename T>
206 return items_.capacity();
209 template <
typename T>
211 return items_.begin();
214 template <
typename T>
215 inline typename View<T>::const_iterator
View<T>::end()
const {
219 template <
typename T>
220 inline typename View<T>::const_reverse_iterator
View<T>::rbegin()
const {
221 return items_.rbegin();
224 template <
typename T>
225 inline typename View<T>::const_reverse_iterator
View<T>::rend()
const {
226 return items_.rend();
229 template <
typename T>
231 return items_.size();
234 template <
typename T>
236 return items_.max_size();
239 template <
typename T>
241 return items_.empty();
244 template <
typename T>
246 return *items_.at(
pos);
249 template <
typename T>
254 template <
typename T>
261 std::unique_ptr<reftobase::RefHolder<edm::Ptr<T>>>{
new reftobase::RefHolder<Ptr<T>>{ptrAt(
i)}}}});
264 template <
typename T>
269 template <
typename T>
274 template <
typename T>
276 return *items_.front();
279 template <
typename T>
280 inline typename View<T>::const_reference
View<T>::back()
const {
281 return *items_.back();
285 template <
typename T>
292 template <
typename T>
294 return std::unique_ptr<ViewBase>{
new View(*
this)};
297 template <
typename T>
304 template <
typename T>
306 return lhs.size() == rhs.size() &&
std::equal(lhs.begin(), lhs.end(), rhs.begin());
309 template <
typename T>
311 return !(lhs == rhs);
314 template <
typename T>
316 return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
319 template <
typename T>
324 template <
typename T>
329 template <
typename T>
335 template <
typename T>
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
const_iterator begin() const
std::vector< T const * > seq_t
std::unique_ptr< ViewBase > doClone() const override
T const & const_reference
RefToBase< value_type > refAt(size_type i) const
std::vector< Ptr< value_type > > const & ptrs() const
seq_t::difference_type difference_type
void swap(Association< C > &lhs, Association< C > &rhs)
const_reverse_iterator rbegin() const
const_reverse_iterator rend() const
T first(std::pair< T, U > const &p)
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
ViewBase & operator=(ViewBase const &)
virtual std::unique_ptr< ViewBase > doClone() const =0
std::vector< Ptr< value_type > > vPtrs_
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
std::unique_ptr< ViewBase > clone() const
const_reference front() const
bool operator<=(View< T > const &, View< T > const &)
bool operator>(View< T > const &, View< T > const &)
const_reference at(size_type pos) const
View & operator=(View const &rhs)
const_reference operator[](size_type pos) const
const_reference back() const
static void fill_from_range(T *first, T *last, View &output)
boost::indirect_iterator< typename seq_t::const_reverse_iterator > const_reverse_iterator
size_type max_size() const
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
bool operator>=(View< T > const &, View< T > const &)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator end() const
size_type capacity() const
bool equal(const T &first, const T &second)
Ptr< value_type > ptrAt(size_type i) const