Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-14 08:50:46

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 namespace edm4hep {
0028 
0029 /** @class MutableTimeSeries
0030  *  Calibrated Detector Data
0031  *  @author: EDM4hep authors
0032  */
0033 class MutableTimeSeries {
0034 
0035   friend class TimeSeriesCollection;
0036   friend class TimeSeriesMutableCollectionIterator;
0037   friend class TimeSeries;
0038 
0039 public:
0040   using object_type = TimeSeries;
0041   using collection_type = TimeSeriesCollection;
0042 
0043   /// default constructor
0044   MutableTimeSeries();
0045 
0046   /// Constructor initializing all members
0047   MutableTimeSeries(std::uint64_t cellID, float time, float interval);
0048 
0049   /// copy constructor
0050   MutableTimeSeries(const MutableTimeSeries& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableTimeSeries& operator=(MutableTimeSeries other);
0054 
0055   /// create a mutable deep-copy of the object with identical relations
0056   /// if cloneRelations=false, the relations are not cloned and will be empty
0057   MutableTimeSeries clone(bool cloneRelations = true) const;
0058 
0059   /// destructor
0060   ~MutableTimeSeries() = default;
0061 
0062 public:
0063   /// Access the cell id
0064   std::uint64_t getCellID() const;
0065 
0066   /// Access the begin time [ns]
0067   float getTime() const;
0068 
0069   /// Access the interval of each sampling [ns]
0070   float getInterval() const;
0071 
0072   /// Set the cell id
0073   void setCellID(std::uint64_t value);
0074   /// Get mutable reference to cell id
0075   std::uint64_t& getCellID();
0076   /// Get reference to cell id
0077   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0078 
0079   /// Set the begin time [ns]
0080   void setTime(float value);
0081   /// Get mutable reference to begin time [ns]
0082   float& getTime();
0083   /// Get reference to begin time [ns]
0084   [[deprecated("use getTime instead")]] float& time();
0085 
0086   /// Set the interval of each sampling [ns]
0087   void setInterval(float value);
0088   /// Get mutable reference to interval of each sampling [ns]
0089   float& getInterval();
0090   /// Get reference to interval of each sampling [ns]
0091   [[deprecated("use getInterval instead")]] float& interval();
0092 
0093   void addToAmplitude(const float&);
0094   std::size_t amplitude_size() const;
0095   float getAmplitude(std::size_t) const;
0096   std::vector<float>::const_iterator amplitude_begin() const;
0097   std::vector<float>::const_iterator amplitude_end() const;
0098   podio::RelationRange<float> getAmplitude() const;
0099 
0100   /// check whether the object is actually available
0101   bool isAvailable() const;
0102   /// disconnect from TimeSeriesObj instance
0103   void unlink() {
0104     m_obj = podio::utils::MaybeSharedPtr<TimeSeriesObj>{nullptr};
0105   }
0106 
0107   bool operator==(const MutableTimeSeries& other) const {
0108     return m_obj == other.m_obj;
0109   }
0110   bool operator==(const TimeSeries& other) const;
0111 
0112   bool operator!=(const MutableTimeSeries& other) const {
0113     return !(*this == other);
0114   }
0115   bool operator!=(const TimeSeries& other) const {
0116     return !(*this == other);
0117   }
0118 
0119   // less comparison operator, so that objects can be e.g. stored in sets.
0120   bool operator<(const MutableTimeSeries& other) const {
0121     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0122   }
0123 
0124   podio::ObjectID id() const {
0125     return getObjectID();
0126   }
0127 
0128   const podio::ObjectID getObjectID() const;
0129 
0130   friend void swap(MutableTimeSeries& a, MutableTimeSeries& b) {
0131     using std::swap;
0132     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0133   }
0134 
0135 private:
0136   /// constructor from existing TimeSeriesObj
0137   explicit MutableTimeSeries(podio::utils::MaybeSharedPtr<TimeSeriesObj> obj);
0138 
0139   podio::utils::MaybeSharedPtr<TimeSeriesObj> m_obj{nullptr};
0140 };
0141 
0142 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0143 void to_json(nlohmann::json& j, const MutableTimeSeries& value);
0144 #endif
0145 
0146 } // namespace edm4hep
0147 
0148 #endif