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