thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
RCPtr.h
1// -*- C++ -*-
2//
3// RCPtr.h is a part of ThePEG - Toolkit for HEP Event Generation
4// Copyright (C) 1999-2019 Leif Lonnblad
5//
6// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef ThePEG_RCPtr_H
10#define ThePEG_RCPtr_H
11// This is the declaration of the RCPtrBase,
12
13
14#include "ReferenceCounted.h"
15#include "RCPtr.fh"
16#include "PtrTraits.h"
17
18namespace ThePEG {
19namespace Pointer {
20
30class RCPtrBase {
31
34
35protected:
36
40 void increment(const ReferenceCounted * rcp) {
41 if ( rcp ) rcp->incrementReferenceCount();
42 }
46 bool release(const ReferenceCounted * rcp) {
47 return rcp && rcp->decrementReferenceCount();
48 }
49
50};
51
59template <typename T>
60class RCPtr: public RCPtrBase {
61
62public:
63
65 typedef void iterator_category;
67 typedef void difference_type;
69 typedef T * pointer;
71 typedef const T * const_pointer;
73 typedef T & reference;
75 typedef const T & const_reference;
77 typedef T value_type;
78
79public:
80
85 RCPtr() : ptr(nullptr) {}
86
90 RCPtr( decltype(nullptr) ) : ptr(nullptr) {}
91
95 RCPtr(const RCPtr & p) : ptr(p.ptr) { increment(); }
96
101 template <typename UPtr>
102 RCPtr(const UPtr & u)
103 : ptr(PtrTraits<UPtr>::barePointer(u)) { increment(); }
104
108 explicit RCPtr(pointer p) : ptr(p) { increment(); }
109
115
120 static RCPtr Create() {
121 RCPtr<T> p;
122 return p.create();
123 }
124
130 RCPtr<T> p;
131 return p.create(t);
132 }
133
134
140 release();
141 ptr = new T;
142 // increment(); // ReferenceCounted() constructor starts at 1
143 return *this;
144 }
145
151 release();
152 ptr = new T(t);
153 // increment(); // ReferenceCounted() constructor starts at 1
154 return *this;
155 }
156
160 RCPtr & operator=(const RCPtr & p) {
161 if ( ptr == p.ptr ) return *this;
162 release();
163 ptr = p.ptr;
164 increment();
165 return *this;
166 }
167
172 template <typename UPtr>
173 RCPtr & operator=(const UPtr & u) {
174 if ( ptr == PtrTraits<UPtr>::barePointer(u) ) return *this;
175 release();
177 increment();
178 return *this;
179 }
180
185 template <typename UPtr>
186 RCPtr & assignDynamic(const UPtr & u) {
187 pointer up = dynamic_cast<pointer>(PtrTraits<UPtr>::barePointer(u));
188 if ( ptr == up ) return *this;
189 release();
190 ptr = up;
191 increment();
192 return *this;
193 }
194
199 template <typename UPtr>
200 RCPtr & assignConst(const UPtr & u) {
201 pointer up = const_cast<pointer>(PtrTraits<UPtr>::barePointer(u));
202 if ( ptr == up ) return *this;
203 release();
204 ptr = up;
205 increment();
206 return *this;
207 }
208
212 void swap(RCPtr & p) {
213 const pointer tmp = ptr;
214 ptr = p.ptr;
215 p.ptr = tmp;
216 // std::swap(ptr, p.ptr);
217 }
218
222 bool operator==(const RCPtr & p) const { return ptr == p.ptr; }
223
227 bool operator!=(const RCPtr & p) const { return ptr != p.ptr; }
228
232 bool operator==(const_pointer p) const { return ptr == p; }
233
237 bool operator!=(const_pointer p) const { return ptr != p; }
238
242 template <typename UPtr>
243 bool operator==(const UPtr & u) const {
245 }
246
250 template <typename UPtr>
251 bool operator!=(const UPtr & u) const {
253 }
254
258 bool operator<(const RCPtr & p) const {
259 return ( ptr && p.ptr && ptr->uniqueId != p.ptr->uniqueId ) ?
260 ptr->uniqueId < p.ptr->uniqueId : ptr < p.ptr;
261 }
262
266 bool operator<(const_pointer p) const {
267 return ( ptr && p && ptr->uniqueId != p->uniqueId ) ?
268 ptr->uniqueId < p->uniqueId : ptr < p;
269 }
270
274 bool operator!() const { return !ptr; }
275
279 operator T * () const { return ptr; }
280
284 pointer operator->() const { return ptr; }
285
289 reference operator*() const { return *ptr; }
290
291private:
292
297
302 void release() { if ( RCPtrBase::release(ptr) ) delete ptr; }
303
308
309};
310
319template <typename T>
320class ConstRCPtr : public RCPtrBase {
321
322public:
323
325 typedef void iterator_category;
327 typedef void difference_type;
329 typedef T * pointer;
331 typedef const T * const_pointer;
333 typedef T & reference;
335 typedef const T & const_reference;
337 typedef T value_type;
338
339public:
340
344 ConstRCPtr() : ptr(nullptr) {}
345
349 ConstRCPtr( decltype(nullptr) ) : ptr(nullptr) {}
350
354 ConstRCPtr(const ConstRCPtr & p) : ptr(p.ptr) { increment(); }
355
360 template <typename UPtr>
361 ConstRCPtr(const UPtr & u) : ptr(PtrTraits<UPtr>::barePointer(u)) { increment(); }
362
366 explicit ConstRCPtr(const_pointer p) : ptr(p) { increment(); }
367
373
378 if ( ptr == p.ptr ) return *this;
379 release();
380 ptr = p.ptr;
381 increment();
382 return *this;
383 }
384
389 template <typename UPtr>
390 ConstRCPtr & operator=(const UPtr & u) {
391 if ( ptr == PtrTraits<UPtr>::barePointer(u) ) return *this;
392 release();
394 increment();
395 return *this;
396 }
397
402 template <typename UPtr>
403 ConstRCPtr & assignDynamic(const UPtr & u) {
404 const_pointer up =
406 if ( ptr == up ) return *this;
407 release();
408 ptr = up;
409 increment();
410 return *this;
411 }
412
416 void swap(ConstRCPtr & p) {
417 const const_pointer tmp = ptr;
418 ptr = p.ptr;
419 p.ptr = tmp;
420 // std::swap(ptr, p.ptr);
421 }
422
426 bool operator==(const ConstRCPtr & p) const { return ptr == p.ptr; }
427
431 bool operator!=(const ConstRCPtr & p) const { return ptr != p.ptr; }
432
436 bool operator==(const_pointer p) const { return ptr == p; }
437
441 bool operator!=(const_pointer p) const { return ptr != p; }
442
446 template <typename UPtr>
447 bool operator==(const UPtr & u) const { return ptr == PtrTraits<UPtr>::barePointer(u); }
448
452 template <typename UPtr>
453 bool operator!=(const UPtr & u) const { return ptr != PtrTraits<UPtr>::barePointer(u); }
454
458 bool operator<(const ConstRCPtr & p) const {
459 return ( ptr && p.ptr && ptr->uniqueId != p.ptr->uniqueId ) ?
460 ptr->uniqueId < p.ptr->uniqueId : ptr < p.ptr;
461 }
462
466 bool operator<(const_pointer p) const {
467 return ( ptr && p && ptr->uniqueId != p->uniqueId ) ?
468 ptr->uniqueId < p->uniqueId : ptr < p;
469 }
470
474 bool operator!() const { return !ptr; }
475
479 operator const T * () const { return ptr; }
480
484 const_pointer operator->() const { return ptr; }
485
489 const_reference operator*() const { return *ptr; }
490
491private:
492
497
502 void release() { if ( RCPtrBase::release(ptr) ) delete ptr; }
503
508
509};
510
518template <typename T>
520
521public:
522
524 typedef void iterator_category;
526 typedef void difference_type;
528 typedef T * pointer;
530 typedef const T * const_pointer;
532 typedef T & reference;
534 typedef const T & const_reference;
536 typedef T value_type;
537
538public:
539
543 TransientRCPtr() : ptr(nullptr) {}
544
548 TransientRCPtr( decltype(nullptr) ) : ptr(nullptr) {}
549
554
559 template <typename UPtr>
560 TransientRCPtr(const UPtr & u) : ptr(PtrTraits<UPtr>::barePointer(u)) {}
561
565 explicit TransientRCPtr(pointer p) : ptr(p) {}
566
571
576 ptr = p.ptr;
577 return *this;
578 }
579
584 template <typename UPtr>
585 TransientRCPtr & operator=(const UPtr & u) {
587 return *this;
588 }
589
594 template <typename UPtr>
595 TransientRCPtr & assignDynamic(const UPtr & u) {
596 ptr = dynamic_cast<pointer>(PtrTraits<UPtr>::barePointer(u));
597 return *this;
598 }
599
604 template <typename UPtr>
605 TransientRCPtr & assignConst(const UPtr & u) {
606 ptr = const_cast<pointer>(PtrTraits<UPtr>::barePointer(u));
607 return *this;
608 }
609
613 bool operator==(const TransientRCPtr & p) const { return ptr == p.ptr; }
614
618 bool operator!=(const TransientRCPtr & p) const { return ptr != p.ptr; }
619
623 bool operator==(const_pointer p) const { return ptr == p; }
624
628 bool operator!=(const_pointer p) const { return ptr != p; }
629
633 template <typename UPtr>
634 bool operator==(const UPtr & u) const { return ptr == PtrTraits<UPtr>::barePointer(u); }
635
639 template <typename UPtr>
640 bool operator!=(const UPtr & u) const { return ptr != PtrTraits<UPtr>::barePointer(u); }
641
645 bool operator<(const TransientRCPtr & p) const {
646 return ( ptr && p.ptr && ptr->uniqueId != p.ptr->uniqueId ) ?
647 ptr->uniqueId < p.ptr->uniqueId : ptr < p.ptr;
648 }
649
653 bool operator<(const_pointer p) const {
654 return ( ptr && p && ptr->uniqueId != p->uniqueId ) ?
655 ptr->uniqueId < p->uniqueId : ptr < p;
656 }
657
661 bool operator!() const { return !ptr; }
662
666 operator T * () const { return ptr; }
667
671 pointer operator->() const { return ptr; }
672
676 reference operator*() const { return *ptr; }
677
678private:
679
684
685};
686
695template <typename T>
697
698public:
699
701 typedef void iterator_category;
703 typedef void difference_type;
705 typedef T * pointer;
707 typedef const T * const_pointer;
709 typedef T & reference;
711 typedef const T & const_reference;
713 typedef T value_type;
714
715public:
716
720 TransientConstRCPtr() : ptr(nullptr) {}
721
725 TransientConstRCPtr( decltype(nullptr) ) : ptr(nullptr) {}
726
731
736 template <typename UPtr>
737 TransientConstRCPtr(const UPtr & u) : ptr(PtrTraits<UPtr>::barePointer(u)) {}
738
743
748
753 ptr = p.ptr;
754 return *this;
755 }
756
761 template <typename UPtr>
762 TransientConstRCPtr & operator=(const UPtr & u) {
764 return *this;
765 }
766
771 template <typename UPtr>
774 return *this;
775 }
776
780 bool operator==(const TransientConstRCPtr & p) const { return ptr == p.ptr; }
781
785 bool operator!=(const TransientConstRCPtr & p) const { return ptr != p.ptr; }
786
790 bool operator==(const_pointer p) const { return ptr == p; }
791
792
796 bool operator!=(const_pointer p) const { return ptr != p; }
797
801 template <typename UPtr>
802 bool operator==(const UPtr & u) const { return ptr == PtrTraits<UPtr>::barePointer(u); }
803
807 template <typename UPtr>
808 bool operator!=(const UPtr & u) const { return ptr != PtrTraits<UPtr>::barePointer(u); }
809
813 bool operator<(const TransientConstRCPtr & p) const {
814 return ( ptr && p.ptr && ptr->uniqueId != p.ptr->uniqueId ) ?
815 ptr->uniqueId < p.ptr->uniqueId : ptr < p.ptr;
816 }
817
821 bool operator<(const_pointer p) const {
822 return ( ptr && p && ptr->uniqueId != p->uniqueId ) ?
823 ptr->uniqueId < p->uniqueId : ptr < p;
824 }
825
829 bool operator!() const { return !ptr; }
830
834 operator const T * () const { return ptr; }
835
839 const_pointer operator->() const { return ptr; }
840
844 const_reference operator*() const { return *ptr; }
845
846private:
847
852
853};
854
858template <typename T>
859struct PtrTraits< RCPtr<T> >: public PtrTraitsType {
860
875
879 static T * barePointer(const RCPtr<T> & p) { return p.operator->(); }
880
884 static pointer create() { return RCPtr<T>::Create(); }
885
890
894 static void destroy(pointer) {}
895
899 template <typename UPtr>
900 static pointer DynamicCast(const UPtr & u) {
901 pointer t;
902 t.assignDynamic(u);
903 return t;
904 }
905
909 template <typename UPtr>
910 static pointer ConstCast(const UPtr & u) {
911 pointer t;
912 t.assignConst(u);
913 return t;
914 }
915
919 static pointer PtrCast(T * t) {
920 return pointer(t);
921 }
922
926 static const bool reference_counted = true;
927
928};
929
933template <typename T>
934struct PtrTraits< ConstRCPtr<T> >: public PtrTraitsType {
935
950
954 static const T * barePointer(const ConstRCPtr<T> & p) {
955 return p.operator->();
956 }
957
962 return RCPtr<T>::Create();
963 }
964
969 return RCPtr<T>::Create(t);
970 }
971
975 static void destroy(const_pointer) {}
976
980 template <typename UPtr>
981 static const_pointer DynamicCast(const UPtr & u) {
983 t.assignDynamic(u);
984 return t;
985 }
986
990 template <typename UPtr>
991 static const_pointer ConstCast(const UPtr & u) {
993 t.assignDynamic(u);
994 return t;
995 }
996
1000 static const_pointer PtrCast(const T * t) {
1001 return const_pointer(t);
1002 }
1003
1007 static const bool reference_counted = true;
1008
1009};
1010
1014template <typename T>
1016
1031
1035 static T * barePointer(const TransientRCPtr<T> & p) {
1036 return p.operator->();
1037 }
1038
1043
1047 template <typename UPtr>
1048 static transient_pointer DynamicCast(const UPtr & u) {
1050 t.assignDynamic(u);
1051 return t;
1052 }
1053
1059 t.assignConst(c);
1060 return t;
1061 }
1062
1067 return transient_pointer(t);
1068 }
1069
1073 static const bool reference_counted = false;
1074
1075};
1076
1080template <typename T>
1082
1097
1101 static const T * barePointer(const TransientConstRCPtr<T> & p) {
1102 return p.operator->();
1103 }
1104
1109
1113 template <typename UPtr>
1114 static transient_const_pointer DynamicCast(const UPtr & u) {
1116 t.assignDynamic(u);
1117 return t;
1118 }
1119
1123 template <typename UPtr>
1124 static transient_const_pointer ConstCast(const UPtr & u) {
1126 t.assignConst(u);
1127 return t;
1128 }
1129
1133 static transient_const_pointer PtrCast(const T * t) {
1134 return transient_const_pointer(t);
1135 }
1136
1140 static const bool reference_counted = false;
1141
1142};
1143
1144}
1145}
1146
1147namespace std {
1148
1153template <typename T>
1156 t1.swap(t2);
1157}
1158
1163template <typename T>
1166 t1.swap(t2);
1167}
1168
1169}
1170
1171#endif /* ThePEG_RCPtr_H */
ConstRCPtr is a reference counted (smart) const pointer.
Definition: RCPtr.h:320
void iterator_category
Template argument typedef.
Definition: RCPtr.h:325
T * pointer
Template argument typedef.
Definition: RCPtr.h:329
ConstRCPtr & operator=(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value implicitly convertible t...
Definition: RCPtr.h:390
ConstRCPtr()
Constructor for null pointer.
Definition: RCPtr.h:344
void swap(ConstRCPtr &p)
Make p point to the object pointed to by this and vice versa.
Definition: RCPtr.h:416
ConstRCPtr & assignDynamic(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value which can be cast dynami...
Definition: RCPtr.h:403
bool operator==(const ConstRCPtr &p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:426
bool operator==(const UPtr &u) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:447
bool operator<(const ConstRCPtr &p) const
Test for ordering.
Definition: RCPtr.h:458
void increment()
Increment the counter of the object pointed to.
Definition: RCPtr.h:496
bool operator!() const
Returns true if the underlying pointer is null.
Definition: RCPtr.h:474
void release()
Stop pointing to the current object and delete it if this was the last pointer to it.
Definition: RCPtr.h:502
T & reference
Template argument typedef.
Definition: RCPtr.h:333
ConstRCPtr(decltype(nullptr))
Constructor for nullptr.
Definition: RCPtr.h:349
ConstRCPtr(const_pointer p)
Construction from real pointer.
Definition: RCPtr.h:366
void difference_type
Template argument typedef.
Definition: RCPtr.h:327
const_reference operator*() const
Dereferencing.
Definition: RCPtr.h:489
const T * const_pointer
Template argument typedef.
Definition: RCPtr.h:331
T value_type
Template argument typedef.
Definition: RCPtr.h:337
const_pointer ptr
The actual pointer.
Definition: RCPtr.h:507
bool operator<(const_pointer p) const
Test for ordering.
Definition: RCPtr.h:466
ConstRCPtr & operator=(const ConstRCPtr &p)
Assignment.
Definition: RCPtr.h:377
ConstRCPtr(const ConstRCPtr &p)
Copy constructor.
Definition: RCPtr.h:354
bool operator!=(const UPtr &u) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:453
const_pointer operator->() const
Member access.
Definition: RCPtr.h:484
bool operator!=(const_pointer p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:441
const T & const_reference
Template argument typedef.
Definition: RCPtr.h:335
~ConstRCPtr()
Destructor.
Definition: RCPtr.h:372
bool operator!=(const ConstRCPtr &p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:431
bool operator==(const_pointer p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:436
ConstRCPtr(const UPtr &u)
Copyconstructor for class UPtr which has operator-> defined resulting in a value implicitly convertib...
Definition: RCPtr.h:361
RCPtrBase is the base class of RCPtr and ConstRCPtr which are reference counted (smart) pointers.
Definition: RCPtr.h:30
void increment(const ReferenceCounted *rcp)
Increment the counter of a reference counted object.
Definition: RCPtr.h:40
ReferenceCounted::CounterType CounterType
Get counter type from ReferenceCounted class.
Definition: RCPtr.h:33
bool release(const ReferenceCounted *rcp)
Decrement the counter of a reference counted object.
Definition: RCPtr.h:46
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
RCPtr(pointer p)
Construction from real pointer.
Definition: RCPtr.h:108
bool operator<(const_pointer p) const
Test for ordering.
Definition: RCPtr.h:266
static RCPtr Create()
Allocate and construct an object of class T and return a RCPtr to it.
Definition: RCPtr.h:120
bool operator==(const RCPtr &p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:222
pointer operator->() const
Member access.
Definition: RCPtr.h:284
RCPtr(const RCPtr &p)
Copy constructor.
Definition: RCPtr.h:95
bool operator==(const UPtr &u) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:243
bool operator!=(const_pointer p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:237
bool operator<(const RCPtr &p) const
Test for ordering.
Definition: RCPtr.h:258
RCPtr(const UPtr &u)
Copy constructor for class UPtr which has operator-> defined resulting in a value implicitly converti...
Definition: RCPtr.h:102
void increment()
Increment the counter of the object pointed to.
Definition: RCPtr.h:296
RCPtr & operator=(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value implicitly convertible t...
Definition: RCPtr.h:173
pointer ptr
The actual pointer.
Definition: RCPtr.h:307
void swap(RCPtr &p)
Make p point to the object pointed to by this and vice versa.
Definition: RCPtr.h:212
bool operator!() const
Returns true if the underlying pointer is null.
Definition: RCPtr.h:274
bool operator!=(const RCPtr &p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:227
bool operator==(const_pointer p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:232
T * pointer
Template argument typedef.
Definition: RCPtr.h:69
void release()
Stop pointing to the current object and delete it if this was the last pointer to it.
Definition: RCPtr.h:302
RCPtr(decltype(nullptr))
Constructor for nullptr.
Definition: RCPtr.h:90
const T * const_pointer
Template argument typedef.
Definition: RCPtr.h:71
T & reference
Template argument typedef.
Definition: RCPtr.h:73
RCPtr & operator=(const RCPtr &p)
Assignment.
Definition: RCPtr.h:160
RCPtr & assignConst(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value which can be const_cast'...
Definition: RCPtr.h:200
RCPtr & assignDynamic(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value which can be cast dynami...
Definition: RCPtr.h:186
bool operator!=(const UPtr &u) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:251
const T & const_reference
Template argument typedef.
Definition: RCPtr.h:75
reference operator*() const
Dereferencing.
Definition: RCPtr.h:289
RCPtr & create()
Allocate and construct an object of class T and point to it, possibly deleting the object pointed to ...
Definition: RCPtr.h:139
RCPtr & create(const_reference t)
Allocate and copy-construct an object of class T and point to it, possibly deleting the object pointe...
Definition: RCPtr.h:150
void difference_type
Template argument typedef.
Definition: RCPtr.h:67
static RCPtr Create(const_reference t)
Allocate and copy-construct an object of class T and return a RCPtr to it.
Definition: RCPtr.h:129
T value_type
Template argument typedef.
Definition: RCPtr.h:77
~RCPtr()
Destructor.
Definition: RCPtr.h:114
void iterator_category
Template argument typedef.
Definition: RCPtr.h:65
ReferenceCounted must be the (virtual) base class of all classes which may be pointed to by the RCPtr...
bool decrementReferenceCount() const
Decrement with the reference count.
unsigned int CounterType
The integer type used for counting.
void incrementReferenceCount() const
Increment the reference count.
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
bool operator!=(const TransientConstRCPtr &p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:785
TransientConstRCPtr & operator=(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value implicitly convertible t...
Definition: RCPtr.h:762
bool operator!=(const_pointer p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:796
bool operator!() const
Returns true if the underlying pointer is null.
Definition: RCPtr.h:829
const_reference operator*() const
Dereferencing.
Definition: RCPtr.h:844
TransientConstRCPtr(const TransientConstRCPtr &p)
Copy constructor.
Definition: RCPtr.h:730
TransientConstRCPtr()
Constructor for null pointer.
Definition: RCPtr.h:720
bool operator==(const_pointer p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:790
bool operator<(const TransientConstRCPtr &p) const
Test for ordering.
Definition: RCPtr.h:813
TransientConstRCPtr(const_pointer p)
Construction from real pointer.
Definition: RCPtr.h:742
const_pointer ptr
The actual pointer.
Definition: RCPtr.h:851
bool operator==(const UPtr &u) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:802
const T & const_reference
Template argument typedef.
Definition: RCPtr.h:711
void difference_type
Template argument typedef.
Definition: RCPtr.h:703
bool operator!=(const UPtr &u) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:808
T value_type
Template argument typedef.
Definition: RCPtr.h:713
TransientConstRCPtr & assignDynamic(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value which can be cast dynami...
Definition: RCPtr.h:772
bool operator<(const_pointer p) const
Test for ordering.
Definition: RCPtr.h:821
TransientConstRCPtr(decltype(nullptr))
Constructor for nullptr.
Definition: RCPtr.h:725
T * pointer
Template argument typedef.
Definition: RCPtr.h:705
T & reference
Template argument typedef.
Definition: RCPtr.h:709
TransientConstRCPtr(const UPtr &u)
Copyconstructor for class UPtr which has operator-> defined resulting in a value implicitly convertib...
Definition: RCPtr.h:737
void iterator_category
Template argument typedef.
Definition: RCPtr.h:701
const T * const_pointer
Template argument typedef.
Definition: RCPtr.h:707
bool operator==(const TransientConstRCPtr &p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:780
const_pointer operator->() const
Member access.
Definition: RCPtr.h:839
TransientConstRCPtr & operator=(const TransientConstRCPtr &p)
Assignment.
Definition: RCPtr.h:752
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
T value_type
Template argument typedef.
Definition: RCPtr.h:536
bool operator<(const TransientRCPtr &p) const
Test for ordering.
Definition: RCPtr.h:645
TransientRCPtr & operator=(const TransientRCPtr &p)
Assignment.
Definition: RCPtr.h:575
pointer operator->() const
Member access.
Definition: RCPtr.h:671
void iterator_category
Template argument typedef.
Definition: RCPtr.h:524
TransientRCPtr(const UPtr &u)
Copyconstructor for class UPtr which has operator-> defined resulting in a value implicitly convertib...
Definition: RCPtr.h:560
bool operator==(const TransientRCPtr &p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:613
void difference_type
Template argument typedef.
Definition: RCPtr.h:526
reference operator*() const
Dereferencing.
Definition: RCPtr.h:676
TransientRCPtr & assignDynamic(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value which can be cast dynami...
Definition: RCPtr.h:595
TransientRCPtr & operator=(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value implicitly convertible t...
Definition: RCPtr.h:585
TransientRCPtr()
Constructor for null pointer.
Definition: RCPtr.h:543
TransientRCPtr(pointer p)
Construction from real pointer.
Definition: RCPtr.h:565
const T & const_reference
Template argument typedef.
Definition: RCPtr.h:534
bool operator!() const
Returns true if the underlying pointer is null.
Definition: RCPtr.h:661
bool operator==(const UPtr &u) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:634
bool operator!=(const_pointer p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:628
TransientRCPtr(decltype(nullptr))
Constructor for nullptr.
Definition: RCPtr.h:548
bool operator!=(const TransientRCPtr &p) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:618
TransientRCPtr(const TransientRCPtr &p)
Copy constructor.
Definition: RCPtr.h:553
TransientRCPtr & assignConst(const UPtr &u)
Assignment from class UPtr which has operator-> defined resulting in a value whcih can be const_cast'...
Definition: RCPtr.h:605
pointer ptr
The actual pointer.
Definition: RCPtr.h:683
bool operator<(const_pointer p) const
Test for ordering.
Definition: RCPtr.h:653
const T * const_pointer
Template argument typedef.
Definition: RCPtr.h:530
T * pointer
Template argument typedef.
Definition: RCPtr.h:528
~TransientRCPtr()
Destructor.
Definition: RCPtr.h:570
T & reference
Template argument typedef.
Definition: RCPtr.h:532
bool operator!=(const UPtr &u) const
Test for inequality of the underlying pointers.
Definition: RCPtr.h:640
bool operator==(const_pointer p) const
Test for equality of the underlying pointers.
Definition: RCPtr.h:623
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
STL namespace.
void swap(ThePEG::Pointer::RCPtr< T > &t1, ThePEG::Pointer::RCPtr< T > &t2)
Specialization of std::swap to avoid unnecessary (in/de)crements of the reference count.
Definition: RCPtr.h:1154
PtrTraitsType is an empty non-polymorphic base class for all PtrTraits classes.
Definition: PtrTraits.h:20
static void destroy(const_pointer)
Destroy the object pointed to.
Definition: RCPtr.h:975
ConstRCPtr< T >::reference reference
Template argument typedef.
Definition: RCPtr.h:939
static const_pointer ConstCast(const UPtr &u)
Cast away constness.
Definition: RCPtr.h:991
TransientRCPtr< T > transient_pointer
Template argument typedef.
Definition: RCPtr.h:947
RCPtr< T > pointer
Template argument typedef.
Definition: RCPtr.h:943
static const_pointer create(const_reference t)
Create an copy of an object and return a pointer to it.
Definition: RCPtr.h:968
static const_pointer create()
Create an object and return a pointer to it.
Definition: RCPtr.h:961
ConstRCPtr< T >::const_reference const_reference
Template argument typedef.
Definition: RCPtr.h:941
TransientConstRCPtr< T > transient_const_pointer
Template argument typedef.
Definition: RCPtr.h:949
static const T * barePointer(const ConstRCPtr< T > &p)
Return the bare pointer of the given pointer object.
Definition: RCPtr.h:954
static const_pointer DynamicCast(const UPtr &u)
Cast dynamically.
Definition: RCPtr.h:981
ConstRCPtr< T > const_pointer
Template argument typedef.
Definition: RCPtr.h:945
static const_pointer PtrCast(const T *t)
Cast from a basic pointer.
Definition: RCPtr.h:1000
ConstRCPtr< T >::value_type value_type
Template argument typedef.
Definition: RCPtr.h:937
static pointer ConstCast(const UPtr &u)
Cast away constness.
Definition: RCPtr.h:910
TransientRCPtr< T > transient_pointer
Template argument typedef.
Definition: RCPtr.h:872
RCPtr< T >::value_type value_type
Template argument typedef.
Definition: RCPtr.h:862
RCPtr< T > pointer
Template argument typedef.
Definition: RCPtr.h:868
ConstRCPtr< T > const_pointer
Template argument typedef.
Definition: RCPtr.h:870
RCPtr< T >::reference reference
Template argument typedef.
Definition: RCPtr.h:864
static pointer create()
Create an object and return a pointer to it.
Definition: RCPtr.h:884
static void destroy(pointer)
Destroy the object pointed to.
Definition: RCPtr.h:894
static pointer PtrCast(T *t)
Cast from a basic pointer.
Definition: RCPtr.h:919
static T * barePointer(const RCPtr< T > &p)
Return the bare pointer of the given pointer object.
Definition: RCPtr.h:879
RCPtr< T >::const_reference const_reference
Template argument typedef.
Definition: RCPtr.h:866
static pointer create(const_reference t)
Create an copy of an object and return a pointer to it.
Definition: RCPtr.h:889
TransientConstRCPtr< T > transient_const_pointer
Template argument typedef.
Definition: RCPtr.h:874
static pointer DynamicCast(const UPtr &u)
Cast dynamically.
Definition: RCPtr.h:900
TransientConstRCPtr< T >::const_reference const_reference
Template argument typedef.
Definition: RCPtr.h:1088
TransientConstRCPtr< T >::reference reference
Template argument typedef.
Definition: RCPtr.h:1086
static transient_const_pointer ConstCast(const UPtr &u)
Cast away constness.
Definition: RCPtr.h:1124
ConstRCPtr< T > const_pointer
Template argument typedef.
Definition: RCPtr.h:1092
static transient_const_pointer DynamicCast(const UPtr &u)
Cast dynamically.
Definition: RCPtr.h:1114
TransientConstRCPtr< T >::value_type value_type
Template argument typedef.
Definition: RCPtr.h:1084
static transient_const_pointer PtrCast(const T *t)
Cast from a basic pointer.
Definition: RCPtr.h:1133
TransientConstRCPtr< T > transient_const_pointer
Template argument typedef.
Definition: RCPtr.h:1096
static const T * barePointer(const TransientConstRCPtr< T > &p)
Return the bare pointer of the given pointer object.
Definition: RCPtr.h:1101
static void destroy(transient_const_pointer)
Destroy the object pointed to.
Definition: RCPtr.h:1108
TransientRCPtr< T > transient_pointer
Template argument typedef.
Definition: RCPtr.h:1094
RCPtr< T > pointer
Template argument typedef.
Definition: RCPtr.h:1090
TransientConstRCPtr< T > transient_const_pointer
Template argument typedef.
Definition: RCPtr.h:1030
static transient_pointer PtrCast(T *t)
Cast from a basic pointer.
Definition: RCPtr.h:1066
TransientRCPtr< T >::value_type value_type
Template argument typedef.
Definition: RCPtr.h:1018
static void destroy(transient_pointer)
Destroy the object pointed to.
Definition: RCPtr.h:1042
TransientRCPtr< T > transient_pointer
Template argument typedef.
Definition: RCPtr.h:1028
RCPtr< T > pointer
Template argument typedef.
Definition: RCPtr.h:1024
static T * barePointer(const TransientRCPtr< T > &p)
Return the bare pointer of the given pointer object.
Definition: RCPtr.h:1035
static transient_pointer ConstCast(transient_const_pointer c)
Cast away constness.
Definition: RCPtr.h:1057
TransientRCPtr< T >::const_reference const_reference
Template argument typedef.
Definition: RCPtr.h:1022
TransientRCPtr< T >::reference reference
Template argument typedef.
Definition: RCPtr.h:1020
ConstRCPtr< T > const_pointer
Template argument typedef.
Definition: RCPtr.h:1026
static transient_pointer DynamicCast(const UPtr &u)
Cast dynamically.
Definition: RCPtr.h:1048
The PtrTraits class is used everywhere in ThePEG to interface to the pointers which are handled.
Definition: PtrTraits.h:39