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