Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:20:46

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef JANA2_TUTORIAL_PODIO_DATAMODEL_EventHeader_H
0004 #define JANA2_TUTORIAL_PODIO_DATAMODEL_EventHeader_H
0005 
0006 #include "jana2_tutorial_podio_datamodel/EventHeaderObj.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 // forward declarations
0020 class EventHeaderCollection;
0021 
0022 
0023 namespace podio::detail {
0024 // Internal function used in less comparison operators of the datatypes and interface types
0025 OrderKey getOrderKey(const ::EventHeader& obj);
0026 };
0027 
0028 
0029 class MutableEventHeader;
0030 class EventHeaderCollection;
0031 class EventHeaderCollectionData;
0032 
0033 /** @class EventHeader
0034  *  Persistent IDs for each entry/frame/JEvent
0035  *  @author: N. Brei
0036  */
0037 class EventHeader {
0038 
0039   friend class MutableEventHeader;
0040   friend class EventHeaderCollection;
0041   friend class EventHeaderCollectionData;
0042   friend class EventHeaderCollectionIterator;
0043   friend podio::detail::OrderKey podio::detail::getOrderKey(const EventHeader & obj);
0044 
0045 public:
0046   using mutable_type = MutableEventHeader;
0047   using collection_type = EventHeaderCollection;
0048 
0049   /// default constructor
0050   EventHeader() = default;
0051 
0052   /// Constructor initializing all members
0053   EventHeader(const int run_number, const int timeframe_number, const int event_number);
0054 
0055   /// copy constructor
0056   EventHeader(const EventHeader& other) = default;
0057 
0058   /// copy-assignment operator
0059   EventHeader& operator=(EventHeader other) &; // Rebind this to other's internal object
0060   EventHeader& operator=(EventHeader other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0061 
0062   /// create a mutable deep-copy of the object with identical relations
0063   /// if cloneRelations=false, the relations are not cloned and will be empty
0064   MutableEventHeader clone(bool cloneRelations=true) const;
0065 
0066   /// destructor
0067   ~EventHeader() = default;
0068 
0069   /// converting constructor from mutable object
0070   EventHeader(const MutableEventHeader& other);
0071 
0072   static EventHeader makeEmpty();
0073 
0074 public:
0075 
0076   static constexpr std::string_view typeName = "EventHeader";
0077 
0078   /// Access the run number
0079   int getRun_number() const;
0080 
0081   /// Access the timeframe number
0082   int getTimeframe_number() const;
0083 
0084   /// Access the event number
0085   int getEvent_number() const;
0086 
0087 
0088 
0089 
0090 
0091   /// check whether the object is actually available
0092   bool isAvailable() const;
0093   /// disconnect from EventHeaderObj instance
0094   void unlink() { m_obj = podio::utils::MaybeSharedPtr<EventHeaderObj>{nullptr}; }
0095 
0096   bool operator==(const EventHeader& other) const { return m_obj == other.m_obj; }
0097   bool operator==(const MutableEventHeader& other) const;
0098 
0099   bool operator!=(const EventHeader& other) const { return !(*this == other); }
0100   bool operator!=(const MutableEventHeader& other) const { return !(*this == other); }
0101 
0102   // less comparison operator, so that objects can be e.g. stored in sets.
0103   bool operator<(const EventHeader& 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<EventHeader>;
0110 
0111   friend void swap(EventHeader& a, EventHeader& b) {
0112     using std::swap;
0113     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0114   }
0115 
0116 private:
0117   /// constructor from existing EventHeaderObj
0118   explicit EventHeader(podio::utils::MaybeSharedPtr<EventHeaderObj> obj);
0119   EventHeader(EventHeaderObj* obj);
0120 
0121   podio::utils::MaybeSharedPtr<EventHeaderObj> m_obj{new EventHeaderObj{}, podio::utils::MarkOwned};
0122 };
0123 
0124 std::ostream& operator<<(std::ostream& o, const EventHeader& value);
0125 
0126 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0127 void to_json(nlohmann::json& j, const EventHeader& value);
0128 #endif
0129 
0130 
0131 
0132 
0133 
0134 template<>
0135 struct std::hash<EventHeader> {
0136   std::size_t operator()(const EventHeader& obj) const {
0137     return std::hash<EventHeaderObj*>{}(obj.m_obj.get());
0138   }
0139 };
0140 
0141 
0142 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0143 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0144 // and https://github.com/AIDASoft/podio/issues/770
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 EventHeader::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 EventHeader::typeName;
0156   #pragma GCC diagnostic pop
0157 #endif
0158 
0159 
0160 #endif