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;
54 virtual std::unique_ptr<ViewBase>
doClone()
const = 0;
76 class View :
public ViewBase {
77 typedef std::vector<T const*>
seq_t;
88 typedef boost::indirect_iterator<typename seq_t::const_iterator>
const_iterator;
126 std::vector<Ptr<value_type>>
const&
ptrs()
const;
140 std::unique_ptr<ViewBase>
doClone()
const override;
144 template <
typename T>
146 template <
typename T>
148 template <
typename T>
149 bool operator<(View<T>
const&,
View<T> const&);
150 template <
typename T>
151 bool operator<=(View<T>
const&,
View<T> const&);
152 template <
typename T>
154 template <
typename T>
161 template <
typename T>
164 template <
typename T>
168 : items_(), vPtrs_() {
179 void const*
p = pointers[
i];
181 items_.push_back(static_cast<pointer>(
p));
183 vPtrs_.push_back(Ptr<T>(
h.first, static_cast<T const*>(
p),
h.second));
184 }
else if (getter !=
nullptr) {
185 vPtrs_.push_back(Ptr<T>(
h.first,
h.second, getter));
187 vPtrs_.push_back(Ptr<T>(
h.first,
nullptr,
h.second));
192 template <
typename T>
195 items_.swap(
other.items_);
196 vPtrs_.swap(
other.vPtrs_);
199 template <
typename T>
201 return items_.capacity();
204 template <
typename T>
206 return items_.begin();
209 template <
typename T>
210 inline typename View<T>::const_iterator
View<T>::end()
const {
214 template <
typename T>
215 inline typename View<T>::const_reverse_iterator View<T>::rbegin()
const {
216 return items_.rbegin();
219 template <
typename T>
220 inline typename View<T>::const_reverse_iterator View<T>::rend()
const {
221 return items_.rend();
224 template <
typename T>
226 return items_.size();
229 template <
typename T>
231 return items_.max_size();
234 template <
typename T>
236 return items_.empty();
239 template <
typename T>
240 inline typename View<T>::const_reference View<T>::at(
size_type pos)
const {
241 return *items_.at(
pos);
244 template <
typename T>
249 template <
typename T>
255 return RefToBase<T>(std::unique_ptr<reftobase::BaseHolder<T>>{
new reftobase::IndirectHolder<T>{
256 std::unique_ptr<reftobase::RefHolder<edm::Ptr<T>>>{
new reftobase::RefHolder<Ptr<T>>{ptrAt(
i)}}}});
259 template <
typename T>
260 inline Ptr<T> View<T>::ptrAt(
size_type i)
const {
264 template <
typename T>
265 inline std::vector<Ptr<T>>
const& View<T>::ptrs()
const {
269 template <
typename T>
270 inline typename View<T>::const_reference View<T>::front()
const {
271 return *items_.front();
274 template <
typename T>
275 inline typename View<T>::const_reference View<T>::back()
const {
276 return *items_.back();
280 template <
typename T>
287 template <
typename T>
288 std::unique_ptr<ViewBase> View<T>::doClone()
const {
289 return std::unique_ptr<ViewBase>{
new View(*
this)};
292 template <
typename T>
294 return lhs.size() == rhs.size() &&
std::equal(lhs.begin(), lhs.end(), rhs.begin());
297 template <
typename T>
299 return !(lhs == rhs);
302 template <
typename T>
303 inline bool operator<(View<T>
const& lhs,
View<T> const& rhs) {
304 return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
307 template <
typename T>
308 inline bool operator<=(View<T>
const& lhs,
View<T> const& rhs) {
312 template <
typename T>
317 template <
typename T>
323 template <
typename T>
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
RefToBase< value_type > refAt(size_type i) const
Ptr< value_type > ptrAt(size_type i) const
std::vector< Ptr< value_type > > const & ptrs() const
const_reverse_iterator rbegin() const
void swap(View< T > &lhs, View< T > &rhs)
std::vector< T const * > seq_t
const_reference front() const
seq_t::difference_type difference_type
std::unique_ptr< ViewBase > clone() const
virtual std::unique_ptr< ViewBase > doClone() const =0
bool equal(const T &first, const T &second)
constexpr bool operator>=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
const_reverse_iterator rend() const
bool operator>=(View< T > const &, View< T > const &)
std::vector< Ptr< value_type > > vPtrs_
bool operator>(View< T > const &, View< T > const &)
const_reference operator[](size_type pos) const
constexpr bool operator!=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
const_reference at(size_type pos) const
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ uint32_t numElements
ViewBase & operator=(ViewBase const &)=default
constexpr bool operator>(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
bool operator!=(View< T > const &, View< T > 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 back() const
bool operator==(View< T > const &, View< T > const &)
size_type max_size() const
const_iterator begin() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
T first(std::pair< T, U > const &p)
T operator[](int i) const
T const & const_reference
const_iterator end() const
size_type capacity() const
size d for d tracks hist hist capacity()
std::unique_ptr< ViewBase > doClone() const override
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector