Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:35:42

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