File indexing completed on 2026-09-19 08:48:33
0001
0002
0003 #ifndef ACTSPODIOEDM_TrackState_H
0004 #define ACTSPODIOEDM_TrackState_H
0005
0006 #include "ActsPodioEdm/Surface.h"
0007 #include "ActsPodioEdm/TrackStateInfo.h"
0008 #include "ActsPodioEdm/TrackStateObj.h"
0009
0010 #include <cstdint>
0011 #include <ostream>
0012
0013 #include "podio/detail/OrderKey.h"
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace ActsPodioEdm {
0022 class TrackStateCollection;
0023 }
0024
0025 namespace podio::detail {
0026
0027
0028 OrderKey getOrderKey(const ActsPodioEdm::TrackState& obj);
0029 };
0030
0031 namespace ActsPodioEdm {
0032
0033 class MutableTrackState;
0034 class TrackStateCollection;
0035 class TrackStateCollectionData;
0036
0037
0038
0039
0040
0041 class TrackState {
0042 friend class MutableTrackState;
0043 friend class TrackStateCollection;
0044 friend class ActsPodioEdm::TrackStateCollectionData;
0045 friend class TrackStateCollectionIterator;
0046 friend podio::detail::OrderKey podio::detail::getOrderKey(
0047 const TrackState& obj);
0048
0049 public:
0050 using mutable_type = MutableTrackState;
0051 using collection_type = TrackStateCollection;
0052
0053
0054 TrackState() = default;
0055
0056
0057 TrackState(const ActsPodioEdm::TrackStateInfo& data,
0058 const ActsPodioEdm::Surface& referenceSurface);
0059
0060
0061 TrackState(const TrackState& other) = default;
0062
0063
0064 TrackState& operator=(
0065 TrackState other) &;
0066 TrackState& operator=(TrackState other) && =
0067 delete;
0068
0069
0070
0071 MutableTrackState clone(bool cloneRelations = true) const;
0072
0073
0074 ~TrackState() = default;
0075
0076
0077 TrackState(const MutableTrackState& other);
0078
0079 static TrackState makeEmpty();
0080
0081 public:
0082 static constexpr std::string_view typeName = "ActsPodioEdm::TrackState";
0083
0084
0085 const ActsPodioEdm::TrackStateInfo& getData() const;
0086
0087
0088 const ActsPodioEdm::Surface& getReferenceSurface() const;
0089
0090
0091 bool isAvailable() const;
0092
0093 void unlink() {
0094 m_obj = podio::utils::MaybeSharedPtr<TrackStateObj>{nullptr};
0095 }
0096
0097 constexpr bool operator==(const TrackState& other) const {
0098 return m_obj == other.m_obj;
0099 }
0100 bool operator==(const MutableTrackState& other) const;
0101
0102 constexpr bool operator!=(const TrackState& other) const {
0103 return !(*this == other);
0104 }
0105 bool operator!=(const MutableTrackState& other) const {
0106 return !(*this == other);
0107 }
0108
0109
0110 bool operator<(const TrackState& other) const {
0111 return podio::detail::getOrderKey(*this) <
0112 podio::detail::getOrderKey(other);
0113 }
0114
0115 podio::ObjectID id() const { return getObjectID(); }
0116
0117 const podio::ObjectID getObjectID() const;
0118
0119 friend std::hash<TrackState>;
0120
0121 friend void swap(TrackState& a, TrackState& b) {
0122 using std::swap;
0123 swap(a.m_obj, b.m_obj);
0124 }
0125
0126 private:
0127
0128 explicit TrackState(podio::utils::MaybeSharedPtr<TrackStateObj> obj);
0129 TrackState(TrackStateObj* obj);
0130
0131 podio::utils::MaybeSharedPtr<TrackStateObj> m_obj{new TrackStateObj{},
0132 podio::utils::MarkOwned};
0133 };
0134
0135 std::ostream& operator<<(std::ostream& o, const TrackState& value);
0136
0137 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0138 void to_json(nlohmann::json& j, const TrackState& value);
0139 #endif
0140
0141 }
0142
0143 template <>
0144 struct std::hash<ActsPodioEdm::TrackState> {
0145 std::size_t operator()(const ActsPodioEdm::TrackState& obj) const {
0146 return std::hash<ActsPodioEdm::TrackStateObj*>{}(obj.m_obj.get());
0147 }
0148 };
0149
0150
0151
0152
0153
0154 #if defined(__clang__)
0155 #pragma clang diagnostic push
0156 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0157 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0158 #pragma clang diagnostic ignored "-Wdeprecated"
0159 constexpr std::string_view ActsPodioEdm::TrackState::typeName;
0160 #pragma clang diagnostic pop
0161 #elif defined(__GNUC__)
0162 #pragma GCC diagnostic push
0163 #pragma GCC diagnostic ignored "-Wdeprecated"
0164 constexpr std::string_view ActsPodioEdm::TrackState::typeName;
0165 #pragma GCC diagnostic pop
0166 #endif
0167
0168 #endif