Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-25 09:25:06

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef ACTSPODIOEDM_BoundParametersCollection_H
0004 #define ACTSPODIOEDM_BoundParametersCollection_H
0005 
0006 // datamodel specific includes
0007 #include "ActsPodioEdm/BoundParameters.h"
0008 #include "ActsPodioEdm/BoundParametersCollectionData.h"
0009 #include "ActsPodioEdm/BoundParametersObj.h"
0010 #include "ActsPodioEdm/MutableBoundParameters.h"
0011 
0012 // podio specific includes
0013 #include "podio/CollectionBase.h"
0014 #include "podio/ICollectionProvider.h"
0015 #include "podio/detail/Pythonizations.h"
0016 #include "podio/utilities/TypeHelpers.h"
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 #include <algorithm>
0023 #include <cstddef>
0024 #include <memory>
0025 #include <mutex>
0026 #include <ostream>
0027 #include <string_view>
0028 #include <vector>
0029 
0030 namespace podio {
0031 struct RelationNames;
0032 }
0033 
0034 namespace ActsPodioEdm {
0035 
0036 class BoundParametersCollectionIterator {
0037  public:
0038   using value_type = BoundParameters;
0039   using difference_type = ptrdiff_t;
0040   using reference = BoundParameters;
0041   using pointer = BoundParameters*;
0042   using iterator_category = std::input_iterator_tag;
0043   // `std::forward_iterator` is supported except that the pointers obtained with
0044   // `operator->()` remain valid as long as the iterator is valid, not as long
0045   // as the range is valid.
0046   using iterator_concept = std::random_access_iterator_tag;
0047 
0048   BoundParametersCollectionIterator(
0049       size_t index, const BoundParametersObjPointerContainer* collection)
0050       : m_index(index),
0051         m_object(podio::utils::MaybeSharedPtr<BoundParametersObj>{nullptr}),
0052         m_collection(collection) {}
0053   BoundParametersCollectionIterator() = default;
0054 
0055   BoundParametersCollectionIterator(const BoundParametersCollectionIterator&) =
0056       default;
0057   BoundParametersCollectionIterator(BoundParametersCollectionIterator&&) =
0058       default;
0059   BoundParametersCollectionIterator& operator=(
0060       const BoundParametersCollectionIterator&) = default;
0061   BoundParametersCollectionIterator& operator=(
0062       BoundParametersCollectionIterator&&) = default;
0063   ~BoundParametersCollectionIterator() = default;
0064 
0065   constexpr auto operator<=>(
0066       const BoundParametersCollectionIterator& other) const {
0067     return m_index <=> other.m_index;
0068   }
0069 
0070   constexpr bool operator==(const BoundParametersCollectionIterator& x) const {
0071     return m_index == x.m_index;
0072   }
0073 
0074   reference operator*() const;
0075   pointer operator->();
0076   BoundParametersCollectionIterator& operator++();
0077   BoundParametersCollectionIterator operator++(int);
0078   BoundParametersCollectionIterator& operator--();
0079   BoundParametersCollectionIterator operator--(int);
0080   BoundParametersCollectionIterator& operator+=(difference_type n);
0081   BoundParametersCollectionIterator operator+(difference_type n) const;
0082   friend BoundParametersCollectionIterator operator+(
0083       difference_type n, const BoundParametersCollectionIterator& it);
0084   BoundParametersCollectionIterator& operator-=(difference_type n);
0085   BoundParametersCollectionIterator operator-(difference_type n) const;
0086   reference operator[](difference_type n) const;
0087   difference_type operator-(
0088       const BoundParametersCollectionIterator& other) const;
0089 
0090  private:
0091   size_t m_index{0};
0092   BoundParameters m_object{
0093       podio::utils::MaybeSharedPtr<BoundParametersObj>{nullptr}};
0094   const BoundParametersObjPointerContainer* m_collection{nullptr};
0095 };
0096 
0097 class BoundParametersMutableCollectionIterator {
0098  public:
0099   using value_type = BoundParameters;
0100   using difference_type = ptrdiff_t;
0101   using reference = MutableBoundParameters;
0102   using pointer = MutableBoundParameters*;
0103   using iterator_category = std::input_iterator_tag;
0104   // `std::forward_iterator` is supported except that the pointers obtained with
0105   // `operator->()` remain valid as long as the iterator is valid, not as long
0106   // as the range is valid.
0107   using iterator_concept = std::random_access_iterator_tag;
0108 
0109   BoundParametersMutableCollectionIterator(
0110       size_t index, const BoundParametersObjPointerContainer* collection)
0111       : m_index(index),
0112         m_object(podio::utils::MaybeSharedPtr<BoundParametersObj>{nullptr}),
0113         m_collection(collection) {}
0114   BoundParametersMutableCollectionIterator() = default;
0115 
0116   BoundParametersMutableCollectionIterator(
0117       const BoundParametersMutableCollectionIterator&) = default;
0118   BoundParametersMutableCollectionIterator(
0119       BoundParametersMutableCollectionIterator&&) = default;
0120   BoundParametersMutableCollectionIterator& operator=(
0121       const BoundParametersMutableCollectionIterator&) = default;
0122   BoundParametersMutableCollectionIterator& operator=(
0123       BoundParametersMutableCollectionIterator&&) = default;
0124   ~BoundParametersMutableCollectionIterator() = default;
0125 
0126   constexpr auto operator<=>(
0127       const BoundParametersMutableCollectionIterator& other) const {
0128     return m_index <=> other.m_index;
0129   }
0130 
0131   constexpr bool operator==(
0132       const BoundParametersMutableCollectionIterator& x) const {
0133     return m_index == x.m_index;
0134   }
0135 
0136   reference operator*() const;
0137   pointer operator->();
0138   BoundParametersMutableCollectionIterator& operator++();
0139   BoundParametersMutableCollectionIterator operator++(int);
0140   BoundParametersMutableCollectionIterator& operator--();
0141   BoundParametersMutableCollectionIterator operator--(int);
0142   BoundParametersMutableCollectionIterator& operator+=(difference_type n);
0143   BoundParametersMutableCollectionIterator operator+(difference_type n) const;
0144   friend BoundParametersMutableCollectionIterator operator+(
0145       difference_type n, const BoundParametersMutableCollectionIterator& it);
0146   BoundParametersMutableCollectionIterator& operator-=(difference_type n);
0147   BoundParametersMutableCollectionIterator operator-(difference_type n) const;
0148   reference operator[](difference_type n) const;
0149   difference_type operator-(
0150       const BoundParametersMutableCollectionIterator& other) const;
0151 
0152  private:
0153   size_t m_index{0};
0154   MutableBoundParameters m_object{
0155       podio::utils::MaybeSharedPtr<BoundParametersObj>{nullptr}};
0156   const BoundParametersObjPointerContainer* m_collection{nullptr};
0157 };
0158 
0159 /**
0160 A Collection is identified by an ID.
0161 */
0162 class BoundParametersCollection : public podio::CollectionBase {
0163  public:
0164   using value_type = BoundParameters;
0165   using mutable_type = MutableBoundParameters;
0166   using const_iterator = BoundParametersCollectionIterator;
0167   using iterator = BoundParametersMutableCollectionIterator;
0168   using difference_type = ptrdiff_t;
0169   using size_type = size_t;
0170   using const_reverse_iterator = std::reverse_iterator<const_iterator>;
0171   using reverse_iterator = std::reverse_iterator<iterator>;
0172 
0173   BoundParametersCollection() = default;
0174   BoundParametersCollection(BoundParametersCollectionData&& data,
0175                             bool isSubsetColl);
0176   // This is a move-only type
0177   BoundParametersCollection(const BoundParametersCollection&) = delete;
0178   BoundParametersCollection& operator=(const BoundParametersCollection&) =
0179       delete;
0180   BoundParametersCollection(BoundParametersCollection&&) = default;
0181   BoundParametersCollection& operator=(BoundParametersCollection&&) = default;
0182 
0183   ~BoundParametersCollection() override;
0184 #if defined(__cpp_lib_containers_ranges)
0185   template <podio::detail::RangeConvertibleTo<value_type> R>
0186   BoundParametersCollection(std::from_range_t, R&& range);
0187 #endif
0188 
0189   /// Construct a BoundParameters collection from a range of mutable or
0190   /// immutable handles
0191   template <podio::detail::RangeConvertibleTo<value_type> R>
0192   static BoundParametersCollection from(R&& range);
0193 
0194   constexpr static std::string_view typeName =
0195       "ActsPodioEdm::BoundParametersCollection";
0196   constexpr static std::string_view valueTypeName =
0197       "ActsPodioEdm::BoundParameters";
0198   constexpr static std::string_view dataTypeName =
0199       "ActsPodioEdm::BoundParametersData";
0200 
0201   /// Invalidates all iterators.
0202   void clear() final;
0203 
0204   /// Cppyy protocol to setup the pythonizations for this class. Not to be
0205   /// called directly.
0206   static void __cppjit_pythonize__(PyObject* klass, const std::string& name) {
0207     podio::detail::pythonizations::pythonize_subscript(klass, name);
0208   }
0209   /// Pythonizations for ROOT <= 6.40 before the switch to cppjit
0210   static void __cppyy_pythonize__(PyObject* klass, const std::string& name) {
0211     __cppjit_pythonize__(klass, name);
0212   }
0213 
0214   /// Print this collection to the passed stream
0215   void print(std::ostream& os = std::cout, bool flush = true) const final;
0216 
0217   /// Append a new object to the collection, and return this object.
0218   /// Does not invalidate iterators.
0219   MutableBoundParameters create();
0220 
0221   /// Append a new object to the collection, and return this object.
0222   /// Initialized with the parameters given.
0223   /// Does not invalidate iterators.
0224   template <typename... Args>
0225   MutableBoundParameters create(Args&&... args);
0226 
0227   /// number of elements in the collection
0228   std::size_t size() const final;
0229 
0230   /// maximal number of elements in the collection
0231   std::size_t max_size() const final;
0232 
0233   /// Is the collection empty
0234   bool empty() const final;
0235 
0236   /// fully qualified type name
0237   const std::string_view getTypeName() const final { return typeName; }
0238   /// fully qualified type name of elements - with namespace
0239   const std::string_view getValueTypeName() const final {
0240     return valueTypeName;
0241   }
0242   /// fully qualified type name of stored POD elements - with namespace
0243   const std::string_view getDataTypeName() const final { return dataTypeName; }
0244   /// schema version
0245   podio::SchemaVersionT getSchemaVersion() const final;
0246 
0247   bool isSubsetCollection() const final { return m_isSubsetColl; }
0248 
0249   void setSubsetCollection(bool setSubset = true) final;
0250 
0251   /// Returns the const object of given index
0252   BoundParameters operator[](std::size_t index) const;
0253   /// Returns the object of a given index
0254   MutableBoundParameters operator[](std::size_t index);
0255   /// Returns the const object of given index
0256   BoundParameters at(std::size_t index) const;
0257   /// Returns the object of given index
0258   MutableBoundParameters at(std::size_t index);
0259 
0260   /// Append object to the collection.
0261   /// Does not invalidate iterators.
0262   void push_back(const MutableBoundParameters& object);
0263   /// Append an object to the (subset) collection.
0264   /// Does not invalidate iterators.
0265   void push_back(const BoundParameters& object);
0266 
0267   void prepareForWrite() const final;
0268   void prepareAfterRead() final;
0269   bool setReferences(
0270       const podio::ICollectionProvider* collectionProvider) final;
0271 
0272   /// Get the collection buffers for this collection
0273   podio::CollectionWriteBuffers getBuffers() final;
0274 
0275   void setID(uint32_t ID) final {
0276     m_collectionID = ID;
0277     if (!m_isSubsetColl) {
0278       std::for_each(m_storage.entries.begin(), m_storage.entries.end(),
0279                     [ID](BoundParametersObj* obj) {
0280                       obj->id = {obj->id.index, static_cast<uint32_t>(ID)};
0281                     });
0282     }
0283   }
0284 
0285   uint32_t getID() const final { return m_collectionID; }
0286 
0287   /// check if the collection has a valid ID
0288   bool hasID() const final {
0289     return getID() != static_cast<uint32_t>(podio::ObjectID::untracked) &&
0290            getID() != static_cast<uint32_t>(podio::ObjectID::invalid);
0291   }
0292 
0293   size_t getDatamodelRegistryIndex() const final;
0294 
0295   // support for the iterator protocol
0296   iterator begin() { return iterator(0, &m_storage.entries); }
0297   const_iterator begin() const { return const_iterator(0, &m_storage.entries); }
0298   const_iterator cbegin() const { return begin(); }
0299   iterator end() {
0300     return iterator(m_storage.entries.size(), &m_storage.entries);
0301   }
0302   const_iterator end() const {
0303     return const_iterator(m_storage.entries.size(), &m_storage.entries);
0304   }
0305   const_iterator cend() const { return end(); }
0306   // reverse iterators
0307   reverse_iterator rbegin() { return reverse_iterator(end()); }
0308   const_reverse_iterator rbegin() const {
0309     return const_reverse_iterator(end());
0310   }
0311   const_reverse_iterator crbegin() const { return rbegin(); }
0312   reverse_iterator rend() { return reverse_iterator(begin()); }
0313   const_reverse_iterator rend() const {
0314     return const_reverse_iterator(begin());
0315   }
0316   const_reverse_iterator crend() const { return rend(); }
0317 
0318   std::vector<ActsPodioEdm::BoundParametersInfo> data(
0319       const size_t nElem = 0) const;
0320 
0321  private:
0322   // For setReferences, we need to give our own CollectionData access to our
0323   // private entries. Otherwise we would need to expose a public member function
0324   // that gives access to the Obj* which is definitely not what we want
0325   friend class BoundParametersCollectionData;
0326 
0327   mutable bool m_isPrepared{false};
0328   bool m_isSubsetColl{false};
0329   uint32_t m_collectionID{static_cast<uint32_t>(podio::ObjectID::untracked)};
0330   mutable std::unique_ptr<std::mutex> m_storageMtx{
0331       std::make_unique<std::mutex>()};
0332   mutable BoundParametersCollectionData m_storage{};
0333 };
0334 
0335 std::ostream& operator<<(std::ostream& o, const BoundParametersCollection& v);
0336 
0337 template <typename... Args>
0338 MutableBoundParameters BoundParametersCollection::create(Args&&... args) {
0339   if (m_isSubsetColl) {
0340     throw std::logic_error("Cannot create new elements on a subset collection");
0341   }
0342   auto obj = new BoundParametersObj(
0343       {static_cast<int>(m_storage.entries.size()), m_collectionID},
0344       {std::forward<Args>(args)...});
0345   m_storage.entries.push_back(obj);
0346 
0347   return MutableBoundParameters(podio::utils::MaybeSharedPtr(obj));
0348 }
0349 
0350 #if defined(__cpp_lib_containers_ranges)
0351 template <
0352     podio::detail::RangeConvertibleTo<BoundParametersCollection::value_type> R>
0353 BoundParametersCollection::BoundParametersCollection(std::from_range_t,
0354                                                      R&& range)
0355     : BoundParametersCollection() {
0356   setSubsetCollection(podio::detail::RangeOf<R, value_type>);
0357 
0358   for (auto&& elem : range) {
0359     push_back(std::forward<decltype(elem)>(elem));
0360   }
0361 }
0362 #endif
0363 
0364 template <
0365     podio::detail::RangeConvertibleTo<BoundParametersCollection::value_type> R>
0366 BoundParametersCollection BoundParametersCollection::from(R&& range) {
0367   BoundParametersCollection coll;
0368   if constexpr (podio::detail::RangeOf<R, value_type>) {
0369     coll.setSubsetCollection();
0370   }
0371 
0372   for (auto&& elem : range) {
0373     coll.push_back(std::forward<decltype(elem)>(elem));
0374   }
0375 
0376   return coll;
0377 }
0378 
0379 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0380 void to_json(nlohmann::json& j, const BoundParametersCollection& collection);
0381 #endif
0382 
0383 }  // namespace ActsPodioEdm
0384 
0385 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0386 // until it's fixed in ROOT. See
0387 // https://github.com/root-project/root/issues/18489 and
0388 // https://github.com/AIDASoft/podio/issues/770
0389 #if defined(__clang__)
0390 #pragma clang diagnostic push
0391 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0392 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0393 #pragma clang diagnostic ignored "-Wdeprecated"
0394 constexpr std::string_view ActsPodioEdm::BoundParametersCollection::typeName;
0395 constexpr std::string_view
0396     ActsPodioEdm::BoundParametersCollection::valueTypeName;
0397 constexpr std::string_view
0398     ActsPodioEdm::BoundParametersCollection::dataTypeName;
0399 #pragma clang diagnostic pop
0400 #elif defined(__GNUC__)
0401 #pragma GCC diagnostic push
0402 #pragma GCC diagnostic ignored "-Wdeprecated"
0403 constexpr std::string_view ActsPodioEdm::BoundParametersCollection::typeName;
0404 constexpr std::string_view
0405     ActsPodioEdm::BoundParametersCollection::valueTypeName;
0406 constexpr std::string_view
0407     ActsPodioEdm::BoundParametersCollection::dataTypeName;
0408 #pragma GCC diagnostic pop
0409 #endif
0410 
0411 #endif