File indexing completed on 2025-01-18 09:55:36
0001
0002
0003 #ifndef EDM4HEP_MutableEventHeader_H
0004 #define EDM4HEP_MutableEventHeader_H
0005
0006 #include "edm4hep/EventHeaderObj.h"
0007
0008 #include "edm4hep/EventHeader.h"
0009
0010 #include <cstdint>
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 namespace edm4hep {
0021
0022
0023
0024
0025
0026 class MutableEventHeader {
0027
0028 friend class EventHeaderCollection;
0029 friend class EventHeaderMutableCollectionIterator;
0030 friend class EventHeader;
0031
0032 public:
0033 using object_type = EventHeader;
0034 using collection_type = EventHeaderCollection;
0035
0036
0037 MutableEventHeader();
0038
0039
0040 MutableEventHeader(std::int32_t eventNumber, std::int32_t runNumber, std::uint64_t timeStamp, float weight);
0041
0042
0043 MutableEventHeader(const MutableEventHeader& other) = default;
0044
0045
0046 MutableEventHeader& operator=(MutableEventHeader other);
0047
0048
0049
0050 MutableEventHeader clone(bool cloneRelations = true) const;
0051
0052
0053 ~MutableEventHeader() = default;
0054
0055 public:
0056
0057 std::int32_t getEventNumber() const;
0058
0059
0060 std::int32_t getRunNumber() const;
0061
0062
0063 std::uint64_t getTimeStamp() const;
0064
0065
0066 float getWeight() const;
0067
0068
0069 void setEventNumber(std::int32_t value);
0070
0071 std::int32_t& getEventNumber();
0072
0073 [[deprecated("use getEventNumber instead")]] std::int32_t& eventNumber();
0074
0075
0076 void setRunNumber(std::int32_t value);
0077
0078 std::int32_t& getRunNumber();
0079
0080 [[deprecated("use getRunNumber instead")]] std::int32_t& runNumber();
0081
0082
0083 void setTimeStamp(std::uint64_t value);
0084
0085 std::uint64_t& getTimeStamp();
0086
0087 [[deprecated("use getTimeStamp instead")]] std::uint64_t& timeStamp();
0088
0089
0090 void setWeight(float value);
0091
0092 float& getWeight();
0093
0094 [[deprecated("use getWeight instead")]] float& weight();
0095
0096
0097 bool isAvailable() const;
0098
0099 void unlink() {
0100 m_obj = podio::utils::MaybeSharedPtr<EventHeaderObj>{nullptr};
0101 }
0102
0103 bool operator==(const MutableEventHeader& other) const {
0104 return m_obj == other.m_obj;
0105 }
0106 bool operator==(const EventHeader& other) const;
0107
0108 bool operator!=(const MutableEventHeader& other) const {
0109 return !(*this == other);
0110 }
0111 bool operator!=(const EventHeader& other) const {
0112 return !(*this == other);
0113 }
0114
0115
0116 bool operator<(const MutableEventHeader& other) const {
0117 return m_obj < other.m_obj;
0118 }
0119
0120 podio::ObjectID id() const {
0121 return getObjectID();
0122 }
0123
0124 const podio::ObjectID getObjectID() const;
0125
0126 friend void swap(MutableEventHeader& a, MutableEventHeader& b) {
0127 using std::swap;
0128 swap(a.m_obj, b.m_obj);
0129 }
0130
0131 private:
0132
0133 explicit MutableEventHeader(podio::utils::MaybeSharedPtr<EventHeaderObj> obj);
0134
0135 podio::utils::MaybeSharedPtr<EventHeaderObj> m_obj{nullptr};
0136 };
0137
0138 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0139 void to_json(nlohmann::json& j, const MutableEventHeader& value);
0140 #endif
0141
0142 }
0143
0144 #endif