2#include <Curve/Palette/CurvePoint.hpp>
4#include <score/model/IdentifiedObject.hpp>
5#include <score/plugins/UuidKey.hpp>
6#include <score/serialization/DataStreamFwd.hpp>
7#include <score/tools/IdentifierGeneration.hpp>
9#include <ossia/detail/algorithms.hpp>
10#include <ossia/detail/hash_map.hpp>
74 Id<SegmentModel> i, Curve::Point s, Curve::Point e, OptionalId<SegmentModel> prev,
80 , previous(std::move(prev))
81 , following(std::move(foll))
83 , specificSegmentData(std::move(data))
89 Curve::Point start, end;
90 OptionalId<SegmentModel> previous, following;
93 QVariant specificSegmentData;
95 double x()
const {
return start.x(); }
102 return lhs.x() < rhs.x();
105inline bool operator<=(
const SegmentData& lhs,
const SegmentData& rhs)
107 return lhs.x() <= rhs.x();
111template <
typename Container>
115 auto end = ids.end();
119 }
while(ids.find(
id) != end);
128 auto end = ids.end();
132 }
while(ossia::find_if(ids, [&](
const auto& other) {
return other.id == id; }) != end);
141 auto end = ids.end();
145 }
while(ossia::find_if(ids, [&](
const auto& other) {
return other == id; }) != end);
156 m_taken.reserve(taken.size());
157 for(
const auto& s : taken)
158 m_taken.insert(s.id.val());
166 if(m_taken.insert(v).second)
172 ossia::hash_set<int32_t> m_taken;
179 std::size_t operator()(
const Id<SegmentModel>&
id)
const {
return id.val(); }
192#define CURVE_SEGMENT_FACTORY_METADATA(Export, Model, Uuid) \
194 struct Export Metadata<ConcreteKey_k, Model> \
196 static const auto& get() \
198 static const UuidKey<Curve::SegmentFactory> k{Uuid}; \
203#define CURVE_SEGMENT_METADATA(Export, Model, Uuid, ObjectKey, PrettyName, Category) \
204 OBJECTKEY_METADATA(Export, Model, ObjectKey) \
205 CURVE_SEGMENT_FACTORY_METADATA(Export, Model, Uuid) \
207 struct Export Metadata<PrettyName_k, Model> \
209 static auto get() { return QObject::tr(PrettyName); } \
212 struct Export Metadata<Curve::Category_k, Model> \
214 static auto get() { return QObject::tr(Category); } \
Metadata to categorize objects: curves, audio, etc.
Definition CurveSegmentData.hpp:177
Fresh ids for new segments: O(N) to set up, then O(1) each.
Definition CurveSegmentData.hpp:152
Definition UuidKey.hpp:345
The id_base_t class.
Definition Identifier.hpp:59
Utilities and base classes for 1D curves.
Definition FocusDispatcher.hpp:12
Definition CurveSegmentData.hpp:66
static int32_t getRandomId()
getNextId
Definition IdentifierGeneration.cpp:38