Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:10:54

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableTimeSeries_H
0004 #define EDM4HEP_MutableTimeSeries_H
0005 
0006 #include "edm4hep/TimeSeriesObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/TimeSeries.h"
0009 
0010 #include "podio/RelationRange.h"
0011 #include <cstdint>
0012 #include <vector>
0013 
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 // forward declarations
0023 namespace edm4hep {
0024 class TimeSeriesCollection;
0025 }
0026 
0027 
0028 namespace edm4hep {
0029 
0030 
0031 /** @class MutableTimeSeries
0032  *  Calibrated Detector Data
0033  *  @author: EDM4hep authors
0034  */
0035 class MutableTimeSeries {
0036 
0037   friend class TimeSeriesCollection;
0038   friend class TimeSeriesMutableCollectionIterator;
0039   friend class TimeSeries;
0040 
0041 public:
0042   using object_type = TimeSeries;
0043   using collection_type = TimeSeriesCollection;
0044 
0045   /// default constructor
0046   MutableTimeSeries();
0047 
0048   /// Constructor initializing all members
0049   MutableTimeSeries(const std::uint64_t cellID, const float time, const float interval);
0050 
0051   /// copy constructor
0052   MutableTimeSeries(const MutableTimeSeries& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableTimeSeries& operator=(MutableTimeSeries other) &; // Rebind this to other's internal object
0056   MutableTimeSeries& operator=(MutableTimeSeries other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0057 
0058   /// create a mutable deep-copy of the object with identical relations
0059   /// if cloneRelations=false, the relations are not cloned and will be empty
0060   MutableTimeSeries clone(bool cloneRelations=true) const;
0061 
0062   /// destructor
0063   ~MutableTimeSeries() = default;
0064 
0065 
0066 public:
0067 
0068   /// Access the cell id
0069   std::uint64_t getCellID() const;
0070 
0071   /// Access the begin time [ns]
0072   float getTime() const;
0073 
0074   /// Access the interval of each sampling [ns]
0075   float getInterval() const;
0076 
0077 
0078 
0079   /// Set the cell id
0080   void setCellID(const std::uint64_t cellID);
0081   /// Get mutable reference to cell id
0082   std::uint64_t& getCellID();
0083   /// Get reference to cell id
0084   [[deprecated("use getCellID instead")]]
0085   std::uint64_t& cellID();
0086 
0087   /// Set the begin time [ns]
0088   void setTime(const float time);
0089   /// Get mutable reference to begin time [ns]
0090   float& getTime();
0091   /// Get reference to begin time [ns]
0092   [[deprecated("use getTime instead")]]
0093   float& time();
0094 
0095   /// Set the interval of each sampling [ns]
0096   void setInterval(const float interval);
0097   /// Get mutable reference to interval of each sampling [ns]
0098   float& getInterval();
0099   /// Get reference to interval of each sampling [ns]
0100   [[deprecated("use getInterval instead")]]
0101   float& interval();
0102 
0103 
0104 
0105   void addToAmplitude(const float&);
0106   std::size_t amplitude_size() const;
0107   float getAmplitude(std::size_t) const;
0108   std::vector<float>::const_iterator amplitude_begin() const;
0109   std::vector<float>::const_iterator amplitude_end() const;
0110   podio::RelationRange<float> getAmplitude() const;
0111 
0112 
0113 
0114   /// check whether the object is actually available
0115   bool isAvailable() const;
0116   /// disconnect from TimeSeriesObj instance
0117   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TimeSeriesObj>{nullptr}; }
0118 
0119   bool operator==(const MutableTimeSeries& other) const { return m_obj == other.m_obj; }
0120   bool operator==(const TimeSeries& other) const;
0121 
0122   bool operator!=(const MutableTimeSeries& other) const { return !(*this == other); }
0123   bool operator!=(const TimeSeries& other) const { return !(*this == other); }
0124 
0125   // less comparison operator, so that objects can be e.g. stored in sets.
0126   bool operator<(const MutableTimeSeries& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0127 
0128   podio::ObjectID id() const { return getObjectID(); }
0129 
0130   const podio::ObjectID getObjectID() const;
0131 
0132   friend std::hash<MutableTimeSeries>;
0133 
0134   friend void swap(MutableTimeSeries& a, MutableTimeSeries& b) {
0135     using std::swap;
0136     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0137   }
0138 
0139 private:
0140   /// constructor from existing TimeSeriesObj
0141   explicit MutableTimeSeries(podio::utils::MaybeSharedPtr<TimeSeriesObj> obj);
0142 
0143   podio::utils::MaybeSharedPtr<TimeSeriesObj> m_obj{nullptr};
0144 };
0145 
0146 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0147 void to_json(nlohmann::json& j, const MutableTimeSeries& value);
0148 #endif
0149 
0150 
0151 } // namespace edm4hep
0152 
0153 
0154 
0155 template<>
0156 struct std::hash<edm4hep::MutableTimeSeries> {
0157   std::size_t operator()(const edm4hep::MutableTimeSeries& obj) const {
0158     return std::hash<edm4hep::TimeSeriesObj*>{}(obj.m_obj.get());
0159   }
0160 };
0161 
0162 
0163 #endif