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>
151 bool operator<(View<T>
const&,
View<T> const&);
152 template <
typename T>
153 bool operator<=(View<T>
const&,
View<T> const&);
154 template <
typename T>
156 template <
typename T>
163 template <
typename T>
166 template <
typename T>
170 : items_(), vPtrs_() {
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>
210 inline typename View<T>::const_iterator View<T>::begin()
const {
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>
245 inline typename View<T>::const_reference View<T>::at(
size_type pos)
const {
246 return *items_.at(
pos);
249 template <
typename T>
254 template <
typename T>
260 return RefToBase<T>(std::unique_ptr<reftobase::BaseHolder<T>>{
new reftobase::IndirectHolder<T>{
261 std::unique_ptr<reftobase::RefHolder<edm::Ptr<T>>>{
new reftobase::RefHolder<Ptr<T>>{ptrAt(
i)}}}});
264 template <
typename T>
265 inline Ptr<T> View<T>::ptrAt(
size_type i)
const {
269 template <
typename T>
270 inline std::vector<Ptr<T>>
const& View<T>::ptrs()
const {
274 template <
typename T>
275 inline typename View<T>::const_reference View<T>::front()
const {
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>
293 std::unique_ptr<ViewBase> View<T>::doClone()
const {
294 return std::unique_ptr<ViewBase>{
new View(*
this)};
297 template <
typename T>
298 inline View<T>& View<T>::operator=(View<T>
const& rhs) {
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>
315 inline bool operator<(View<T>
const& lhs,
View<T> const& rhs) {
316 return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
319 template <
typename T>
320 inline bool operator<=(View<T>
const& lhs,
View<T> const& rhs) {
324 template <
typename T>
329 template <
typename T>
335 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 &)
View & operator=(View const &rhs)
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
ViewBase & operator=(ViewBase 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
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