 |
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef GEOMODELUTILITIES_TRANSIENTCONSTSHAREDPTR_H
6 #define GEOMODELUTILITIES_TRANSIENTCONSTSHAREDPTR_H
29 template <
typename DerivType>
33 template <
typename DerivType>
42 template <
typename DerivType>
44 requires(std::is_base_of_v<Obj, DerivType>) :
47 template <
typename DerivType>
49 requires(std::is_base_of_v<Obj, DerivType>) :
53 template <
typename DerivType>
55 requires(std::is_base_of_v<Obj, DerivType>) {
61 template <
typename DerivType>
63 requires(std::is_base_of_v<Obj, DerivType>) {
68 template <
typename DerivType>
70 requires(std::is_base_of_v<Obj, DerivType>) {
74 template <
typename DerivType>
76 requires(std::is_base_of_v<Obj, DerivType>) {
80 template <
typename DerivType>
82 requires(std::is_base_of_v<Obj, DerivType>) {
87 template <
typename DerivType>
88 void reset(std::unique_ptr<DerivType> newObj)
89 requires(std::is_base_of_v<Obj, DerivType>) {
90 m_ptr = std::move(newObj);
92 template <
typename DerivType>
93 void reset(std::shared_ptr<DerivType>&& newObj)
94 requires(std::is_base_of_v<Obj, DerivType>) {
95 m_ptr = std::move(newObj);
97 template <
typename DerivType>
98 void reset(
const std::shared_ptr<DerivType>& newObj)
99 requires(std::is_base_of_v<Obj, DerivType>) {
100 m_ptr = std::move(newObj);
106 operator bool()
const {
return m_ptr.get() !=
nullptr; }
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...
std::shared_ptr< Obj > m_ptr
size_t use_count() const
How many clients does the pointer have.
const Obj * operator->() const
void reset(std::unique_ptr< DerivType > newObj) requires(std
Overload the pointer.
TransientConstSharedPtr & operator=(const std::shared_ptr< DerivType > &other) requires(std
TransientConstSharedPtr(std::shared_ptr< DerivType > ptr) requires(std
Constructor from shared_ptr.
TransientConstSharedPtr & operator=(const TransientConstSharedPtr< DerivType > &other) requires(std
Assignment operator.
TransientConstSharedPtr(std::unique_ptr< DerivType > ptr) requires(std
Constructor from a unique_ptr.
requires requires()
This specialization is used for classes deriving from DataObject.
TransientConstSharedPtr()=default
Standard constructor.
std::shared_ptr< const Obj > release()
Release the memory.
TransientConstSharedPtr & operator=(std::shared_ptr< DerivType > &&other) requires(std
bool operator==(const TransientConstSharedPtr &other) const
Equal operator.
bool operator<(const TransientConstSharedPtr &other) const
Smaller operator to insert the pointer into sets.
bool operator!=(const TransientConstSharedPtr &other) const
TransientConstSharedPtr(const TransientConstSharedPtr< DerivType > &other) requires(std
Delete the copy constructor if the object is const.
void reset(std::shared_ptr< DerivType > &&newObj) requires(std
TransientConstSharedPtr(Obj *ptr)
Constructor from raw ptr.
TransientConstSharedPtr & operator=(std::unique_ptr< DerivType > &&other) requires(std
TransientConstSharedPtr & operator=(TransientConstSharedPtr< DerivType > &&other) requires(std
Move assignment operator.
WireGroupDesign element_type
type name
Obj * get()
Get (non-const) access to the underlying object.
const Obj * get() const
Get const access to the underlying object.
TransientConstSharedPtr(TransientConstSharedPtr< DerivType > &&other) requires(std
Standard move constructor.
const Obj & operator*() const
Dereference operator.
setBGCode setTAP setLVL2ErrorBits bool
void reset(const std::shared_ptr< DerivType > &newObj) requires(std