File indexing completed on 2025-07-11 08:35:35
0001
0002
0003 #ifndef PODIODATAMODEL_MutableExampleCluster_H
0004 #define PODIODATAMODEL_MutableExampleCluster_H
0005
0006 #include "PodioDatamodel/ExampleClusterObj.h"
0007
0008 #include "PodioDatamodel/ExampleCluster.h"
0009
0010 #include "PodioDatamodel/ExampleHit.h"
0011 #include "podio/RelationRange.h"
0012 #include <vector>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
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
0027
0028
0029
0030
0031
0032 class MutableExampleCluster {
0033
0034 friend class ExampleClusterCollection;
0035 friend class ExampleClusterMutableCollectionIterator;
0036 friend class ExampleCluster;
0037
0038 public:
0039 using object_type = ExampleCluster;
0040 using collection_type = ExampleClusterCollection;
0041
0042
0043 MutableExampleCluster();
0044
0045
0046 MutableExampleCluster(double energy);
0047
0048
0049 MutableExampleCluster(const MutableExampleCluster& other) = default;
0050
0051
0052 MutableExampleCluster& operator=(MutableExampleCluster other);
0053
0054
0055
0056 MutableExampleCluster clone(bool cloneRelations=true) const;
0057
0058
0059 ~MutableExampleCluster() = default;
0060
0061
0062 public:
0063
0064
0065 double energy() const;
0066
0067
0068
0069
0070 void energy(double value);
0071
0072 double& energy();
0073
0074
0075
0076 void addHits(const ExampleHit&);
0077 std::size_t Hits_size() const;
0078 ExampleHit Hits(std::size_t) const;
0079 std::vector<ExampleHit>::const_iterator Hits_begin() const;
0080 std::vector<ExampleHit>::const_iterator Hits_end() const;
0081 podio::RelationRange<ExampleHit> Hits() const;
0082 void addClusters(const ExampleCluster&);
0083 std::size_t Clusters_size() const;
0084 ExampleCluster Clusters(std::size_t) const;
0085 std::vector<ExampleCluster>::const_iterator Clusters_begin() const;
0086 std::vector<ExampleCluster>::const_iterator Clusters_end() const;
0087 podio::RelationRange<ExampleCluster> Clusters() const;
0088
0089
0090
0091
0092 bool isAvailable() const;
0093
0094 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ExampleClusterObj>{nullptr}; }
0095
0096 bool operator==(const MutableExampleCluster& other) const { return m_obj == other.m_obj; }
0097 bool operator==(const ExampleCluster& other) const;
0098
0099 bool operator!=(const MutableExampleCluster& other) const { return !(*this == other); }
0100 bool operator!=(const ExampleCluster& other) const { return !(*this == other); }
0101
0102
0103 bool operator<(const MutableExampleCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0104
0105 podio::ObjectID id() const { return getObjectID(); }
0106
0107 const podio::ObjectID getObjectID() const;
0108
0109 friend void swap(MutableExampleCluster& a, MutableExampleCluster& b) {
0110 using std::swap;
0111 swap(a.m_obj, b.m_obj);
0112 }
0113
0114 private:
0115
0116 explicit MutableExampleCluster(podio::utils::MaybeSharedPtr<ExampleClusterObj> obj);
0117
0118 podio::utils::MaybeSharedPtr<ExampleClusterObj> m_obj{nullptr};
0119 };
0120
0121 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0122 void to_json(nlohmann::json& j, const MutableExampleCluster& value);
0123 #endif
0124
0125
0126
0127
0128 #endif