File indexing completed on 2025-11-04 10:15:49
0001 
0002 
0003 #ifndef PODIODATAMODEL_ExampleCluster_H
0004 #define PODIODATAMODEL_ExampleCluster_H
0005 
0006 #include "PodioDatamodel/ExampleClusterObj.h"
0007 
0008 #include "PodioDatamodel/ExampleHit.h"
0009 #include "podio/RelationRange.h"
0010 #include <vector>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.h"
0014 
0015 #include <ostream>
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 
0023 class ExampleClusterCollection;
0024 
0025 
0026 namespace podio::detail {
0027 
0028 OrderKey getOrderKey(const ::ExampleCluster& obj);
0029 };
0030 
0031 
0032 class MutableExampleCluster;
0033 class ExampleClusterCollection;
0034 class ExampleClusterCollectionData;
0035 
0036 
0037 
0038 
0039 
0040 class ExampleCluster {
0041 
0042   friend class MutableExampleCluster;
0043   friend class ExampleClusterCollection;
0044   friend class ExampleClusterCollectionData;
0045   friend class ExampleClusterCollectionIterator;
0046   friend podio::detail::OrderKey podio::detail::getOrderKey(const ExampleCluster & obj);
0047 
0048 public:
0049   using mutable_type = MutableExampleCluster;
0050   using collection_type = ExampleClusterCollection;
0051 
0052   
0053   ExampleCluster();
0054 
0055   
0056   ExampleCluster(const double energy);
0057 
0058   
0059   ExampleCluster(const ExampleCluster& other) = default;
0060 
0061   
0062   ExampleCluster& operator=(ExampleCluster other) &; 
0063   ExampleCluster& operator=(ExampleCluster other) && = delete; 
0064 
0065   
0066   
0067   MutableExampleCluster clone(bool cloneRelations=true) const;
0068 
0069   
0070   ~ExampleCluster() = default;
0071 
0072   
0073   ExampleCluster(const MutableExampleCluster& other);
0074 
0075   static ExampleCluster makeEmpty();
0076 
0077 public:
0078 
0079   static constexpr std::string_view typeName = "ExampleCluster";
0080 
0081   
0082   double energy() const;
0083 
0084 
0085 
0086   std::size_t Hits_size() const;
0087   ExampleHit Hits(std::size_t) const;
0088   std::vector<ExampleHit>::const_iterator Hits_begin() const;
0089   std::vector<ExampleHit>::const_iterator Hits_end() const;
0090   podio::RelationRange<ExampleHit> Hits() const;
0091   std::size_t Clusters_size() const;
0092   ExampleCluster Clusters(std::size_t) const;
0093   std::vector<ExampleCluster>::const_iterator Clusters_begin() const;
0094   std::vector<ExampleCluster>::const_iterator Clusters_end() const;
0095   podio::RelationRange<ExampleCluster> Clusters() const;
0096 
0097 
0098   
0099   bool isAvailable() const;
0100   
0101   void unlink() { m_obj = podio::utils::MaybeSharedPtr<ExampleClusterObj>{nullptr}; }
0102 
0103   bool operator==(const ExampleCluster& other) const { return m_obj == other.m_obj; }
0104   bool operator==(const MutableExampleCluster& other) const;
0105 
0106   bool operator!=(const ExampleCluster& other) const { return !(*this == other); }
0107   bool operator!=(const MutableExampleCluster& other) const { return !(*this == other); }
0108 
0109   
0110   bool operator<(const ExampleCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0111 
0112   podio::ObjectID id() const { return getObjectID(); }
0113 
0114   const podio::ObjectID getObjectID() const;
0115 
0116   friend std::hash<ExampleCluster>;
0117 
0118   friend void swap(ExampleCluster& a, ExampleCluster& b) {
0119     using std::swap;
0120     swap(a.m_obj, b.m_obj); 
0121   }
0122 
0123 private:
0124   
0125   explicit ExampleCluster(podio::utils::MaybeSharedPtr<ExampleClusterObj> obj);
0126   ExampleCluster(ExampleClusterObj* obj);
0127 
0128   podio::utils::MaybeSharedPtr<ExampleClusterObj> m_obj{nullptr};
0129 };
0130 
0131 std::ostream& operator<<(std::ostream& o, const ExampleCluster& value);
0132 
0133 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0134 void to_json(nlohmann::json& j, const ExampleCluster& value);
0135 #endif
0136 
0137 
0138 
0139 
0140 
0141 template<>
0142 struct std::hash<ExampleCluster> {
0143   std::size_t operator()(const ExampleCluster& obj) const {
0144     return std::hash<ExampleClusterObj*>{}(obj.m_obj.get());
0145   }
0146 };
0147 
0148 
0149 
0150 
0151 
0152 #if defined(__clang__)
0153 #pragma clang diagnostic push
0154 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0155 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0156 #pragma clang diagnostic ignored "-Wdeprecated"
0157 constexpr std::string_view ExampleCluster::typeName;
0158 #pragma clang diagnostic pop
0159 #elif defined(__GNUC__)
0160 #pragma GCC diagnostic push
0161 #pragma GCC diagnostic ignored "-Wdeprecated"
0162 constexpr std::string_view ExampleCluster::typeName;
0163 #pragma GCC diagnostic pop
0164 #endif
0165 
0166 #endif