Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 09:02:16

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef PODIODATAMODEL_MutableExampleHit_H
0004 #define PODIODATAMODEL_MutableExampleHit_H
0005 
0006 #include "PodioDatamodel/ExampleHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "PodioDatamodel/ExampleHit.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 // forward declarations
0021 class ExampleHitCollection;
0022 
0023 
0024 
0025 
0026 /** @class MutableExampleHit
0027  *  Example Hit
0028  *  @author: B. Hegner
0029  */
0030 class MutableExampleHit {
0031 
0032   friend class ExampleHitCollection;
0033   friend class ExampleHitMutableCollectionIterator;
0034   friend class ExampleHit;
0035 
0036 public:
0037   using object_type = ExampleHit;
0038   using collection_type = ExampleHitCollection;
0039 
0040   /// default constructor
0041   MutableExampleHit();
0042 
0043   /// Constructor initializing all members
0044   MutableExampleHit(const std::uint64_t cellID, const double x, const double y, const double z, const double energy, const std::uint64_t time);
0045 
0046   /// copy constructor
0047   MutableExampleHit(const MutableExampleHit& other) = default;
0048 
0049   /// copy-assignment operator
0050   MutableExampleHit& operator=(MutableExampleHit other) &; // Rebind this to other's internal object
0051   MutableExampleHit& operator=(MutableExampleHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0052 
0053   /// create a mutable deep-copy of the object with identical relations
0054   /// if cloneRelations=false, the relations are not cloned and will be empty
0055   MutableExampleHit clone(bool cloneRelations=true) const;
0056 
0057   /// destructor
0058   ~MutableExampleHit() = default;
0059 
0060 
0061 public:
0062 
0063   /// Access the cellID
0064   std::uint64_t cellID() const;
0065 
0066   /// Access the x-coordinate
0067   double x() const;
0068 
0069   /// Access the y-coordinate
0070   double y() const;
0071 
0072   /// Access the z-coordinate
0073   double z() const;
0074 
0075   /// Access the measured energy deposit
0076   double energy() const;
0077 
0078   /// Access the ticks since start of timeframe
0079   std::uint64_t time() const;
0080 
0081 
0082 
0083   /// Set the cellID
0084   void cellID(const std::uint64_t cellID);
0085   /// Get mutable reference to cellID
0086   std::uint64_t& cellID();
0087 
0088   /// Set the x-coordinate
0089   void x(const double x);
0090   /// Get mutable reference to x-coordinate
0091   double& x();
0092 
0093   /// Set the y-coordinate
0094   void y(const double y);
0095   /// Get mutable reference to y-coordinate
0096   double& y();
0097 
0098   /// Set the z-coordinate
0099   void z(const double z);
0100   /// Get mutable reference to z-coordinate
0101   double& z();
0102 
0103   /// Set the measured energy deposit
0104   void energy(const double energy);
0105   /// Get mutable reference to measured energy deposit
0106   double& energy();
0107 
0108   /// Set the ticks since start of timeframe
0109   void time(const std::uint64_t time);
0110   /// Get mutable reference to ticks since start of timeframe
0111   std::uint64_t& time();
0112 
0113 
0114 
0115 
0116 
0117 
0118   /// check whether the object is actually available
0119   bool isAvailable() const;
0120   /// disconnect from ExampleHitObj instance
0121   void unlink() { m_obj = podio::utils::MaybeSharedPtr<ExampleHitObj>{nullptr}; }
0122 
0123   bool operator==(const MutableExampleHit& other) const { return m_obj == other.m_obj; }
0124   bool operator==(const ExampleHit& other) const;
0125 
0126   bool operator!=(const MutableExampleHit& other) const { return !(*this == other); }
0127   bool operator!=(const ExampleHit& other) const { return !(*this == other); }
0128 
0129   // less comparison operator, so that objects can be e.g. stored in sets.
0130   bool operator<(const MutableExampleHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0131 
0132   podio::ObjectID id() const { return getObjectID(); }
0133 
0134   const podio::ObjectID getObjectID() const;
0135 
0136   friend std::hash<MutableExampleHit>;
0137 
0138   friend void swap(MutableExampleHit& a, MutableExampleHit& b) {
0139     using std::swap;
0140     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0141   }
0142 
0143 private:
0144   /// constructor from existing ExampleHitObj
0145   explicit MutableExampleHit(podio::utils::MaybeSharedPtr<ExampleHitObj> obj);
0146 
0147   podio::utils::MaybeSharedPtr<ExampleHitObj> m_obj{nullptr};
0148 };
0149 
0150 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0151 void to_json(nlohmann::json& j, const MutableExampleHit& value);
0152 #endif
0153 
0154 
0155 
0156 
0157 
0158 template<>
0159 struct std::hash<MutableExampleHit> {
0160   std::size_t operator()(const MutableExampleHit& obj) const {
0161     return std::hash<ExampleHitObj*>{}(obj.m_obj.get());
0162   }
0163 };
0164 
0165 
0166 #endif