Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:36

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableEventHeader_H
0004 #define EDM4HEP_MutableEventHeader_H
0005 
0006 #include "edm4hep/EventHeaderObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
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 /** @class MutableEventHeader
0023  *  Event Header. Additional parameters are assumed to go into the metadata tree.
0024  *  @author: F.Gaede
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   /// default constructor
0037   MutableEventHeader();
0038 
0039   /// Constructor initializing all members
0040   MutableEventHeader(std::int32_t eventNumber, std::int32_t runNumber, std::uint64_t timeStamp, float weight);
0041 
0042   /// copy constructor
0043   MutableEventHeader(const MutableEventHeader& other) = default;
0044 
0045   /// copy-assignment operator
0046   MutableEventHeader& operator=(MutableEventHeader other);
0047 
0048   /// create a mutable deep-copy of the object with identical relations
0049   /// if cloneRelations=false, the relations are not cloned and will be empty
0050   MutableEventHeader clone(bool cloneRelations = true) const;
0051 
0052   /// destructor
0053   ~MutableEventHeader() = default;
0054 
0055 public:
0056   /// Access the event number
0057   std::int32_t getEventNumber() const;
0058 
0059   /// Access the run number
0060   std::int32_t getRunNumber() const;
0061 
0062   /// Access the time stamp
0063   std::uint64_t getTimeStamp() const;
0064 
0065   /// Access the event weight
0066   float getWeight() const;
0067 
0068   /// Set the event number
0069   void setEventNumber(std::int32_t value);
0070   /// Get mutable reference to event number
0071   std::int32_t& getEventNumber();
0072   /// Get reference to event number
0073   [[deprecated("use getEventNumber instead")]] std::int32_t& eventNumber();
0074 
0075   /// Set the run number
0076   void setRunNumber(std::int32_t value);
0077   /// Get mutable reference to run number
0078   std::int32_t& getRunNumber();
0079   /// Get reference to run number
0080   [[deprecated("use getRunNumber instead")]] std::int32_t& runNumber();
0081 
0082   /// Set the time stamp
0083   void setTimeStamp(std::uint64_t value);
0084   /// Get mutable reference to time stamp
0085   std::uint64_t& getTimeStamp();
0086   /// Get reference to time stamp
0087   [[deprecated("use getTimeStamp instead")]] std::uint64_t& timeStamp();
0088 
0089   /// Set the event weight
0090   void setWeight(float value);
0091   /// Get mutable reference to event weight
0092   float& getWeight();
0093   /// Get reference to event weight
0094   [[deprecated("use getWeight instead")]] float& weight();
0095 
0096   /// check whether the object is actually available
0097   bool isAvailable() const;
0098   /// disconnect from EventHeaderObj instance
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   // less comparison operator, so that objects can be e.g. stored in sets.
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); // swap out the internal pointers
0129   }
0130 
0131 private:
0132   /// constructor from existing EventHeaderObj
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 } // namespace edm4hep
0143 
0144 #endif