Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 09:00:20

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef PODIODATAMODEL_MutableEventInfo_H
0004 #define PODIODATAMODEL_MutableEventInfo_H
0005 
0006 #include "PodioDatamodel/EventInfoObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "PodioDatamodel/EventInfo.h"
0009 
0010 
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012 
0013 #include <cstdint>
0014 
0015 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0016 #include "nlohmann/json_fwd.hpp"
0017 #endif
0018 
0019 // forward declarations
0020 class EventInfoCollection;
0021 
0022 
0023 
0024 
0025 /** @class MutableEventInfo
0026  *  Event info
0027  *  @author: N. Brei
0028  */
0029 class MutableEventInfo {
0030 
0031   friend class EventInfoCollection;
0032   friend class EventInfoMutableCollectionIterator;
0033   friend class EventInfo;
0034 
0035 public:
0036   using object_type = EventInfo;
0037   using collection_type = EventInfoCollection;
0038 
0039   /// default constructor
0040   MutableEventInfo();
0041 
0042   /// Constructor initializing all members
0043   MutableEventInfo(const int EventNumber, const int TimesliceNumber, const int RunNumber);
0044 
0045   /// copy constructor
0046   MutableEventInfo(const MutableEventInfo& other) = default;
0047 
0048   /// copy-assignment operator
0049   MutableEventInfo& operator=(MutableEventInfo other) &; // Rebind this to other's internal object
0050   MutableEventInfo& operator=(MutableEventInfo other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0051 
0052   /// create a mutable deep-copy of the object with identical relations
0053   /// if cloneRelations=false, the relations are not cloned and will be empty
0054   MutableEventInfo clone(bool cloneRelations=true) const;
0055 
0056   /// destructor
0057   ~MutableEventInfo() = default;
0058 
0059 
0060 public:
0061 
0062   /// Access the event number
0063   int EventNumber() const;
0064 
0065   /// Access the timeslice number
0066   int TimesliceNumber() const;
0067 
0068   /// Access the run number
0069   int RunNumber() const;
0070 
0071 
0072 
0073   /// Set the event number
0074   void EventNumber(const int EventNumber);
0075   /// Get mutable reference to event number
0076   int& EventNumber();
0077 
0078   /// Set the timeslice number
0079   void TimesliceNumber(const int TimesliceNumber);
0080   /// Get mutable reference to timeslice number
0081   int& TimesliceNumber();
0082 
0083   /// Set the run number
0084   void RunNumber(const int RunNumber);
0085   /// Get mutable reference to run number
0086   int& RunNumber();
0087 
0088 
0089 
0090 
0091 
0092 
0093   /// check whether the object is actually available
0094   bool isAvailable() const;
0095   /// disconnect from EventInfoObj instance
0096   void unlink() { m_obj = podio::utils::MaybeSharedPtr<EventInfoObj>{nullptr}; }
0097 
0098   bool operator==(const MutableEventInfo& other) const { return m_obj == other.m_obj; }
0099   bool operator==(const EventInfo& other) const;
0100 
0101   bool operator!=(const MutableEventInfo& other) const { return !(*this == other); }
0102   bool operator!=(const EventInfo& other) const { return !(*this == other); }
0103 
0104   // less comparison operator, so that objects can be e.g. stored in sets.
0105   bool operator<(const MutableEventInfo& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0106 
0107   podio::ObjectID id() const { return getObjectID(); }
0108 
0109   const podio::ObjectID getObjectID() const;
0110 
0111   friend std::hash<MutableEventInfo>;
0112 
0113   friend void swap(MutableEventInfo& a, MutableEventInfo& b) {
0114     using std::swap;
0115     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0116   }
0117 
0118 private:
0119   /// constructor from existing EventInfoObj
0120   explicit MutableEventInfo(podio::utils::MaybeSharedPtr<EventInfoObj> obj);
0121 
0122   podio::utils::MaybeSharedPtr<EventInfoObj> m_obj{nullptr};
0123 };
0124 
0125 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0126 void to_json(nlohmann::json& j, const MutableEventInfo& value);
0127 #endif
0128 
0129 
0130 
0131 
0132 
0133 template<>
0134 struct std::hash<MutableEventInfo> {
0135   std::size_t operator()(const MutableEventInfo& obj) const {
0136     return std::hash<EventInfoObj*>{}(obj.m_obj.get());
0137   }
0138 };
0139 
0140 
0141 #endif