00001
00002
00060 #ifndef ATHCONTAINERS_CONSTDATALIST_H
00061 #define ATHCONTAINERS_CONSTDATALIST_H
00062
00063 #include "AthContainers/DataList.h"
00064 #include "SGTools/ClassID_traits.h"
00065
00066
00070 template <class DL>
00071 class ConstDataList
00072 : private DL
00073 {
00074 public:
00076 typedef typename DL::size_type size_type;
00077 typedef typename DL::difference_type difference_type;
00078 typedef typename DL::allocator_type allocator_type;
00079 typedef typename DL::base_value_type base_value_type;
00080 typedef typename DL::BaseContainer BaseContainer;
00081 typedef typename DL::DVL_BASE DVL_BASE;
00082 typedef typename DL::const_iterator const_iterator;
00083 typedef typename DL::const_reverse_iterator const_reverse_iterator;
00084
00087 typedef typename DL::const_value_type value_type;
00088 typedef typename DL::const_value_type const_value_type;
00089 typedef typename DL::const_value_type & reference;
00090 typedef typename DL::const_value_type const & const_reference;
00091 typedef typename DL::const_value_type * pointer;
00092 typedef typename DL::const_value_type const * const_pointer;
00093
00095 static const bool has_virtual = DL::has_virtual;
00096
00099 typedef DataModel_detail::ElementProxy<ConstDataList> ElementProxy;
00100
00102 typedef typename DataModel_detail::iterator<ConstDataList> iterator;
00103
00106 typedef typename std::reverse_iterator<iterator>
00107 reverse_iterator;
00108
00111 using DL::size;
00112 using DL::max_size;
00113 using DL::resize;
00114 using DL::empty;
00115 using DL::pop_front;
00116 using DL::pop_back;
00117 using DL::clear;
00118 using DL::sort;
00119 using DL::ownPolicy;
00120 using DL::reverse;
00121 using DL::remove_if;
00122 using DL::unique;
00123 using DL::testInsert;
00124
00125
00129 using DL::begin;
00130 using DL::end;
00131 using DL::rbegin;
00132 using DL::rend;
00133 using DL::front;
00134 using DL::back;
00135
00136
00137
00140
00141
00149 explicit ConstDataList(SG::OwnershipPolicy ownPolicy = SG::OWN_ELEMENTS);
00150
00151
00163 explicit ConstDataList(size_type n,
00164 SG::OwnershipPolicy ownPolicy = SG::OWN_ELEMENTS);
00165
00166
00177 template <class InputIterator>
00178 ConstDataList(InputIterator first, InputIterator last,
00179 SG::OwnershipPolicy ownPolicy = SG::VIEW_ELEMENTS);
00180
00181
00194 ConstDataList& operator= (const ConstDataList& rhs);
00195
00196
00206 template <class InputIterator>
00207 void assign(InputIterator first, InputIterator last);
00208
00209
00211
00214
00215
00224 ElementProxy front ();
00225
00226
00235 ElementProxy back ();
00236
00237
00239
00242
00243
00253 iterator begin();
00254
00255
00265 iterator end();
00266
00267
00277 reverse_iterator rbegin();
00278
00279
00289 reverse_iterator rend();
00290
00291
00293
00296
00297
00308 void push_front(value_type pElem);
00309
00310
00321 void push_back(value_type pElem);
00322
00323
00336 iterator insert(iterator position, value_type pElem);
00337
00338
00351 template <class InputIterator>
00352 void insert(iterator position, InputIterator first, InputIterator last);
00353
00354
00356
00359
00360
00369 iterator erase(iterator position);
00370
00371
00383 iterator erase(iterator first, iterator last);
00384
00385
00387
00390
00391
00402 void swap(ConstDataList& rhs);
00403
00404
00410 static void iter_swap (iterator a, iterator b);
00411
00412
00414
00417
00418
00428 void splice( iterator position, ConstDataList& l );
00429
00430
00440 void splice( iterator position, ConstDataList& l, iterator i );
00441
00442
00455 void splice( iterator position, ConstDataList& l,
00456 iterator first,
00457 iterator last );
00458
00459
00467 void remove( const value_type& value );
00468
00469
00479 void merge( ConstDataList& l );
00480
00481
00494 template<typename COMPARE>
00495 void merge( ConstDataList& l, COMPARE predicate );
00496
00497
00499
00502
00503
00504 public:
00522 void swapElement(iterator pos, value_type newElem, reference oldElem);
00523
00524
00528 const DL* asDataList() const;
00529
00530
00538 void resortAux (iterator beg, iterator end);
00539
00540
00542
00545
00546
00558 bool operator< (const ConstDataList& b) const;
00559
00561 bool operator> (const ConstDataList& b) const;
00562
00564 bool operator<= (const ConstDataList& b) const;
00565
00567 bool operator>= (const ConstDataList& b) const;
00568
00579 bool operator== (const ConstDataList& b) const;
00580
00582 bool operator!= (const ConstDataList& b) const;
00583
00584
00585 private:
00587
00590
00591
00592 friend class DataModel_detail::ElementProxy<ConstDataList>;
00593 friend void test2_assignelement1<ConstDataList>();
00594
00595
00603 void assignElement (typename BaseContainer::iterator pos, value_type newElem);
00604
00605
00613 void
00614 assignBaseElement (typename BaseContainer::iterator pos,
00615 typename BaseContainer::value_type newElem);
00616
00617
00623 static
00624 typename DL::iterator to_base_iterator (iterator it);
00625
00626
00632 iterator to_my_iterator (typename DL::iterator it);
00633
00634
00640 ElementProxy to_element_proxy (typename BaseContainer::iterator i);
00641
00642
00644 };
00645
00646
00648 template <class T>
00649 void swap( ConstDataList<T>& a, ConstDataList<T>& b );
00650
00651
00656 template <class DL>
00657 struct ClassID_traits<ConstDataList<DL> >
00658 : public ClassID_traits<DL>
00659 {
00660 public:
00661 BOOST_STATIC_CONSTANT(bool, s_isConst = true);
00662 };
00663
00664
00665 namespace SG {
00666
00667
00677 template <class T>
00678 class DVLConstDataListBucket
00679 : public DVLDataBucket<T>
00680 {
00681 public:
00686 DVLConstDataListBucket (ConstDataList<T>* data);
00687
00688
00689 #if __cplusplus > 201100
00690
00694 DVLConstDataListBucket (std::unique_ptr<ConstDataList<T> > data);
00695 #endif
00696 };
00697
00698
00706 template <class T, class U>
00707 struct DataBucketTrait<ConstDataList<T>, U>
00708 {
00709 typedef SG::DVLConstDataListBucket<T> type;
00710 static void init() { DataList<T>::dvlinfo(); }
00711 };
00712
00713
00718 template <class T>
00719 class BaseInfo<ConstDataList<T> >
00720 : public BaseInfo<T>
00721 {
00722 };
00723
00724
00725 }
00726
00727
00728 #include "AthContainers/ConstDataList.icc"
00729
00730
00731 #endif // not ATHCONTAINERS_CONSTDATALIST_H