Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-02 08:37:58

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   void clear() final;
0202 
0203   /// Cppyy protocol to setup the pythonizations for this class. Not to be
0204   /// called directly.
0205   static void __cppyy_pythonize__(PyObject* klass, const std::string& name) {
0206     podio::detail::pythonizations::pythonize_subscript(klass, name);
0207   }
0208 
0209   /// Print this collection to the passed stream
0210   void print(std::ostream& os = std::cout, bool flush = true) const final;
0211 
0212   /// Append a new object to the collection, and return this object.
0213   MutableBoundParameters create();
0214 
0215   /// Append a new object to the collection, and return this object.
0216   /// Initialized with the parameters given
0217   template <typename... Args>
0218   MutableBoundParameters create(Args&&... args);
0219 
0220   /// number of elements in the collection
0221   std::size_t size() const final;
0222 
0223   /// maximal number of elements in the collection
0224   std::size_t max_size() const final;
0225 
0226   /// Is the collection empty
0227   bool empty() const final;
0228 
0229   /// fully qualified type name
0230   const std::string_view getTypeName() const final { return typeName; }
0231   /// fully qualified type name of elements - with namespace
0232   const std::string_view getValueTypeName() const final {
0233     return valueTypeName;
0234   }
0235   /// fully qualified type name of stored POD elements - with namespace
0236   const std::string_view getDataTypeName() const final { return dataTypeName; }
0237   /// schema version
0238   podio::SchemaVersionT getSchemaVersion() const final;
0239 
0240   bool isSubsetCollection() const final { return m_isSubsetColl; }
0241 
0242   void setSubsetCollection(bool setSubset = true) final;
0243 
0244   /// Returns the const object of given index
0245   BoundParameters operator[](std::size_t index) const;
0246   /// Returns the object of a given index
0247   MutableBoundParameters operator[](std::size_t index);
0248   /// Returns the const object of given index
0249   BoundParameters at(std::size_t index) const;
0250   /// Returns the object of given index
0251   MutableBoundParameters at(std::size_t index);
0252 
0253   /// Append object to the collection
0254   void push_back(const MutableBoundParameters& object);
0255   /// Append an object to the (subset) collection
0256   void push_back(const BoundParameters& object);
0257 
0258   void prepareForWrite() const final;
0259   void prepareAfterRead() final;
0260   bool setReferences(
0261       const podio::ICollectionProvider* collectionProvider) final;
0262 
0263   /// Get the collection buffers for this collection
0264   podio::CollectionWriteBuffers getBuffers() final;
0265 
0266   void setID(uint32_t ID) final {
0267     m_collectionID = ID;
0268     if (!m_isSubsetColl) {
0269       std::for_each(m_storage.entries.begin(), m_storage.entries.end(),
0270                     [ID](BoundParametersObj* obj) {
0271                       obj->id = {obj->id.index, static_cast<uint32_t>(ID)};
0272                     });
0273     }
0274   }
0275 
0276   uint32_t getID() const final { return m_collectionID; }
0277 
0278   /// check if the collection has a valid ID
0279   bool hasID() const final {
0280     return getID() != static_cast<uint32_t>(podio::ObjectID::untracked) &&
0281            getID() != static_cast<uint32_t>(podio::ObjectID::invalid);
0282   }
0283 
0284   [[deprecated(
0285       "isValid will be removed, use hasID() if you want to check if it has an "
0286       "ID, otherwise assume the "
0287       "collection is valid")]]
0288   bool isValid() const final {
0289     return hasID();
0290   }
0291 
0292   size_t getDatamodelRegistryIndex() const final;
0293 
0294   // support for the iterator protocol
0295   iterator begin() { return iterator(0, &m_storage.entries); }
0296   const_iterator begin() const { return const_iterator(0, &m_storage.entries); }
0297   const_iterator cbegin() const { return begin(); }
0298   iterator end() {
0299     return iterator(m_storage.entries.size(), &m_storage.entries);
0300   }
0301   const_iterator end() const {
0302     return const_iterator(m_storage.entries.size(), &m_storage.entries);
0303   }
0304   const_iterator cend() const { return end(); }
0305   // reverse iterators
0306   reverse_iterator rbegin() { return reverse_iterator(end()); }
0307   const_reverse_iterator rbegin() const {
0308     return const_reverse_iterator(end());
0309   }
0310   const_reverse_iterator crbegin() const { return rbegin(); }
0311   reverse_iterator rend() { return reverse_iterator(begin()); }
0312   const_reverse_iterator rend() const {
0313     return const_reverse_iterator(begin());
0314   }
0315   const_reverse_iterator crend() const { return rend(); }
0316 
0317   std::vector<ActsPodioEdm::BoundParametersInfo> data(
0318       const size_t nElem = 0) const;
0319 
0320  private:
0321   // For setReferences, we need to give our own CollectionData access to our
0322   // private entries. Otherwise we would need to expose a public member function
0323   // that gives access to the Obj* which is definitely not what we want
0324   friend class BoundParametersCollectionData;
0325 
0326   mutable bool m_isPrepared{false};
0327   bool m_isSubsetColl{false};
0328   uint32_t m_collectionID{static_cast<uint32_t>(podio::ObjectID::untracked)};
0329   mutable std::unique_ptr<std::mutex> m_storageMtx{
0330       std::make_unique<std::mutex>()};
0331   mutable BoundParametersCollectionData m_storage{};
0332 };
0333 
0334 std::ostream& operator<<(std::ostream& o, const BoundParametersCollection& v);
0335 
0336 template <typename... Args>
0337 MutableBoundParameters BoundParametersCollection::create(Args&&... args) {
0338   if (m_isSubsetColl) {
0339     throw std::logic_error("Cannot create new elements on a subset collection");
0340   }
0341   auto obj = new BoundParametersObj(
0342       {static_cast<int>(m_storage.entries.size()), m_collectionID},
0343       {std::forward<Args>(args)...});
0344   m_storage.entries.push_back(obj);
0345 
0346   return MutableBoundParameters(podio::utils::MaybeSharedPtr(obj));
0347 }
0348 
0349 #if defined(__cpp_lib_containers_ranges)
0350 template <
0351     podio::detail::RangeConvertibleTo<BoundParametersCollection::value_type> R>
0352 BoundParametersCollection::BoundParametersCollection(std::from_range_t,
0353                                                      R&& range)
0354     : BoundParametersCollection() {
0355   setSubsetCollection(podio::detail::RangeOf<R, value_type>);
0356 
0357   for (auto&& elem : range) {
0358     push_back(std::forward<decltype(elem)>(elem));
0359   }
0360 }
0361 #endif
0362 
0363 template <
0364     podio::detail::RangeConvertibleTo<BoundParametersCollection::value_type> R>
0365 BoundParametersCollection BoundParametersCollection::from(R&& range) {
0366   BoundParametersCollection coll;
0367   if constexpr (podio::detail::RangeOf<R, value_type>) {
0368     coll.setSubsetCollection();
0369   }
0370 
0371   for (auto&& elem : range) {
0372     coll.push_back(std::forward<decltype(elem)>(elem));
0373   }
0374 
0375   return coll;
0376 }
0377 
0378 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0379 void to_json(nlohmann::json& j, const BoundParametersCollection& collection);
0380 #endif
0381 
0382 }  // namespace ActsPodioEdm
0383 
0384 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0385 // until it's fixed in ROOT. See
0386 // https://github.com/root-project/root/issues/18489 and
0387 // https://github.com/AIDASoft/podio/issues/770
0388 #if defined(__clang__)
0389 #pragma clang diagnostic push
0390 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0391 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0392 #pragma clang diagnostic ignored "-Wdeprecated"
0393 constexpr std::string_view ActsPodioEdm::BoundParametersCollection::typeName;
0394 constexpr std::string_view
0395     ActsPodioEdm::BoundParametersCollection::valueTypeName;
0396 constexpr std::string_view
0397     ActsPodioEdm::BoundParametersCollection::dataTypeName;
0398 #pragma clang diagnostic pop
0399 #elif defined(__GNUC__)
0400 #pragma GCC diagnostic push
0401 #pragma GCC diagnostic ignored "-Wdeprecated"
0402 constexpr std::string_view ActsPodioEdm::BoundParametersCollection::typeName;
0403 constexpr std::string_view
0404     ActsPodioEdm::BoundParametersCollection::valueTypeName;
0405 constexpr std::string_view
0406     ActsPodioEdm::BoundParametersCollection::dataTypeName;
0407 #pragma GCC diagnostic pop
0408 #endif
0409 
0410 #endif