ATLAS Offline Software
DataVector.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5 */
520 #ifndef ATHCONTAINERS_DATAVECTOR_H
521 #define ATHCONTAINERS_DATAVECTOR_H
522 
523 
524 // For feature tests.
525 #define HAVE_CONSTDATAVECTOR
526 
527 
541 #include "CxxUtils/concepts.h"
542 #include <boost/iterator/iterator_adaptor.hpp>
543 #include <type_traits>
544 #include <vector>
545 #include <typeinfo>
546 #include <functional>
547 #include <iostream>
548 #include <algorithm>
549 #include <stdexcept>
550 #include <iterator>
551 #include <initializer_list>
552 #include <RootMetaSelection.h>
553 
554 
555 
556 #ifdef XAOD_STANDALONE
557 # ifndef SG_BASE
558 # define SG_BASE(A, B) class ATHCONTAINERS_DUMMY
559 # endif // not SG_BASE
560 # ifndef SG_BASES1
561 # define SG_BASES1(A, B) class ATHCONTAINERS_DUMMY
562 # endif // not SG_BASES1
563 # ifndef SG_BASES2
564 # define SG_BASES2(A, B, C) class ATHCONTAINERS_DUMMY
565 # endif // not SG_BASES2
566 # ifndef SG_BASES3
567 # define SG_BASES3(A, B, C, D) class ATHCONTAINERS_DUMMY
568 # endif // not SG_BASES3
569 # ifndef SG_BASES4
570 # define SG_BASES4(A, B, C, D, E) class ATHCONTAINERS_DUMMY
571 # endif // not SG_BASES4
572 # ifndef SG_VIRTUAL
573 # define SG_VIRTUAL(X) X
574 # endif // not SG_VIRTUAL
575 #else
576 # include "AthenaKernel/BaseInfo.h"
577 #endif
578 
579 
580 // Forward declarations.
581 namespace ROOT { namespace Meta { namespace Selection {
582  template <class T, class BASE> class DataVector;
583 }}}
584 
585 
586 namespace DataVector_detail {
587 
588 
589 // These are the intermediate classes from which @c DataVector derives
590 // in the case of multiple or virtual derivation. The actual
591 // definitions are in the @c icc file. They have the following
592 // properties:
593 // - They derive from those of @c B1, @c B2, and @c B3 that are not
594 // @c NoBase.
595 // - They perform (static) checking to ensure that there's a unique
596 // base class in the hierarchy.
597 // - They make the following types available from the base classes:
598 // - @c PtrVector
599 // - @c BaseContainer
600 // - @c size_type
601 // - @c difference_type
602 // - @c allocator_type
603 // - @c has_virtual is defined as @c true.
604 // - An override of @c dvlinfo_v is defined, to prevent ambiguities.
605 template <class B1,
606  class B2=DataModel_detail::NoBase,
608 
609 
612 template <class ITERATOR, class T>
614  std::enable_if_t<std::is_convertible_v<typename std::iterator_traits<ITERATOR>::value_type, T*>, bool>;
615 
616 template <class ITERATOR, class T>
618  std::enable_if_t<std::is_convertible_v<typename std::iterator_traits<ITERATOR>::value_type, std::unique_ptr<T> >, bool>;
619 
620 
621 } // namespace DataVector_detail
622 
623 
624 
633 template <class T>
635 {
637 };
638 
639 
649 #define DATAVECTOR_BASE(T, BASE) \
650 DATAVECTOR_BASE_FWD(T, BASE); \
651 template struct DataVector_detail::DVLEltBaseInit<T>
652 
653 
658 #define DATAVECTOR_BASE_FWD(T, BASE) \
659 template <> struct DataVectorBase<T> \
660 { typedef DataVector<BASE> Base; }; \
661 SG_BASE(DataVector<T>, DataVector<BASE>)
662 
663 
673 #define DATAVECTOR_VIRTBASES1(T, B1) \
674 DATAVECTOR_VIRTBASES1_FWD(T, B1); \
675 template struct DataVector_detail::DVLEltBaseInit<T>
676 
677 
678 
683 #define DATAVECTOR_VIRTBASES1_FWD(T, B1) \
684 template <> struct DataVectorBase<T> \
685 { typedef DataVector_detail::VirtBases<B1> Base; }; \
686 SG_BASES1(DataVector<T>, SG_VIRTUAL(DataVector<B1>))
687 
688 
689 
699 #define DATAVECTOR_VIRTBASES2(T, B1, B2) \
700 DATAVECTOR_VIRTBASES2_FWD(T, B1, B2); \
701 template struct DataVector_detail::DVLEltBaseInit<T>
702 
703 
708 #define DATAVECTOR_VIRTBASES2_FWD(T, B1, B2) \
709 template <> struct DataVectorBase<T> \
710 { typedef DataVector_detail::VirtBases<B1, B2> Base; }; \
711 SG_BASES2(DataVector<T>, SG_VIRTUAL(DataVector<B1>), \
712  SG_VIRTUAL(DataVector<B2>))
713 
714 
724 #define DATAVECTOR_VIRTBASES3(T, B1, B2, B3) \
725 DATAVECTOR_VIRTBASES3_FWD(T, B1, B2, B3); \
726 template struct DataVector_detail::DVLEltBaseInit<T>
727 
728 
733 #define DATAVECTOR_VIRTBASES3_FWD(T, B1, B2, B3) \
734 template <> struct DataVectorBase<T> \
735 { typedef DataVector_detail::VirtBases<B1, B2, B3> Base; }; \
736 SG_BASES3(DataVector<T>, SG_VIRTUAL(DataVector<B1>), \
737  SG_VIRTUAL(DataVector<B2>), \
738  SG_VIRTUAL(DataVector<B3>))
739 
740 
750 #define DATAVECTOR_VIRTBASES4(T, B1, B2, B3, B4) \
751 DATAVECTOR_VIRTBASES4_FWD(T, B1, B2, B3, B4); \
752 template struct DataVector_detail::DVLEltBaseInit<T>
753 
754 
759 #define DATAVECTOR_VIRTBASES4_FWD(T, B1, B2, B3, B4) \
760 template <> struct DataVectorBase<T> \
761 { typedef DataVector_detail::VirtBases<B1, B2, B3, B4> Base; }; \
762 SG_BASES4(DataVector<T>, SG_VIRTUAL(DataVector<B1>), \
763  SG_VIRTUAL(DataVector<B2>), \
764  SG_VIRTUAL(DataVector<B3>), \
765  SG_VIRTUAL(DataVector<B4>))
766 
767 
774 #define DATAVECTOR_BASE_FIN(T, B) \
775 template struct DataVector_detail::DVLEltBaseInit<T>
776 
777 
778 template <class DV> class ConstDataVector;
779 template <class DV> void test2_assignelement1();
780 template <class DV> void test2_assignelement1a();
781 template <class DV> void test2_assignelement2();
782 
783 
793 template <class T, class BASE = typename DataVectorBase<T>::Base>
794 class DataVector : public BASE
795 {
796 public:
797  typedef BASE DataVector_BASE;
798  typedef BASE DVL_BASE;
799 
802  static const bool has_virtual = BASE::has_virtual;
803 
806  typedef typename BASE::PtrVector PtrVector;
807  typedef typename BASE::PtrVector BaseContainer;
808 
809 
810 public:
811  // Standard types required for the container interface.
812  typedef T*& reference;
813  typedef T* const & const_reference;
814  typedef typename BASE::size_type size_type;
815  typedef typename BASE::difference_type difference_type;
816  typedef T* value_type;
817  typedef typename BASE::allocator_type allocator_type;
818  typedef T** pointer;
819  typedef T* const * const_pointer;
820 
821  typedef const T* const_value_type;
822 
826 
829  typedef std::unique_ptr<base_value_type> unique_type;
830 
834 
835 
839 
843 
844 
846  typedef typename std::reverse_iterator<const_iterator>
848 
851  typedef typename std::reverse_iterator<iterator>
853 
855 
856 
857  using Deleter = typename BASE::Deleter;
858 
860  static constexpr bool must_own = BASE::must_own;
861 
862 
863  //========================================================================
866 
867 
877  SG::IndexTrackingPolicy trackIndices =
879 
880 
893  explicit DataVector(size_type n, /* value_type pElem = 0,*/
895  SG::IndexTrackingPolicy trackIndices =
897 
898 
905  // The copy constructor for derived classes is deliberately omitted,
906  // as otherwise we get warnings about not calling the copy constructors
907  // for base classes, which are problematic when we have virtual
908  // inheritance. Most of what needs doing is done in the base class anyway,
909  // except for setting @c m_isMostDerived. We arrange for these flags
910  // to all get set to false; they'll get set correctly when
911  // @c testInsert is called.
912  // Need this to get the default copy ctor defined when a move
913  // ctor is also present.
914  DataVector (const DataVector&) = default;
915 
916 
923  DataVector (DataVector&& rhs) noexcept;
924 
925 
938  template <class InputIterator>
939  DataVector(InputIterator first,
940  InputIterator last,
943  SG::IAuxStore* store = 0);
944 
945 
956  DataVector(std::initializer_list<value_type> l,
959  SG::IAuxStore* store = 0);
960 
961 
975 
976 
984 
985 
996  DataVector& operator= (std::initializer_list<value_type> l);
997 
998 
1008  template <class InputIterator>
1009  void assign(InputIterator first, InputIterator last);
1010 
1011 
1019  void assign(std::initializer_list<value_type> l);
1020 
1021 
1022  // Destructor is inherited.
1023 
1024 
1026  //========================================================================
1029 
1030 
1038  size_type size() const noexcept;
1039 
1040 
1045  // This is inherited from the base class.
1046 
1047 
1060 
1061 
1067  // This is inherited from the base class.
1068 
1069 
1074  // This is inherited from the base class.
1075 
1076 
1084 
1085 
1091  // This is inherited from the base class.
1092 
1093 
1095  //========================================================================
1098 
1099 
1108  const T* operator[] (size_type n) const;
1109 
1110 
1120 
1121 
1131  ElementProxy operator[] (size_type n);
1132 
1133 
1143 
1144 
1155 
1156 
1165 
1166 
1175 
1176 
1186 
1187 
1197 
1198 
1200  //========================================================================
1203 
1204 
1214 
1215 
1225 
1226 
1236  iterator begin() noexcept;
1237 
1238 
1248  iterator end() noexcept;
1249 
1250 
1260 
1261 
1271 
1272 
1283 
1284 
1295 
1296 
1306 
1307 
1317 
1318 
1328 
1329 
1339 
1340 
1342  //========================================================================
1345 
1346 
1360 
1361 
1373  value_type push_back(std::unique_ptr<base_value_type> pElem);
1374 
1375 
1394 
1395 
1411 
1412 
1426 
1427 
1439  iterator insert(iterator position, std::unique_ptr<base_value_type> pElem);
1440 
1441 
1458 
1459 
1475  template <class InputIterator,
1476  DataVector_detail::enable_if_ptr_itr<InputIterator, T> = true>
1477  void insert(iterator position, InputIterator first, InputIterator last);
1478 
1479 
1495  template <class InputIterator,
1496  DataVector_detail::enable_if_up_itr<InputIterator, T> = true>
1497  void insert(iterator position, InputIterator first, InputIterator last);
1498 
1499 
1511  void insert(iterator position, std::initializer_list<value_type> l);
1512 
1513 
1540 
1541 
1543  //========================================================================
1546 
1547 
1557 
1558 
1571 
1572 
1580  void pop_back();
1581 
1582 
1591  void clear();
1592 
1593 
1595  //========================================================================
1598 
1599 
1610  void swap(DataVector& rhs);
1611 
1612 
1618  static void iter_swap (iterator a, iterator b);
1619 
1620 
1626  void sort();
1627 
1628 
1633  template <class COMPARE>
1634  void sort(COMPARE comp);
1635 
1636 
1637 
1639  //========================================================================
1642 
1643 
1662 
1663 
1681  void swapElement(iterator pos, value_type newElem, reference oldElem);
1682 
1683 
1704  std::unique_ptr<base_value_type> newElem,
1705  std::unique_ptr<base_value_type>& oldElem);
1706 
1707 
1728  std::unique_ptr<base_value_type> newElem,
1729  std::unique_ptr<base_value_type>& oldElem);
1730 
1731 
1732 public:
1741  // This is inherited from the base class.
1742 
1743 
1748  // This is inherited from the base class.
1749 
1750 
1762 
1763 
1776  SG::IndexTrackingPolicy trackIndices);
1777 
1778 
1790  void clear (std::unique_ptr<Deleter> deleter);
1791 
1792 
1798  static const DataModel_detail::DVLInfoBase& dvlinfo();
1799 
1800 
1806  virtual const DataModel_detail::DVLInfoBase& dvlinfo_v() const override;
1807 
1808 
1820  static
1821  int baseOffset (const std::type_info& ti);
1822 
1823 
1834  const SG::AuxVectorBase& auxbase() const;
1835 
1836 
1838  //========================================================================
1839 
1840 
1841  // Doxygen trick. We want DataVector<T> to show the complete interface,
1842  // including inherited methods. Normally, doxygen would do this.
1843  // But it's not smart enough to figure out our inheritance relationships.
1844  // We can add a function with `fn', but doxygen won't actually
1845  // generate the documentation unless it also sees the declaration.
1846  // So here are declarations which should be visible to doxygen
1847  // but not to C++.
1848 #ifndef __cplusplus
1852  [[nodiscard]] bool empty() const noexcept;
1854  void pop_back();
1855  void clear();
1859  SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES);
1860 #endif // not __cplusplus
1861 
1862 
1865 
1866 
1877  static
1878  int baseOffset1 (const char* p, const DataVector& dv,
1879  const std::type_info& ti);
1880 
1881 
1893 
1894 
1905  void testInsert (const char* op);
1906 
1907 
1918  void testInsertOol (const char* op);
1919 
1920 
1921 private:
1923  template <class DV>
1924  friend class ConstDataVector;
1925  template <class DV, class ALLOC>
1926  friend class DataVectorWithAlloc;
1927  friend void test2_assignelement1a<DataVector>();
1928  friend void test2_assignelement1<DataVector>();
1929  friend void test2_assignelement2<DataVector>();
1930 
1931 
1941 
1942 
1952  std::unique_ptr<base_value_type> newElem);
1953 
1954 
1964  typename BaseContainer::value_type newElem);
1965 
1966 
1990  void shift (size_t pos, ptrdiff_t offs);
1991 
1992 
1993 public:
1994  // Make this public so we can call it from DVCollectionProxy.
2003  static
2004  const T* do_cast (const typename PtrVector::value_type p);
2005 
2006 
2015  static
2016  T* do_cast_nc (typename PtrVector::value_type p);
2017 
2018 
2019 private:
2030  virtual const std::type_info& dv_typeid() const override;
2031 
2032 
2033 protected:
2040 
2041 
2049  virtual void setMostDerived() override;
2050 
2051 
2052 private:
2054 
2055 
2060 
2061 
2062  typedef typename
2064 };
2065 
2066 
2067 template <class T, class BASE>
2069 
2079 template <class T>
2081  : public SG::AuxVectorBase
2082 {
2083 public:
2086 
2088  typedef std::true_type isSequence;
2089 
2092  typedef std::vector<T*> PtrVector;
2093  typedef std::vector<T*> BaseContainer;
2094 
2099  static const bool has_virtual = false;
2100 
2101  // Standard types required for the container interface.
2102  typedef T*& reference;
2103  typedef T* const & const_reference;
2104  typedef typename PtrVector::size_type size_type;
2105  typedef typename PtrVector::difference_type difference_type;
2106  typedef T* value_type;
2107  typedef typename PtrVector::allocator_type allocator_type;
2108  typedef T** pointer;
2109  typedef T* const * const_pointer;
2110 
2111  typedef const T* const_value_type;
2112 
2116 
2119  typedef std::unique_ptr<base_value_type> unique_type;
2120 
2124 
2125 
2129 
2133 
2135  // Note: we can't just use the underlying PtrVector::const_reverse_iterator
2136  // here; otherwise, const_reverse_iterator won't be convertable to
2137  // reverse_iterator.
2138  typedef typename std::reverse_iterator<const_iterator>
2140 
2143  typedef typename std::reverse_iterator<iterator>
2145 
2147 
2148 
2152  class Deleter
2153  {
2154  public:
2157  virtual ~Deleter() = default;
2158  virtual void doDelete (value_type p) = 0;
2159  virtual void doDelete (typename PtrVector::iterator first,
2160  typename PtrVector::iterator last) = 0;
2161  };
2162 
2163 
2165  static constexpr bool must_own = false;
2166 
2167 
2168  //========================================================================
2171 
2172 
2182  SG::IndexTrackingPolicy trackIndices =
2184 
2185 
2198  explicit DataVector
2199  (size_type n, /* value_type pElem = 0,*/
2202 
2203 
2210  DataVector(const DataVector& rhs);
2211 
2212 
2219  DataVector (DataVector&& rhs) noexcept;
2220 
2221 
2234  template <class InputIterator>
2235  DataVector(InputIterator first, InputIterator last,
2238  SG::IAuxStore* store = 0);
2239 
2240 
2251  DataVector(std::initializer_list<value_type> l,
2254  SG::IAuxStore* store = 0);
2255 
2256 
2270 
2271 
2279 
2280 
2291  DataVector& operator= (std::initializer_list<value_type> l);
2292 
2293 
2303  template <class InputIterator>
2304  void assign(InputIterator first, InputIterator last);
2305 
2306 
2315  void assign(std::initializer_list<value_type> l);
2316 
2317 
2327  virtual ~DataVector();
2328 
2329 
2331  //========================================================================
2334 
2335 
2339  size_type size() const noexcept;
2340 
2341 
2348  virtual size_type size_v() const override;
2349 
2350 
2355 
2356 
2368 
2369 
2375 
2376 
2384  virtual size_type capacity_v() const override;
2385 
2386 
2390  [[nodiscard]] bool empty() const noexcept;
2391 
2392 
2399 
2400 
2407 
2408 
2410  //========================================================================
2413 
2414 
2423  const T* operator[] (size_type n) const;
2424 
2425 
2435 
2436 
2446  ElementProxy operator[] (size_type n);
2447 
2448 
2458 
2459 
2470 
2471 
2480 
2481 
2490 
2491 
2501 
2502 
2512 
2513 
2515  //========================================================================
2518 
2519 
2529 
2530 
2540 
2541 
2551  iterator begin() noexcept;
2552 
2553 
2563  iterator end() noexcept;
2564 
2565 
2575 
2576 
2586 
2587 
2598 
2599 
2610 
2620 
2621 
2631 
2632 
2642 
2643 
2653 
2654 
2656  //========================================================================
2659 
2660 
2674 
2675 
2687  value_type push_back(std::unique_ptr<base_value_type> pElem);
2688 
2689 
2708 
2709 
2725 
2726 
2740 
2741 
2753  iterator insert(iterator position, std::unique_ptr<base_value_type> pElem);
2754 
2755 
2772 
2773 
2789  template <class InputIterator,
2790  DataVector_detail::enable_if_ptr_itr<InputIterator, T> = true>
2791  void insert(iterator position, InputIterator first, InputIterator last);
2792 
2793 
2809  template <class InputIterator,
2810  DataVector_detail::enable_if_up_itr<InputIterator, T> = true>
2811  void insert(iterator position, InputIterator first, InputIterator last);
2812 
2813 
2825  void insert(iterator position, std::initializer_list<value_type> l);
2826 
2827 
2854 
2855 
2857  //========================================================================
2860 
2861 
2871 
2872 
2885 
2886 
2893  void pop_back();
2894 
2895 
2903  void clear();
2904 
2905 
2907  //========================================================================
2910 
2911 
2922  void swap(DataVector& rhs);
2923 
2924 
2930  static void iter_swap (iterator a, iterator b);
2931 
2932 
2938  void sort();
2939 
2940 
2946  template <class COMPARE>
2947  void sort(COMPARE comp);
2948 
2949 
2951  //========================================================================
2954 
2955 
2974 
2975 
2993  void swapElement(iterator pos, value_type newElem, reference oldElem);
2994 
2995 
3016  std::unique_ptr<base_value_type> newElem,
3017  std::unique_ptr<base_value_type>& oldElem);
3018 
3019 
3039  std::unique_ptr<base_value_type> newElem,
3040  std::unique_ptr<base_value_type>& oldElem);
3041 
3042 
3043 public:
3052 
3053 
3058 
3059 
3070 
3071 
3083  SG::IndexTrackingPolicy trackIndices);
3084 
3085 
3097  void clear (std::unique_ptr<Deleter> deleter);
3098 
3099 
3105  static const DataModel_detail::DVLInfoBase& dvlinfo();
3106 
3107 
3113  virtual const DataModel_detail::DVLInfoBase& dvlinfo_v() const;
3114 
3115 
3127  static
3128  int baseOffset (const std::type_info& ti);
3129 
3130 
3137  const SG::AuxVectorBase& auxbase() const;
3138 
3139 
3141  //========================================================================
3144 
3145 
3156  static
3158  const std::type_info& ti);
3159 
3160 
3172 
3173 
3184  void testInsert (const char* op);
3185 
3186 
3197  void testInsertOol (const char* op);
3198 
3199 
3200 private:
3201  friend class DataModel_detail::ElementProxy<DataVector>;
3202  template <class DV>
3203  friend class ConstDataVector;
3204  template <class DV, class ALLOC>
3205  friend class DataVectorWithAlloc;
3209 
3210 
3220 
3221 
3231  std::unique_ptr<base_value_type> newElem);
3232 
3233 
3243  typename BaseContainer::value_type newElem);
3244 
3245 
3269  void shift (size_t pos, ptrdiff_t offs);
3270 
3271 
3272 public:
3273  // Make this public so we can call it from DVCollectionProxy.
3281  static
3283 
3284 
3292  static
3294 
3295 
3296 private:
3307  virtual const std::type_info& dv_typeid() const;
3308 
3309 
3310 protected:
3321  erase_base(typename PtrVector::iterator position);
3322 
3323 
3337  typename PtrVector::iterator last);
3338 
3339 
3344  void doDelete (value_type p);
3345 
3346 
3353  typename PtrVector::iterator last);
3354 
3355 
3356 protected:
3359  SG::OwnershipPolicy m_ownPolicy;
3360 
3362  PtrVector m_pCont;
3363 
3366  // This should really be a unique_ptr --- but that causes problems
3367  // with ROOT persistency (even though this is tagged as transient).
3368  Deleter* m_deleter = nullptr;
3369 
3370 
3377 
3378 
3386  virtual void setMostDerived();
3387 
3388 
3389 private:
3391 
3392 
3396  SG::IsMostDerivedFlag m_isMostDerived;
3397 
3398 
3399  typedef typename
3400  ROOT::Meta::Selection::DataVector<T, DataVector_BASE>::self self;
3401 };
3402 
3403 template <class T>
3405 
3406 
3417 template <class T>
3418 bool operator== (const DataVector<T>& a, const DataVector<T>& b);
3419 
3420 
3422 template <class T>
3423 bool operator!= (const DataVector<T>& a, const DataVector<T>& b);
3424 
3425 
3437 template <class T>
3438 bool operator< (const DataVector<T>& a, const DataVector<T>& b);
3439 
3440 
3442 template <class T>
3443 bool operator> (const DataVector<T>& a, const DataVector<T>& b);
3444 
3445 
3447 template <class T>
3448 bool operator<= (const DataVector<T>& a, const DataVector<T>& b);
3449 
3450 
3452 template <class T>
3453 bool operator>= (const DataVector<T>& a, const DataVector<T>& b);
3454 
3455 
3457 template <class T>
3459 
3460 
3461 namespace ROOT { namespace Meta { namespace Selection {
3462 
3463 template< class T, class BASE >
3464 class DataVector : KeepFirstTemplateArguments< 1 >, SelectNoInstance
3465 {
3466 
3467 public:
3470 #ifndef XAOD_STANDALONE
3471  //MN: this causes massive dictionary duplication. Disabling for now.
3473  // ROOT::Meta::Selection::MemberAttributes< kAutoSelected > m_pCont;
3474 #endif
3475  ROOT::Meta::Selection::MemberAttributes< kTransient > m_isMostDerived;
3477  ROOT::Meta::Selection::MemberAttributes< kTransient > m_deleter;
3478 
3481  ROOT::Meta::Selection::MemberAttributes< kTransient > m_ownPolicy;
3482 
3483 };
3484 
3485 }}} // namespace
3486 
3487 
3488 #include "AthContainers/ClassName.h"
3489 
3490 
3497 template <class T>
3499 {
3500 public:
3501  static std::string name();
3502 };
3503 
3504 
3505 #ifndef XAOD_STANDALONE
3506 
3507 
3510 #include "AthenaKernel/TopBase.h"
3511 
3512 
3513 namespace SG {
3514 
3515 
3522 template <class T, class U>
3524 {
3526  static void init() { DataVector<T>::dvlinfo(); }
3527 };
3528 
3529 
3536 template <class T>
3539 };
3540 template <class T>
3543 };
3544 
3545 
3546 } // namespace SG
3547 
3548 
3549 #endif
3550 
3551 
3553 #endif // not ATHCONTAINERS_DATAVECTOR_H
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DataVector< T, DataModel_detail::NoBase >::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Standard reverse_iterator.
Definition: DataVector.h:2144
plotting.yearwise_luminosity_vs_mu.comp
comp
Definition: yearwise_luminosity_vs_mu.py:23
SGTest::store
TestStore store
Definition: TestStore.cxx:23
DataVector::DataVector
DataVector(const DataVector &)=default
Copy constructor.
DataVector::const_reference
T *const & const_reference
Definition: DataVector.h:813
SG::DataBucketTrait< DataVector< T >, U >::type
SG::DVLDataBucket< U > type
Definition: DataVector.h:3525
DataVector< T, DataModel_detail::NoBase >::iterator
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
Definition: DataVector.h:2132
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
fitman.sz
sz
Definition: fitman.py:527
PlotCalibFromCool.dv
dv
Definition: PlotCalibFromCool.py:762
SG::IsMostDerivedFlag
Holder for the is-most-derived flag.
Definition: IsMostDerivedFlag.h:34
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
DataVector< T, DataModel_detail::NoBase >::reference
T *& reference
Definition: DataVector.h:2102
DataVector::emplace_back
value_type emplace_back(value_type pElem)
Add an element to the end of the collection.
DataVector::iterator
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
Definition: DataVector.h:842
DataVector< T, DataModel_detail::NoBase >::DataVector
DataVector(DataVector &&rhs) noexcept
Move constructor.
DataVector< T, DataModel_detail::NoBase >::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Standard const_reverse_iterator.
Definition: DataVector.h:2139
SG::DataBucketTrait< DataVector< T >, U >::init
static void init()
Definition: DataVector.h:3526
DataVector::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition: DataVector.h:838
DataVector< T, DataModel_detail::NoBase >::Deleter::PtrVector
DataVector::PtrVector PtrVector
Definition: DataVector.h:2156
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
test2_assignelement2
void test2_assignelement2()
IndexTrackingPolicy.h
Describes the possible index tracking policies.
DataVector::rend
const_reverse_iterator rend() const noexcept
Return a const_reverse_iterator pointing at the beginning of the collection.
DataVectorBase
Derivation information for DataVector.
Definition: DataVector.h:635
index
Definition: index.py:1
DataVector::do_cast_nc
static T * do_cast_nc(typename PtrVector::value_type p)
Helper to shorten calls to DataModel_detail::DVLCast.
DataVectorWithAlloc
DataVector using a custom allocator for the elements.
Definition: DataVectorWithAlloc.h:67
exceptions.h
Exceptions that can be thrown from AthContainers.
taskman.template
dictionary template
Definition: taskman.py:314
DataVector::dvlinfo_v
virtual const DataModel_detail::DVLInfoBase & dvlinfo_v() const override
Return the DV/DL info struct for this class.
DataVector< T, DataModel_detail::NoBase >::pointer
T ** pointer
Definition: DataVector.h:2108
DataVector< T, DataModel_detail::NoBase >::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::get
const T * get(size_type n) const
Access an element, as an rvalue.
DataVector::shift
void shift(size_t pos, ptrdiff_t offs)
Shift the auxiliary elements of the container.
DVLInfo.h
Holder to implement conversion copies for DataVector/DataList.
TrigL2Bphys
Definition: TrigL2Bphys.h:43
SG::DEFAULT_TRACK_INDICES
@ DEFAULT_TRACK_INDICES
Default value.
Definition: IndexTrackingPolicy.h:40
DataVectorWithAllocFwd.h
DataVector::cend
const_iterator cend() const noexcept
Return a const_iterator pointing past the end of the collection.
detail
Definition: extract_histogram_tag.cxx:14
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:157
DataVector::testInsert
void testInsert(const char *op)
Test if we can insert; raise an exception if not.
DataVector::DVL_BASE
BASE DVL_BASE
Definition: DataVector.h:798
DataVector::assignBaseElement
void assignBaseElement(typename BaseContainer::iterator pos, typename BaseContainer::value_type newElem)
Handle element assignment from a base pointer.
DataVector::dv_typeid
virtual const std::type_info & dv_typeid() const override
Find the most-derived DataVector class in the hierarchy.
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
DataVector< T, DataModel_detail::NoBase >::unique_type
std::unique_ptr< base_value_type > unique_type
Type of a unique_ptr that can be used to insert elements into this container.
Definition: DataVector.h:2119
DataVector::operator=
DataVector & operator=(const DataVector &rhs)
Assignment operator.
DataVector::swapElement
void swapElement(size_type index, value_type newElem, reference oldElem)
Swap one element out of the container.
test2_assignelement1a
void test2_assignelement1a()
AuxVectorBase.h
Manage index tracking and synchronization of auxiliary data.
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition: AuxVectorBase.h:98
DataVector::DataVector
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
Default constructor.
DVLDataBucket.h
A DataBucket specialized for DataVector/DataList.
DataVector::PtrVector
BASE::PtrVector PtrVector
This is the type of the underlying std::vector (what stdcont returns).
Definition: DataVector.h:806
DataVector::push_new
size_type push_new(size_type n, F alloc)
Create and add a number of new elements to the end of the container.
DataVector::auxbase
const SG::AuxVectorBase & auxbase() const
Convert to AuxVectorBase.
DataVector< T, DataModel_detail::NoBase >::Deleter::doDelete
virtual void doDelete(value_type p)=0
DataVector::DataVector
DataVector(size_type n, SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
Sized constructor.
SG::OwnershipPolicy
OwnershipPolicy
describes the possible element ownership policies (see e.g. DataVector)
Definition: OwnershipPolicy.h:16
DVL_iter_swap.h
Specializations of iter_swap for DataVector/DataList.
DataVector::const_value_type
const T * const_value_type
Definition: DataVector.h:821
DataVector::assign
void assign(InputIterator first, InputIterator last)
Assign from iterators.
DataVector::has_virtual
static const bool has_virtual
This is true for any DataVector class if we need to use virtual derivation to get to the base DataVec...
Definition: DataVector.h:802
DataVector::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Standard reverse_iterator.
Definition: DataVector.h:852
test2_assignelement1
void test2_assignelement1()
DataVector::base_value_type
T base_value_type
The T value used as the template parameter.
Definition: DataVector.h:825
DataVector< T, DataModel_detail::NoBase >::DataVector
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
Default constructor.
DataVector::baseOffset
static int baseOffset(const std::type_info &ti)
Return the offset of a base DataVector class.
SG::TopBase
Calculate topmost base accessible via SG_BASES.
Definition: TopBase.h:38
DataVector.icc
DataVector::test2_assignelement1
friend void test2_assignelement1()
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
DataVector< T, DataModel_detail::NoBase >::base_data_vector
DataVector base_data_vector
Definition: DataVector.h:2146
DataVector< T, DataModel_detail::NoBase >::Deleter::value_type
DataVector::value_type value_type
Definition: DataVector.h:2155
DataVector::reference
T *& reference
Definition: DataVector.h:812
DataVector< T, DataModel_detail::NoBase >::DataVector
DataVector(InputIterator first, InputIterator last, SG::OwnershipPolicy ownPolicy=SG::VIEW_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES, SG::IAuxStore *store=0)
Constructor from iterators.
DataModel_detail::NoBase
Marker for the base of the inheritance hierarchy.
Definition: DVLNoBase.h:32
ClassName< DataVector< T > >::name
static std::string name()
SG::TopBase< DataVector< T, DataModel_detail::NoBase > >::type
DataVector< T, DataModel_detail::NoBase > type
Definition: DataVector.h:3542
DataVector_detail::enable_if_ptr_itr
std::enable_if_t< std::is_convertible_v< typename std::iterator_traits< ITERATOR >::value_type, T * >, bool > enable_if_ptr_itr
Helpers for enabling the correct overloads for insert() methods taking a range, allowing us to handle...
Definition: DataVector.h:614
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
BaseInfo.h
Provide an interface for finding inheritance information at run time.
TopBase.h
Calculate topmost accessible base accessible via SG_BASES.
ROOT::Meta::Selection::DataVector::m_ownPolicy
ROOT::Meta::Selection::MemberAttributes< kTransient > m_ownPolicy
We do not want to save this.
Definition: DataVector.h:3481
beamspotman.n
n
Definition: beamspotman.py:727
ClassName
An interface for getting the name of a class as a string.
Definition: AthenaKernel/AthenaKernel/ClassName.h:31
DataVector< T, DataModel_detail::NoBase >::DVL_BASE
DataModel_detail::NoBase DVL_BASE
Definition: DataVector.h:2085
DataVector< T, DataModel_detail::NoBase >
Base specialization for DataVector<T>.
Definition: DataVector.h:2082
CxxUtils
Definition: aligned_vector.h:29
DataBucketTraitFwd.h
SG::Bases
Traits class to hold derivation information.
Definition: Bases.h:115
DVLNoBase.h
Marker for the base of the inheritance hierarchy.
DataVector::front
const T * front() const
Access the first element in the collection as an rvalue.
SG::NoBase
Marker to indicate a nonexistent base class.
Definition: Bases.h:68
DataVector::swap
void swap(DataVector &rhs)
Swap this collection with another.
DataVector< T, DataModel_detail::NoBase >::Deleter::doDelete
virtual void doDelete(typename PtrVector::iterator first, typename PtrVector::iterator last)=0
DataVector::assign
void assign(std::initializer_list< value_type > l)
DataVector::const_pointer
T *const * const_pointer
Definition: DataVector.h:819
DataVector::insert
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
ROOT::Meta::Selection::DataVector::m_deleter
ROOT::Meta::Selection::MemberAttributes< kTransient > m_deleter
Definition: DataVector.h:3477
DataVector::m_isMostDerived
SG::IsMostDerivedFlag m_isMostDerived
This flag is true if this DV instance is the most-derived one.
Definition: DataVector.h:2059
DataVector::allocator_type
BASE::allocator_type allocator_type
Definition: DataVector.h:817
DataVector::assignElement
void assignElement(typename BaseContainer::iterator pos, std::unique_ptr< base_value_type > newElem)
Handle element assignment.
DataVector< T, DataModel_detail::NoBase >::DataVector
DataVector(size_type n, SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
Sized constructor.
DataVector::crend
const_reverse_iterator crend() const noexcept
Return a const_reverse_iterator pointing at the beginning of the collection.
DataVector< T, DataModel_detail::NoBase >::difference_type
PtrVector::difference_type difference_type
Definition: DataVector.h:2105
OwnershipPolicy.h
DataVector< T, DataModel_detail::NoBase >::const_reference
T *const & const_reference
Definition: DataVector.h:2103
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:795
DataVector< T, DataModel_detail::NoBase >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition: DataVector.h:2128
DataVector::rbegin
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
DataVector::insertMove
void insertMove(iterator position, DataVector &other)
Insert the contents of another DataVector, with auxiliary data copied via move semantics.
DataVector::clear
void clear()
Erase all the elements in the collection.
DataVector::DataVector
DataVector(DataVector &&rhs) noexcept
Move constructor.
DataVector::capacity
size_type capacity() const noexcept
Returns the total number of elements that the collection can hold before needing to allocate more mem...
DataVector< T, DataModel_detail::NoBase >::DataVector
DataVector(const DataVector &rhs)
Copy constructor.
DataModel_detail
Definition: CompareAndPrint.h:15
DataVector::unique_type
std::unique_ptr< base_value_type > unique_type
Type of a unique_ptr that can be used to insert elements into this container.
Definition: DataVector.h:829
DataVector_detail
Definition: DataVector.h:586
ClassName.h
DataVector::testInsertOol
void testInsertOol(const char *op)
Test if we can insert; raise an exception if not.
DataVector_detail::VirtBases
Definition: DataVector.h:607
DataVector::base_data_vector
DataVector base_data_vector
Definition: DataVector.h:854
DataVector::resize
void resize(size_type sz)
Resizes the collection to the specified number of elements.
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
protected
#define protected
Definition: GenEventCnv_p1.h:26
DataVector::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Standard const_reverse_iterator.
Definition: DataVector.h:847
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
DataVector::BaseContainer
BASE::PtrVector BaseContainer
Definition: DataVector.h:807
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::do_cast
static const T * do_cast(const typename PtrVector::value_type p)
Helper to shorten calls to DataModel_detail::DVLCast.
DataVector< T, DataModel_detail::NoBase >::DataVector
DataVector(std::initializer_list< value_type > l, SG::OwnershipPolicy ownPolicy=SG::VIEW_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES, SG::IAuxStore *store=0)
Constructor from iterators.
CxxUtils::detail::AllocationFunction
concept AllocationFunction
Definition: concepts.h:87
DataVector< T, DataModel_detail::NoBase >::BaseContainer
std::vector< T * > BaseContainer
Definition: DataVector.h:2093
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:193
DataVector::DataVector
DataVector(InputIterator first, InputIterator last, SG::OwnershipPolicy ownPolicy=SG::VIEW_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES, SG::IAuxStore *store=0)
Constructor from iterators.
DataVector< T, DataModel_detail::NoBase >::size_type
PtrVector::size_type size_type
Definition: DataVector.h:2104
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
DataVector< T, DataModel_detail::NoBase >::ElementProxy
DataModel_detail::ElementProxy< DataVector > ElementProxy
This type is used to proxy lvalue accesses to DataVector elements, in order to handle ownership.
Definition: DataVector.h:2123
DataVector< T, DataModel_detail::NoBase >::assign
void assign(InputIterator first, InputIterator last)
Assign from iterators.
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
DataVector< T, DataModel_detail::NoBase >::PtrVector
std::vector< T * > PtrVector
This is the type of the underlying std::vector (what stdcont returns).
Definition: DataVector.h:2092
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::stdcont
const PtrVector & stdcont() const
Return the underlying std::vector of the container.
DataVector::sort
void sort()
Sort the container.
concepts.h
A couple standard-library related concepts.
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
DataVector_detail::enable_if_up_itr
std::enable_if_t< std::is_convertible_v< typename std::iterator_traits< ITERATOR >::value_type, std::unique_ptr< T > >, bool > enable_if_up_itr
Definition: DataVector.h:618
SG::DVLDataBucket
A DataBucket specialized for DataVector/DataList.
Definition: DVLDataBucket.h:49
DataVector< T, DataModel_detail::NoBase >::assign
void assign(std::initializer_list< value_type > l)
Assign from an initializer list.
DataVector::setMostDerived
virtual void setMostDerived() override
Set m_isMostDerived for this instance and clear it for all bases.
DataVector::clearMostDerived
void clearMostDerived()
Clear m_isMostDerived for this instance and for all bases.
DataVector< T, DataModel_detail::NoBase >::allocator_type
PtrVector::allocator_type allocator_type
Definition: DataVector.h:2107
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
DataVector< T, DataModel_detail::NoBase >::base_value_type
T base_value_type
The T value used as the template parameter.
Definition: DataVector.h:2115
DataVector::pop_back
void pop_back()
Remove the last element from the collection.
DataVector::dvlinfo
static const DataModel_detail::DVLInfoBase & dvlinfo()
Return the DV/DL info struct for this class.
DVLIterator.h
DeMoScan.first
bool first
Definition: DeMoScan.py:534
F
#define F(x, y, z)
Definition: MD5.cxx:112
DataVector< T, DataModel_detail::NoBase >::Deleter::~Deleter
virtual ~Deleter()=default
DataVector< TrigL2Bphys >::Deleter
typename BASE::Deleter Deleter
Definition: DataVector.h:857
DataVector::ElementProxy
DataModel_detail::ElementProxy< DataVector > ElementProxy
This type is used to proxy lvalue accesses to DataVector elements, in order to handle ownership.
Definition: DataVector.h:833
DataVector< T, DataModel_detail::NoBase >::const_pointer
T *const * const_pointer
Definition: DataVector.h:2109
DataVector::must_own
static constexpr bool must_own
If true, then this type must own its contents.
Definition: DataVector.h:860
DVL_algorithms.h
Specializations of STL algorithms to work with DataVector/List.
DataVector::pointer
T ** pointer
Definition: DataVector.h:818
DataVector::ownPolicy
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
private
#define private
Definition: xAODTruthCnvAlg.h:20
DataVector::resortAux
void resortAux(iterator beg, iterator end)
Reset indices / reorder aux data after elements have been permuted.
DataVector< T, DataModel_detail::NoBase >::~DataVector
virtual ~DataVector()
Destructor.
DataVector::cbegin
const_iterator cbegin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::difference_type
BASE::difference_type difference_type
Definition: DataVector.h:815
DataVector::DataVector
DataVector(std::initializer_list< value_type > l, SG::OwnershipPolicy ownPolicy=SG::VIEW_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES, SG::IAuxStore *store=0)
Constructor from an initializer list.
DataVector::emplace
iterator emplace(iterator position, value_type pElem)
Add a new element to the collection.
DataVector::baseOffset1
static int baseOffset1(const char *p, const DataVector &dv, const std::type_info &ti)
Helper for baseOffset.
DataVector::iter_swap
static void iter_swap(iterator a, iterator b)
Swap the referents of two DataVector iterators.
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
DataVector::test2_assignelement2
friend void test2_assignelement2()
DataModel_detail::ElementProxy
Proxy for lvalue access to DataVector/DataList elements.
Definition: ElementProxy.h:53
DataVector::max_size
size_type max_size() const noexcept
Returns the size() of the largest possible collection.
DataVector::size_type
BASE::size_type size_type
Definition: DataVector.h:814
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
DataVector< T, DataModel_detail::NoBase >::DataVector_BASE
DataModel_detail::NoBase DataVector_BASE
Definition: DataVector.h:2084
ROOT::Meta::Selection::DataVector
Definition: DataVector.h:582
SG::DataBucketTrait
Metafunction to find the proper DataBucket class for T.
Definition: DataBucketTraitFwd.h:28
IsMostDerivedFlag.h
Holder for the is-most-derived flag.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector< T, DataModel_detail::NoBase >::value_type
T * value_type
Definition: DataVector.h:2106
DataVector::value_type
T * value_type
Definition: DataVector.h:816
ROOT
Selection rules: declare transient members.
Definition: DataVector.h:581
DataVector< T, DataModel_detail::NoBase >::isSequence
std::true_type isSequence
Mark as a sequence, for DataLink / ElementLink.
Definition: DataVector.h:2088
SG::IndexTrackingPolicy
IndexTrackingPolicy
Definition: IndexTrackingPolicy.h:37
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
DVLCast.h
casting operations for DataVector/DataList.
DataVector::test2_assignelement1a
friend void test2_assignelement1a()
DataVector< T, DataModel_detail::NoBase >::const_value_type
const T * const_value_type
Definition: DataVector.h:2111
DataVectorBase::Base
DataModel_detail::NoBase Base
Definition: DataVector.h:636
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
DataVector::assignElement
void assignElement(typename BaseContainer::iterator pos, value_type newElem)
Handle element assignment.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
ElementProxy.h
Proxy for lvalue access to DataVector/DataList elements.
DataVector::shrink_to_fit
void shrink_to_fit()
DataVector::crbegin
const_reverse_iterator crbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
DataVector::DataVector_BASE
BASE DataVector_BASE
Definition: DataVector.h:797
SG::BaseList
Represent a list of base classes.
Definition: Bases.h:79