Warning, file /include/JANA/examples/PodioDatamodel/MutableExampleCluster.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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(const double energy);
0047
0048
0049 MutableExampleCluster(const MutableExampleCluster& other) = default;
0050
0051
0052 MutableExampleCluster& operator=(MutableExampleCluster other) &;
0053 MutableExampleCluster& operator=(MutableExampleCluster other) && = delete;
0054
0055
0056
0057 MutableExampleCluster clone(bool cloneRelations=true) const;
0058
0059
0060 ~MutableExampleCluster() = default;
0061
0062
0063 public:
0064
0065
0066 double energy() const;
0067
0068
0069
0070
0071 void energy(const double energy);
0072
0073 double& energy();
0074
0075
0076
0077 void addHits(const ExampleHit&);
0078 std::size_t Hits_size() const;
0079 ExampleHit Hits(std::size_t) const;
0080 std::vector<ExampleHit>::const_iterator Hits_begin() const;
0081 std::vector<ExampleHit>::const_iterator Hits_end() const;
0082 podio::RelationRange<ExampleHit> Hits() const;
0083 void addClusters(const ExampleCluster&);
0084 std::size_t Clusters_size() const;
0085 ExampleCluster Clusters(std::size_t) const;
0086 std::vector<ExampleCluster>::const_iterator Clusters_begin() const;
0087 std::vector<ExampleCluster>::const_iterator Clusters_end() const;
0088 podio::RelationRange<ExampleCluster> Clusters() const;
0089
0090
0091
0092
0093 bool isAvailable() const;
0094
0095 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ExampleClusterObj>{nullptr}; }
0096
0097 bool operator==(const MutableExampleCluster& other) const { return m_obj == other.m_obj; }
0098 bool operator==(const ExampleCluster& other) const;
0099
0100 bool operator!=(const MutableExampleCluster& other) const { return !(*this == other); }
0101 bool operator!=(const ExampleCluster& other) const { return !(*this == other); }
0102
0103
0104 bool operator<(const MutableExampleCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0105
0106 podio::ObjectID id() const { return getObjectID(); }
0107
0108 const podio::ObjectID getObjectID() const;
0109
0110 friend std::hash<MutableExampleCluster>;
0111
0112 friend void swap(MutableExampleCluster& a, MutableExampleCluster& b) {
0113 using std::swap;
0114 swap(a.m_obj, b.m_obj);
0115 }
0116
0117 private:
0118
0119 explicit MutableExampleCluster(podio::utils::MaybeSharedPtr<ExampleClusterObj> obj);
0120
0121 podio::utils::MaybeSharedPtr<ExampleClusterObj> m_obj{nullptr};
0122 };
0123
0124 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0125 void to_json(nlohmann::json& j, const MutableExampleCluster& value);
0126 #endif
0127
0128
0129
0130
0131
0132 template<>
0133 struct std::hash<MutableExampleCluster> {
0134 std::size_t operator()(const MutableExampleCluster& obj) const {
0135 return std::hash<ExampleClusterObj*>{}(obj.m_obj.get());
0136 }
0137 };
0138
0139
0140 #endif