Warning, file /include/edm4hep/MutableRecDqdx.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003 #ifndef EDM4HEP_MutableRecDqdx_H
0004 #define EDM4HEP_MutableRecDqdx_H
0005
0006 #include "edm4hep/RecDqdxObj.h"
0007
0008 #include "edm4hep/RecDqdx.h"
0009
0010 #include "edm4hep/Quantity.h"
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013
0014 #include <cstdint>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace edm4hep {
0022 class RecDqdxCollection;
0023 class Track;
0024 class MutableTrack;
0025 }
0026
0027 namespace edm4hep {
0028
0029
0030
0031
0032
0033 class MutableRecDqdx {
0034
0035 friend class RecDqdxCollection;
0036 friend class RecDqdxMutableCollectionIterator;
0037 friend class RecDqdx;
0038
0039 public:
0040 using object_type = RecDqdx;
0041 using collection_type = RecDqdxCollection;
0042
0043
0044 MutableRecDqdx() = default;
0045
0046
0047 MutableRecDqdx(const edm4hep::Quantity& dQdx);
0048
0049
0050 MutableRecDqdx(const MutableRecDqdx& other) noexcept = default;
0051
0052
0053 MutableRecDqdx(MutableRecDqdx&& other) noexcept = default;
0054
0055
0056 MutableRecDqdx& operator=(MutableRecDqdx other) &;
0057 MutableRecDqdx&
0058 operator=(MutableRecDqdx other) && = delete;
0059
0060
0061
0062 MutableRecDqdx clone(bool cloneRelations = true) const;
0063
0064
0065 ~MutableRecDqdx() = default;
0066
0067 public:
0068
0069 const edm4hep::Quantity& getDQdx() const;
0070
0071
0072 const edm4hep::Track getTrack() const;
0073
0074
0075 void setDQdx(const edm4hep::Quantity& dQdx);
0076
0077 edm4hep::Quantity& getDQdx();
0078
0079
0080 void setTrack(const edm4hep::Track& value);
0081
0082
0083 bool isAvailable() const;
0084
0085 void unlink() { m_obj = podio::utils::MaybeSharedPtr<RecDqdxObj>{nullptr}; }
0086
0087 constexpr bool operator==(const MutableRecDqdx& other) const { return m_obj == other.m_obj; }
0088 bool operator==(const RecDqdx& other) const;
0089
0090 constexpr bool operator!=(const MutableRecDqdx& other) const { return !(*this == other); }
0091 bool operator!=(const RecDqdx& other) const { return !(*this == other); }
0092
0093
0094 bool operator<(const MutableRecDqdx& other) const {
0095 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0096 }
0097
0098 podio::ObjectID id() const { return getObjectID(); }
0099
0100 const podio::ObjectID getObjectID() const;
0101
0102 friend std::hash<MutableRecDqdx>;
0103
0104 friend void swap(MutableRecDqdx& a, MutableRecDqdx& b) {
0105 using std::swap;
0106 swap(a.m_obj, b.m_obj);
0107 }
0108
0109 private:
0110
0111 explicit MutableRecDqdx(podio::utils::MaybeSharedPtr<RecDqdxObj> obj);
0112
0113 podio::utils::MaybeSharedPtr<RecDqdxObj> m_obj{new RecDqdxObj{}, podio::utils::MarkOwned};
0114 };
0115
0116 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0117 void to_json(nlohmann::json& j, const MutableRecDqdx& value);
0118 #endif
0119
0120 }
0121
0122 template <>
0123 struct std::hash<edm4hep::MutableRecDqdx> {
0124 std::size_t operator()(const edm4hep::MutableRecDqdx& obj) const {
0125 return std::hash<edm4hep::RecDqdxObj*>{}(obj.m_obj.get());
0126 }
0127 };
0128
0129 #endif