00001
00002
00003
00496 #ifndef ATHCONTAINERS_DATAVECTOR_H
00497 #define ATHCONTAINERS_DATAVECTOR_H
00498
00499
00500
00501 #define HAVE_CONSTDATAVECTOR
00502
00503
00504 #include "AthContainers/exceptions.h"
00505 #include "AthContainers/OwnershipPolicy.h"
00506 #include "AthContainers/IndexTrackingPolicy.h"
00507 #include "AthContainers/AuxVectorBase.h"
00508 #include "AthContainers/tools/DVLNoBase.h"
00509 #include "AthContainers/tools/DVLInfo.h"
00510 #include "AthContainers/tools/DVLCast.h"
00511 #include "AthContainers/tools/DVLIterator.h"
00512 #include "AthContainers/tools/DVL_iter_swap.h"
00513 #include "AthContainers/tools/DVL_algorithms.h"
00514 #include "AthContainers/tools/ElementProxy.h"
00515 #include "AthContainers/tools/IsMostDerivedFlag.h"
00516 #include "AthLinks/tools/selection_ns.h"
00517 #include <boost/static_assert.hpp>
00518 #include <boost/type_traits.hpp>
00519 #include <boost/iterator/iterator_adaptor.hpp>
00520 #include <vector>
00521 #include <typeinfo>
00522 #include <functional>
00523 #include <iostream>
00524 #include <algorithm>
00525 #include <stdexcept>
00526 #include <iterator>
00527 #if __cplusplus > 201100
00528 #include <initializer_list>
00529 #endif
00530
00531
00532
00533 #ifdef XAOD_STANDALONE
00534 # ifndef SG_BASE
00535 # define SG_BASE(A, B) class ATHCONTAINERS_DUMMY
00536 # endif // not SG_BASE
00537 # ifndef SG_BASES1
00538 # define SG_BASES1(A, B) class ATHCONTAINERS_DUMMY
00539 # endif // not SG_BASES1
00540 # ifndef SG_BASES2
00541 # define SG_BASES2(A, B, C) class ATHCONTAINERS_DUMMY
00542 # endif // not SG_BASES2
00543 # ifndef SG_BASES3
00544 # define SG_BASES3(A, B, C, D) class ATHCONTAINERS_DUMMY
00545 # endif // not SG_BASES3
00546 # ifndef SG_VIRTUAL
00547 # define SG_VIRTUAL(X) X
00548 # endif // not SG_VIRTUAL
00549 #else
00550 # include "SGTools/BaseInfo.h"
00551 #endif
00552
00553
00554
00555 ENTER_ROOT_SELECTION_NS
00556 template <class T, class BASE> class DataVector;
00557 EXIT_ROOT_SELECTION_NS
00558
00559
00560 namespace DataVector_detail {
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579 template <class B1,
00580 class B2=DataModel_detail::NoBase,
00581 class B3=DataModel_detail::NoBase> struct VirtBases;
00582
00583
00584 }
00585
00586
00587
00596 template <class T>
00597 struct DataVectorBase
00598 {
00599 typedef DataModel_detail::NoBase Base;
00600 };
00601
00602
00612 #define DATAVECTOR_BASE(T, BASE) \
00613 DATAVECTOR_BASE_FWD(T, BASE); \
00614 template struct DataVector_detail::DVLEltBaseInit<T>
00615
00616
00621 #define DATAVECTOR_BASE_FWD(T, BASE) \
00622 template <> struct DataVectorBase<T> \
00623 { typedef DataVector<BASE> Base; }; \
00624 SG_BASE(DataVector<T>, DataVector<BASE>)
00625
00626
00636 #define DATAVECTOR_VIRTBASES1(T, B1) \
00637 DATAVECTOR_VIRTBASES1_FWD(T, B1); \
00638 template struct DataVector_detail::DVLEltBaseInit<T>
00639
00640
00641
00646 #define DATAVECTOR_VIRTBASES1_FWD(T, B1) \
00647 template <> struct DataVectorBase<T> \
00648 { typedef DataVector_detail::VirtBases<B1> Base; }; \
00649 SG_BASES1(DataVector<T>, SG_VIRTUAL(DataVector<B1>))
00650
00651
00652
00662 #define DATAVECTOR_VIRTBASES2(T, B1, B2) \
00663 DATAVECTOR_VIRTBASES2_FWD(T, B1, B2); \
00664 template struct DataVector_detail::DVLEltBaseInit<T>
00665
00666
00671 #define DATAVECTOR_VIRTBASES2_FWD(T, B1, B2) \
00672 template <> struct DataVectorBase<T> \
00673 { typedef DataVector_detail::VirtBases<B1, B2> Base; }; \
00674 SG_BASES2(DataVector<T>, SG_VIRTUAL(DataVector<B1>), \
00675 SG_VIRTUAL(DataVector<B2>))
00676
00677
00687 #define DATAVECTOR_VIRTBASES3(T, B1, B2, B3) \
00688 DATAVECTOR_VIRTBASES3_FWD(T, B1, B2, B3); \
00689 template struct DataVector_detail::DVLEltBaseInit<T>
00690
00691
00696 #define DATAVECTOR_VIRTBASES3_FWD(T, B1, B2, B3) \
00697 template <> struct DataVectorBase<T> \
00698 { typedef DataVector_detail::VirtBases<B1, B2, B3> Base; }; \
00699 SG_BASES3(DataVector<T>, SG_VIRTUAL(DataVector<B1>), \
00700 SG_VIRTUAL(DataVector<B2>), \
00701 SG_VIRTUAL(DataVector<B3>))
00702
00703
00704 template <class DV> class ConstDataVector;
00705 template <class DV> void test2_assignelement1();
00706 template <class DV> void test2_assignelement2();
00707
00708
00718 template <class T, class BASE = typename DataVectorBase<T>::Base>
00719 class DataVector : public BASE
00720 {
00721 public:
00722 typedef BASE DataVector_BASE;
00723 typedef BASE DVL_BASE;
00724
00727 static const bool has_virtual = BASE::has_virtual;
00728
00731 typedef typename BASE::PtrVector PtrVector;
00732 typedef typename BASE::PtrVector BaseContainer;
00733
00734
00735 public:
00736
00737 typedef T*& reference;
00738 typedef T* const & const_reference;
00739 typedef typename BASE::size_type size_type;
00740 typedef typename BASE::difference_type difference_type;
00741 typedef T* value_type;
00742 typedef typename BASE::allocator_type allocator_type;
00743 typedef T** pointer;
00744 typedef T* const * const_pointer;
00745
00746 typedef const T* const_value_type;
00747
00750 typedef T base_value_type;
00751
00754 typedef DataModel_detail::ElementProxy<DataVector> ElementProxy;
00755
00756
00758 typedef typename DataModel_detail::const_iterator<DataVector>
00759 const_iterator;
00760
00763 typedef typename DataModel_detail::iterator<DataVector> iterator;
00764
00765
00767 typedef typename std::reverse_iterator<const_iterator>
00768 const_reverse_iterator;
00769
00772 typedef typename std::reverse_iterator<iterator>
00773 reverse_iterator;
00774
00775
00776
00779
00780
00789 explicit DataVector(SG::OwnershipPolicy ownPolicy = SG::OWN_ELEMENTS,
00790 SG::IndexTrackingPolicy trackIndices =
00791 SG::DEFAULT_TRACK_INDICES);
00792
00793
00806 explicit DataVector(size_type n,
00807 SG::OwnershipPolicy ownPolicy = SG::OWN_ELEMENTS,
00808 SG::IndexTrackingPolicy trackIndices =
00809 SG::DEFAULT_TRACK_INDICES);
00810
00811
00818
00819
00820
00821
00822
00823
00824
00825 #if __cplusplus > 201100
00826
00827
00828 DataVector (const DataVector&) = default;
00829 #endif
00830
00831
00832 #if __cplusplus > 201100
00833
00839 DataVector (DataVector&& rhs);
00840 #endif
00841
00842
00855 template <class InputIterator>
00856 DataVector(InputIterator first,
00857 InputIterator last,
00858 SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS,
00859 SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES,
00860 SG::IAuxStore* store = 0);
00861
00862
00863 #if __cplusplus > 201100
00864
00875 DataVector(std::initializer_list<value_type> l,
00876 SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS,
00877 SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES,
00878 SG::IAuxStore* store = 0);
00879 #endif
00880
00881
00894 DataVector& operator= (const DataVector& rhs);
00895
00896
00897 #if __cplusplus > 201100
00898
00904 DataVector& operator= (DataVector&& rhs);
00905
00906
00917 DataVector& operator= (std::initializer_list<value_type> l);
00918 #endif
00919
00920
00930 template <class InputIterator>
00931 void assign(InputIterator first, InputIterator last);
00932
00933
00934 #if __cplusplus > 201100
00935
00943 void assign(std::initializer_list<value_type> l);
00944 #endif
00945
00946
00947
00948
00949
00951
00954
00955
00963 size_type size() const;
00964
00965
00970
00971
00972
00984 void resize(size_type sz);
00985
00986
00992
00993
00994
00999
01000
01001
01008 void reserve (size_type n);
01009
01010
01016
01017
01018
01020
01023
01024
01033 const T* operator[] (size_type n) const;
01034
01035
01044 const T* get (size_type n) const;
01045
01046
01056 ElementProxy operator[] (size_type n);
01057
01058
01067 const T* at (size_type n) const;
01068
01069
01079 ElementProxy at (size_type n);
01080
01081
01089 const T* front() const;
01090
01091
01099 const T* back() const;
01100
01101
01110 ElementProxy front ();
01111
01112
01121 ElementProxy back ();
01122
01123
01125
01128
01129
01138 const_iterator begin() const;
01139
01140
01149 const_iterator end() const;
01150
01151
01161 iterator begin();
01162
01163
01173 iterator end();
01174
01175
01184 const_reverse_iterator rbegin() const;
01185
01186
01195 const_reverse_iterator rend() const;
01196
01197
01207 reverse_iterator rbegin();
01208
01209
01219 reverse_iterator rend();
01220
01221
01230 const_iterator cbegin() const;
01231
01232
01241 const_iterator cend() const;
01242
01243
01252 const_reverse_iterator crbegin() const;
01253
01254
01263 const_reverse_iterator crend() const;
01264
01265
01267
01270
01271
01282 void push_back(value_type pElem);
01283
01284
01285 #if __cplusplus > 201100
01286 #ifndef __REFLEX__
01287
01296 void push_back(std::unique_ptr<base_value_type> pElem);
01297 #endif
01298 #endif
01299
01300
01314 void emplace_back(value_type pElem);
01315
01316
01329 iterator insert(iterator position, value_type pElem);
01330
01331
01332 #if __cplusplus > 201100
01333 #ifndef __REFLEX__
01334
01345 iterator insert(iterator position, std::unique_ptr<base_value_type> pElem);
01346 #endif
01347 #endif
01348
01349
01365 iterator emplace(iterator position, value_type pElem);
01366
01367
01380 template <class InputIterator>
01381 void insert(iterator position, InputIterator first, InputIterator last);
01382
01383
01384 #if __cplusplus > 201100
01385
01396 void insert(iterator position, std::initializer_list<value_type> l);
01397 #endif
01398
01399
01401
01404
01405
01414 iterator erase(iterator position);
01415
01416
01428 iterator erase(iterator first, iterator last);
01429
01430
01438 void pop_back();
01439
01440
01449 void clear();
01450
01451
01453
01456
01457
01468 void swap(DataVector& rhs);
01469
01470
01476 static void iter_swap (iterator a, iterator b);
01477
01478
01484 void sort();
01485
01486
01491 template <class COMPARE>
01492 void sort(COMPARE comp);
01493
01494
01495
01497
01500
01501
01519 void swapElement(size_type index, value_type newElem, reference oldElem);
01520
01521
01539 void swapElement(iterator pos, value_type newElem, reference oldElem);
01540
01541
01542 #if __cplusplus > 201100
01543 #ifndef __REFLEX__
01544
01563 void swapElement(size_type index,
01564 std::unique_ptr<base_value_type> newElem,
01565 std::unique_ptr<base_value_type>& oldElem);
01566
01567
01587 void swapElement(iterator pos,
01588 std::unique_ptr<base_value_type> newElem,
01589 std::unique_ptr<base_value_type>& oldElem);
01590 #endif
01591 #endif
01592
01593
01594 public:
01603
01604
01605
01610
01611
01612
01623 void clear (SG::OwnershipPolicy ownPolicy);
01624
01625
01637 void clear (SG::OwnershipPolicy ownPolicy,
01638 SG::IndexTrackingPolicy trackIndices);
01639
01640
01646 static const DataModel_detail::DVLInfoBase& dvlinfo();
01647
01648
01654 virtual const DataModel_detail::DVLInfoBase& dvlinfo_v() const;
01655
01656
01668 static
01669 int baseOffset (const std::type_info& ti);
01670
01671
01682 const SG::AuxVectorBase& auxbase() const;
01683
01684
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696 #ifndef __cplusplus
01697 size_type max_size() const;
01698 void resize(size_type sz);
01699 size_type capacity() const;
01700 bool empty() const;
01701 void shrink_to_fit();
01702 void pop_back();
01703 void clear();
01704 const PtrVector& stdcont() const;
01705 SG::OwnershipPolicy ownPolicy() const;
01706 void clear (SG::OwnershipPolicy ownPolicy,
01707 SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES);
01708 #endif // not __cplusplus
01709
01710
01713
01714
01725 static
01726 int baseOffset1 (const char* p, const DataVector& dv,
01727 const std::type_info& ti);
01728
01729
01740 void resortAux (iterator beg, iterator end);
01741
01742
01753 void testInsert (const char* op);
01754
01755
01766 void testInsertOol (const char* op);
01767
01768
01769 private:
01770 friend class DataModel_detail::ElementProxy<DataVector>;
01771 friend class ConstDataVector<DataVector>;
01772 friend void test2_assignelement1<DataVector>();
01773 friend void test2_assignelement2<DataVector>();
01774
01775
01784 void assignElement (typename BaseContainer::iterator pos, value_type newElem);
01785
01786
01787 #if __cplusplus > 201100
01788 #ifndef __REFLEX__
01789
01797 void assignElement (typename BaseContainer::iterator pos,
01798 std::unique_ptr<base_value_type> newElem);
01799 #endif
01800 #endif
01801
01802
01811 void assignBaseElement (typename BaseContainer::iterator pos,
01812 typename BaseContainer::value_type newElem);
01813
01814
01838 void shift (size_t pos, ptrdiff_t offs);
01839
01840
01841 public:
01842
01851 static
01852 const T* do_cast (const typename PtrVector::value_type p);
01853
01854
01855 private:
01866 virtual const std::type_info& dv_typeid() const;
01867
01868
01869 protected:
01875 void clearMostDerived();
01876
01877
01885 virtual void setMostDerived();
01886
01887
01888 private:
01890
01891
01895 SG::IsMostDerivedFlag m_isMostDerived;
01896
01897
01899 static DataModel_detail::DVLInfo<DataVector<T> > s_info;
01900
01901
01902 typedef typename
01903 ROOT_SELECTION_NS::DataVector<T, DataVector_BASE>::self self;
01904 };
01905
01906
01907 template <class T, class BASE>
01908 const bool DataVector<T, BASE>::has_virtual;
01909
01919 template <class T>
01920 class DataVector<T, DataModel_detail::NoBase>
01921 : public SG::AuxVectorBase
01922 {
01923 public:
01924 typedef DataModel_detail::NoBase DataVector_BASE;
01925 typedef DataModel_detail::NoBase DVL_BASE;
01926
01928 typedef boost::true_type isSequence;
01929
01932 typedef std::vector<T*> PtrVector;
01933 typedef std::vector<T*> BaseContainer;
01934
01939 static const bool has_virtual = false;
01940
01941
01942 typedef T*& reference;
01943 typedef T* const & const_reference;
01944 typedef typename PtrVector::size_type size_type;
01945 typedef typename PtrVector::difference_type difference_type;
01946 typedef T* value_type;
01947 typedef typename PtrVector::allocator_type allocator_type;
01948 typedef T** pointer;
01949 typedef T* const * const_pointer;
01950
01951 typedef const T* const_value_type;
01952
01955 typedef T base_value_type;
01956
01959 typedef DataModel_detail::ElementProxy<DataVector> ElementProxy;
01960
01961
01963
01964 typedef typename PtrVector::const_iterator const_iterator;
01965
01968 typedef typename DataModel_detail::iterator<DataVector> iterator;
01969
01971
01972
01973
01974 typedef typename std::reverse_iterator<const_iterator>
01975 const_reverse_iterator;
01976
01979 typedef typename std::reverse_iterator<iterator>
01980 reverse_iterator;
01981
01982
01983
01986
01987
01996 explicit DataVector(SG::OwnershipPolicy ownPolicy = SG::OWN_ELEMENTS,
01997 SG::IndexTrackingPolicy trackIndices =
01998 SG::DEFAULT_TRACK_INDICES);
01999
02000
02013 explicit DataVector
02014 (size_type n,
02015 SG::OwnershipPolicy ownPolicy = SG::OWN_ELEMENTS,
02016 SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES);
02017
02018
02025 DataVector(const DataVector& rhs);
02026
02027
02028 #if __cplusplus > 201100
02029
02035 DataVector(DataVector&& rhs);
02036 #endif
02037
02038
02051 template <class InputIterator>
02052 DataVector(InputIterator first, InputIterator last,
02053 SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS,
02054 SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES,
02055 SG::IAuxStore* store = 0);
02056
02057
02058 #if __cplusplus > 201100
02059
02070 DataVector(std::initializer_list<value_type> l,
02071 SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS,
02072 SG::IndexTrackingPolicy trackIndices = SG::DEFAULT_TRACK_INDICES,
02073 SG::IAuxStore* store = 0);
02074 #endif
02075
02076
02089 DataVector& operator= (const DataVector& rhs);
02090
02091
02092 #if __cplusplus > 201100
02093
02099 DataVector& operator= (DataVector&& rhs);
02100
02101
02112 DataVector& operator= (std::initializer_list<value_type> l);
02113 #endif
02114
02115
02125 template <class InputIterator>
02126 void assign(InputIterator first, InputIterator last);
02127
02128
02129 #if __cplusplus > 201100
02130
02138 void assign(std::initializer_list<value_type> l);
02139 #endif
02140
02141
02151 virtual ~DataVector();
02152
02153
02155
02158
02159
02163 size_type size() const;
02164
02165
02172 virtual size_type size_v() const;
02173
02174
02178 size_type max_size() const;
02179
02180
02191 void resize(size_type sz);
02192
02193
02198 size_type capacity() const;
02199
02200
02208 virtual size_type capacity_v() const;
02209
02210
02214 bool empty() const;
02215
02216
02222 void reserve (size_type n);
02223
02224
02225 #if __cplusplus > 201100
02226
02231 void shrink_to_fit();
02232 #endif
02233
02234
02236
02239
02240
02249 const T* operator[] (size_type n) const;
02250
02251
02260 const T* get (size_type n) const;
02261
02262
02272 ElementProxy operator[] (size_type n);
02273
02274
02283 const T* at (size_type n) const;
02284
02285
02295 ElementProxy at (size_type n);
02296
02297
02305 const T* front() const;
02306
02307
02315 const T* back() const;
02316
02317
02326 ElementProxy front ();
02327
02328
02337 ElementProxy back ();
02338
02339
02341
02344
02345
02354 const_iterator begin() const;
02355
02356
02365 const_iterator end() const;
02366
02367
02377 iterator begin();
02378
02379
02389 iterator end();
02390
02391
02400 const_reverse_iterator rbegin() const;
02401
02402
02411 const_reverse_iterator rend() const;
02412
02413
02423 reverse_iterator rbegin();
02424
02425
02435 reverse_iterator rend();
02436
02445 const_iterator cbegin() const;
02446
02447
02456 const_iterator cend() const;
02457
02458
02467 const_reverse_iterator crbegin() const;
02468
02469
02478 const_reverse_iterator crend() const;
02479
02480
02482
02485
02486
02497 void push_back(value_type pElem);
02498
02499
02500 #if __cplusplus > 201100
02501 #ifndef __REFLEX__
02502
02511 void push_back(std::unique_ptr<base_value_type> pElem);
02512 #endif
02513 #endif
02514
02515
02529 void emplace_back(value_type pElem);
02530
02531
02544 iterator insert(iterator position, value_type pElem);
02545
02546
02547 #if __cplusplus > 201100
02548 #ifndef __REFLEX__
02549
02560 iterator insert(iterator position, std::unique_ptr<base_value_type> pElem);
02561 #endif
02562 #endif
02563
02564
02580 iterator emplace(iterator position, value_type pElem);
02581
02582
02595 template <class InputIterator>
02596 void insert(iterator position, InputIterator first, InputIterator last);
02597
02598
02599 #if __cplusplus > 201100
02600
02611 void insert(iterator position, std::initializer_list<value_type> l);
02612 #endif
02613
02614
02616
02619
02620
02629 iterator erase(iterator position);
02630
02631
02643 iterator erase(iterator first, iterator last);
02644
02645
02652 void pop_back();
02653
02654
02662 void clear();
02663
02664
02666
02669
02670
02681 void swap(DataVector& rhs);
02682
02683
02689 static void iter_swap (iterator a, iterator b);
02690
02691
02697 void sort();
02698
02699
02705 template <class COMPARE>
02706 void sort(COMPARE comp);
02707
02708
02710
02713
02714
02732 void swapElement(size_type index, value_type newElem, reference oldElem);
02733
02734
02752 void swapElement(iterator pos, value_type newElem, reference oldElem);
02753
02754
02755 #if __cplusplus > 201100
02756 #ifndef __REFLEX__
02757
02776 void swapElement(size_type index,
02777 std::unique_ptr<base_value_type> newElem,
02778 std::unique_ptr<base_value_type>& oldElem);
02779
02780
02799 void swapElement(iterator pos,
02800 std::unique_ptr<base_value_type> newElem,
02801 std::unique_ptr<base_value_type>& oldElem);
02802 #endif
02803 #endif
02804
02805
02806 public:
02814 const PtrVector& stdcont() const;
02815
02816
02820 SG::OwnershipPolicy ownPolicy() const;
02821
02822
02832 void clear (SG::OwnershipPolicy ownPolicy);
02833
02834
02845 void clear (SG::OwnershipPolicy ownPolicy,
02846 SG::IndexTrackingPolicy trackIndices);
02847
02848
02854 static const DataModel_detail::DVLInfoBase& dvlinfo();
02855
02856
02862 virtual const DataModel_detail::DVLInfoBase& dvlinfo_v() const;
02863
02864
02876 static
02877 int baseOffset (const std::type_info& ti);
02878
02879
02886 const SG::AuxVectorBase& auxbase() const;
02887
02888
02890
02893
02894
02905 static
02906 int baseOffset1 (const char* p, const DataVector& dv,
02907 const std::type_info& ti);
02908
02909
02920 void resortAux (iterator beg, iterator end);
02921
02922
02933 void testInsert (const char* op);
02934
02935
02946 void testInsertOol (const char* op);
02947
02948
02949 private:
02950 friend class DataModel_detail::ElementProxy<DataVector>;
02951 friend class ConstDataVector<DataVector>;
02952 friend void test2_assignelement1<DataVector>();
02953 friend void test2_assignelement2<DataVector>();
02954
02955
02964 void assignElement (typename BaseContainer::iterator pos, value_type newElem);
02965
02966
02967 #if __cplusplus > 201100
02968 #ifndef __REFLEX__
02969
02977 void assignElement (typename BaseContainer::iterator pos,
02978 std::unique_ptr<base_value_type> newElem);
02979 #endif
02980 #endif
02981
02982
02991 void assignBaseElement (typename BaseContainer::iterator pos,
02992 typename BaseContainer::value_type newElem);
02993
02994
03018 void shift (size_t pos, ptrdiff_t offs);
03019
03020
03021 public:
03022
03030 static
03031 const T* do_cast (const typename PtrVector::value_type p);
03032
03033
03034 private:
03045 virtual const std::type_info& dv_typeid() const;
03046
03047
03048 protected:
03058 typename PtrVector::iterator
03059 erase_base(typename PtrVector::iterator position);
03060
03061
03073 typename PtrVector::iterator
03074 erase_base(typename PtrVector::iterator first,
03075 typename PtrVector::iterator last);
03076
03077
03078 protected:
03081 SG::OwnershipPolicy m_ownPolicy;
03082
03084 PtrVector m_pCont;
03085
03086
03092 void clearMostDerived();
03093
03094
03102 virtual void setMostDerived();
03103
03104
03105 private:
03107
03108
03112 SG::IsMostDerivedFlag m_isMostDerived;
03113
03114
03116 static DataModel_detail::DVLInfo<DataVector<T> > s_info;
03117
03118
03119 typedef typename
03120 ROOT_SELECTION_NS::DataVector<T, DataVector_BASE>::self self;
03121 };
03122
03123 template <class T>
03124 const bool DataVector<T, DataModel_detail::NoBase>::has_virtual;
03125
03126
03137 template <class T>
03138 bool operator== (const DataVector<T>& a, const DataVector<T>& b);
03139
03140
03142 template <class T>
03143 bool operator!= (const DataVector<T>& a, const DataVector<T>& b);
03144
03145
03157 template <class T>
03158 bool operator< (const DataVector<T>& a, const DataVector<T>& b);
03159
03160
03162 template <class T>
03163 bool operator> (const DataVector<T>& a, const DataVector<T>& b);
03164
03165
03167 template <class T>
03168 bool operator<= (const DataVector<T>& a, const DataVector<T>& b);
03169
03170
03172 template <class T>
03173 bool operator>= (const DataVector<T>& a, const DataVector<T>& b);
03174
03175
03177 template <class T>
03178 void swap (DataVector<T>& a, DataVector<T>& b);
03179
03180
03181 ENTER_ROOT_SELECTION_NS
03182
03183 #if ROOT_VERSION_CODE < ROOT_VERSION( 5, 99, 0 )
03184
03185 template <class T>
03186 struct SelectVirtBases
03187 {
03188 typedef int type;
03189 };
03190
03191 template <class B1, class B2, class B3>
03192 struct SelectVirtBases<DataVector_detail::VirtBases<B1, B2, B3> >
03193 {
03194 typedef ROOT_SELECTION_NS::AUTOSELECT type;
03195 };
03196
03197 template <class T, class BASE>
03198 class DataVector
03199 {
03200 public:
03201 typedef DataVector<T, BASE> self;
03202
03203 ROOT_SELECTION_NS::TEMPLATE_DEFAULTS<
03204 ROOT_SELECTION_NS::NODEFAULT,
03205 typename ::DataVector<T>::DataVector_BASE> dum1;
03206 ROOT_SELECTION_NS::NO_SELF_AUTOSELECT dum2;
03207 ROOT_SELECTION_NS::AUTOSELECT m_pCont;
03208 ROOT_SELECTION_NS::TRANSIENT m_isMostDerived;
03209 typename SelectVirtBases<BASE>::type __base1;
03210 };
03211
03212 #else
03213
03214 template< class T, class BASE >
03215 class DataVector : KeepFirstTemplateArguments< 1 >
03216
03217 #if ROOT_VERSION_CODE > ROOT_VERSION( 6, 0, 2 )
03218 , SelectNoInstance
03219 #endif // > v6.00/02
03220 {
03221
03222 public:
03224 typedef DataVector< T, BASE > self;
03225 #ifndef XAOD_STANDALONE
03227 //MN: this causes massive dictionary duplication. Disabling for now.
03228
03229 #endif
03231 ROOT_SELECTION_NS::MemberAttributes< kTransient > m_isMostDerived;
03232
03233 };
03234
03235 #endif // ROOT_VERSION
03236
03237 EXIT_ROOT_SELECTION_NS
03238
03239
03240 #include "AthContainers/ClassName.h"
03241
03242
03249 template <class T>
03250 class ClassName<DataVector<T> >
03251 {
03252 public:
03253 static std::string name();
03254 };
03255
03256
03257 #ifndef XAOD_STANDALONE
03258
03259
03260 #include "AthContainers/tools/DVLDataBucket.h"
03261 #include "SGTools/DataBucketTraitFwd.h"
03262
03263
03264 namespace SG {
03265
03266
03273 template <class T, class U>
03274 struct DataBucketTrait<DataVector<T>, U>
03275 {
03276 typedef SG::DVLDataBucket<U> type;
03277 static void init() { DataVector<T>::dvlinfo(); }
03278 };
03279
03280
03281 }
03282
03283
03284 #endif
03285
03286
03287 #include "AthContainers/DataVector.icc"
03288
03289
03290 #if 0
03291
03292
03293
03294
03295
03296
03297 #include "boost/mpl/if.hpp"
03298 #include "boost/mpl/and.hpp"
03299 #include "boost/mpl/equal_to.hpp"
03300 #define if_ boost::mpl::if_
03301 #define and_ boost::mpl::and_
03302 #define equal_to boost::mpl::equal_to
03303 #define true_ boost::mpl::true_
03304 #define false_ boost::mpl::false_
03305 template <class U> struct not_virtual { typedef true_ type; };
03306 template <class U> struct not_virtual<SG::Virtual<U> > { typedef false_ type; };
03307 template <class U> struct clean_type { typedef U type; };
03308 template <> struct clean_type<SG::NoBase>
03309 { typedef DataModel_detail::NoBase type; };
03310 template <class U> struct clean_type<SG::Virtual<U> >
03311 { typedef typename clean_type<U>::type type; };
03312 template <class T>
03313 struct bases_from_sg
03314 {
03315 typedef typename
03316 if_<equal_to<typename SG::Bases<T>::Base1, SG::NoBase>,
03317 DataModel_detail::NoBase,
03318 if_<and_<equal_to<typename SG::Bases<T>::Base1, SG::NoBase>,
03319 not_virtual<typename SG::Bases<T>::Base2> >,
03320 typename SG::Bases<T>::Base1,
03321 DataVector_detail::VirtBases
03322 <clean_type<typename SG::Bases<T>::Base1>,
03323 clean_type<typename SG::Bases<T>::Base2>,
03324 clean_type<typename SG::Bases<T>::Base3> >
03325 > >::type type;
03326 };
03327 #undef if_
03328 #undef and_
03329 #undef equal_to
03330 #undef true_
03331 #undef false_
03332
03333 #define DATAVECTOR_BASES_FROM_SG(T) \
03334 template <> struct DataVectorBase<T> \
03335 { typedef bases_from_sg<T>::type Base; };
03336
03337 #endif
03338
03339
03340 #endif // not ATHCONTAINERS_DATAVECTOR_H