Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/podio/detail/LinkObj.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef PODIO_DETAIL_LINKOBJ_H
0002 #define PODIO_DETAIL_LINKOBJ_H
0003 
0004 #include "podio/detail/LinkFwd.h"
0005 
0006 #include "podio/ObjectID.h"
0007 
0008 #include <memory>
0009 
0010 namespace podio {
0011 
0012 template <typename FromT, typename ToT>
0013 class LinkObj {
0014 
0015   friend Link<FromT, ToT>;
0016   friend MutableLink<FromT, ToT>;
0017 
0018 public:
0019   /// Constructor
0020   LinkObj() : id(), data(LinkData{1.0f}), m_from(nullptr), m_to(nullptr) {
0021   }
0022 
0023   /// Constructor from ObjectID and data (does not initialize relations yet!)
0024   LinkObj(const podio::ObjectID id_, LinkData data_) : id(id_), data(data_) {
0025   }
0026 
0027   /// Copy constructor (deep-copy of relations)
0028   LinkObj(const LinkObj& other) : id(), data(other.data), m_from(nullptr), m_to(nullptr) {
0029     if (other.m_from) {
0030       m_from = new FromT(*other.m_from);
0031     }
0032     if (other.m_to) {
0033       m_to = new ToT(*other.m_to);
0034     }
0035   }
0036 
0037   /// No assignment operator
0038   LinkObj& operator=(const LinkObj&) = delete;
0039 
0040   /// Destructor
0041   ~LinkObj() = default;
0042 
0043 public:
0044   podio::ObjectID id{};
0045   LinkData data{1.0f};
0046 
0047   std::unique_ptr<FromT> m_from{nullptr};
0048   std::unique_ptr<ToT> m_to{nullptr};
0049 };
0050 
0051 } // namespace podio
0052 
0053 #endif // PODIO_DETAIL_LINKOBJ_H