Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-30 07:57:05

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