ATLAS Offline Software
DataObjectSharedPtr.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-2019 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id$
16 #ifndef ATHENAKERNEL_DATAOBJECTSHAREDPTR_H
17 #define ATHENAKERNEL_DATAOBJECTSHAREDPTR_H
18 
19 
20 #include "GaudiKernel/DataObject.h"
21 #include "boost/intrusive_ptr.hpp"
22 #include <memory>
23 
24 
25 inline void intrusive_ptr_add_ref (DataObject* o)
26 {
27  o->addRef();
28 }
29 
30 
31 inline void intrusive_ptr_release (DataObject* o)
32 {
33  o->release();
34 }
35 
36 
37 namespace SG {
38 
39 
43 template <class T>
45  : public boost::intrusive_ptr<T>
46 {
47 public:
48  typedef boost::intrusive_ptr<T> Base;
50  explicit DataObjectSharedPtr (T* p, bool add_ref = true)
51  : Base (p, add_ref) {}
52  explicit DataObjectSharedPtr (std::unique_ptr<T> p, bool add_ref = true)
53  : Base (p.release(), add_ref) {}
55  : Base (rhs) {}
56  template <class U>
58  : Base (rhs) {}
59 
60  // Avoid coverity warning.
62 };
63 
64 
65 } // namespace SG
66 
67 
68 #endif // not ATHENAKERNEL_DATAOBJECTSHAREDPTR_H
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
intrusive_ptr_add_ref
void intrusive_ptr_add_ref(DataObject *o)
Definition: DataObjectSharedPtr.h:25
SG::DataObjectSharedPtr::DataObjectSharedPtr
DataObjectSharedPtr(const DataObjectSharedPtr &rhs)
Definition: DataObjectSharedPtr.h:54
SG::DataObjectSharedPtr::Base
boost::intrusive_ptr< T > Base
Definition: DataObjectSharedPtr.h:48
intrusive_ptr_release
void intrusive_ptr_release(DataObject *o)
Definition: DataObjectSharedPtr.h:31
SG::DataObjectSharedPtr::DataObjectSharedPtr
DataObjectSharedPtr(std::unique_ptr< T > p, bool add_ref=true)
Definition: DataObjectSharedPtr.h:52
SG::DataObjectSharedPtr::DataObjectSharedPtr
DataObjectSharedPtr(T *p, bool add_ref=true)
Definition: DataObjectSharedPtr.h:50
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Base
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
SG::DataObjectSharedPtr::DataObjectSharedPtr
DataObjectSharedPtr()
Definition: DataObjectSharedPtr.h:49
SG::DataObjectSharedPtr::DataObjectSharedPtr
DataObjectSharedPtr(const DataObjectSharedPtr< U > &rhs)
Definition: DataObjectSharedPtr.h:57
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:46
SG::DataObjectSharedPtr::operator=
DataObjectSharedPtr & operator=(const DataObjectSharedPtr &rhs)=default