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