MUSX Document Model
Loading...
Searching...
No Matches
ObjectPool.h
1/*
2 * Copyright (C) 2025, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include <string>
25#include <map>
26#include <unordered_map>
27#include <vector>
28#include <memory>
29#include <tuple>
30#include <variant>
31#include <stdexcept>
32#include <functional>
33#include <limits>
34
35#include "MusxInstance.h"
36
37#include "BaseClasses.h"
38#include "Others.h"
39#include "Details.h"
40#include "Entries.h"
41#include "ShapeDesigner.h"
42#include "SmartShape.h"
43#include "Staff.h"
44
45#ifndef DOXYGEN_SHOULD_IGNORE_THIS
46namespace bench {
49template<class> class PoolAccessor;
50}; // namespace bench
51#endif
52
53namespace musx {
54namespace dom {
55
59template <typename Pool, typename T>
60struct is_pool_type : std::false_type {}; // default: not valid
61
63template <typename Pool, typename T>
65
75template <typename ObjectBaseType>
77{
78 template <typename T>
79 std::shared_ptr<const T> bindWithPartId(std::shared_ptr<const T> obj, Cmper requestedPartId) const
80 {
81 if constexpr (std::is_base_of_v<OthersBase, T> || std::is_base_of_v<DetailsBase, T>) {
82 if (obj && obj->getRequestedPartId() != requestedPartId) {
83 return PartContextCloner::copyWithPartId(obj, requestedPartId);
84 }
85 }
86 return obj;
87 }
88
89public:
91 using ObjectPtr = std::shared_ptr<ObjectBaseType>;
93 struct ObjectKey {
94 std::string_view nodeId;
96 std::optional<Cmper> cmper1;
97 std::optional<Cmper> cmper2;
98 // Use `int` instead of `Inci` to work around GCC spurious -Wmaybe-uninitialized warning
99 std::optional<int> inci;
100
102 ObjectKey(std::string_view n,
103 Cmper p,
104 std::optional<Cmper> c1 = std::nullopt,
105 std::optional<Cmper> c2 = std::nullopt,
106 std::optional<int> i = std::nullopt) : nodeId(n), partId(p), cmper1(c1), cmper2(c2), inci(i)
107 {
108 }
109
111 bool operator<(const ObjectKey& other) const
112 {
113 if (nodeId != other.nodeId) {
114 return nodeId < other.nodeId;
115 }
116 if (partId != other.partId) {
117 return partId < other.partId;
118 }
119 if (cmper1 != other.cmper1) {
120 return cmper1 < other.cmper1;
121 }
122 if (cmper2 != other.cmper2) {
123 return cmper2 < other.cmper2;
124 }
125 return inci < other.inci;
126 }
127
129 std::string description() const
130 {
131 std::string result = std::string(nodeId) + " part " + std::to_string(partId);
132 if (cmper1) {
133 if (cmper2) {
134 result += " cmpers [" + std::to_string(cmper1.value()) + ", " + std::to_string(cmper2.value()) + "]";
135 } else {
136 result += " cmper " + std::to_string(cmper1.value());
137 }
138 }
139 if (inci) {
140 result += " inci " + std::to_string(inci.value());
141 }
142 return result;
143 }
144 };
145
147 virtual ~ObjectPool() = default;
148
155 void add(ObjectKey key, ObjectPtr object)
156 {
157 if (key.inci.has_value()) {
158 ObjectKey noInciKey = key;
159 noInciKey.inci = std::nullopt;
160 auto currentIncis = getArray<ObjectBaseType>(noInciKey, key.partId);
161 if (key.inci.value() != int(currentIncis.size())) {
162 MUSX_INTEGRITY_ERROR("Node " + std::string(key.nodeId) + " has inci " + std::to_string(key.inci.value()) + " that is out of sequence.");
163 }
164 }
165 auto shareModeIt = m_shareMode.find(key.nodeId);
166 auto [poolIt, emplaced] = m_pool.emplace(std::move(key), object);
167 if (!emplaced) {
168 MUSX_INTEGRITY_ERROR("Attempted to add same key more than once: " + poolIt->first.description());
169 }
170 if (shareModeIt == m_shareMode.end()) {
171 m_shareMode.emplace(poolIt->first.nodeId, object->getShareMode());
172 } else if (object->getShareMode() != shareModeIt->second && object->getShareMode() != Base::ShareMode::All) {
173 if (shareModeIt->second == Base::ShareMode::All) {
174 m_shareMode[poolIt->first.nodeId] = object->getShareMode();
175 } else {
176 MUSX_INTEGRITY_ERROR("Share mode for added " + std::string(poolIt->first.nodeId) + " object [" + std::to_string(int(object->getShareMode()))
177 + "] does not match previous [" + std::to_string(int(shareModeIt->second)) + "]");
178 }
179 }
180 }
181
195 template <typename T>
196 MusxInstanceList<T> getArray(const ObjectKey& key, Cmper requestedPartId) const
197 {
198 MusxInstanceList<T> result(m_document, requestedPartId);
199
200 auto rangeStart = m_pool.lower_bound(key);
201 auto rangeEnd = m_pool.upper_bound(
202 ObjectKey{
203 key.nodeId,
204 key.partId,
205 key.cmper1.value_or((std::numeric_limits<Cmper>::max)()),
206 key.cmper2.value_or((std::numeric_limits<Cmper>::max)()),
207 key.inci.value_or((std::numeric_limits<Inci>::max)())
208 }
209 );
210
211 for (auto it = rangeStart; it != rangeEnd; ++it) {
212 auto typedPtr = bindWithPartId<T>(std::dynamic_pointer_cast<T>(it->second), requestedPartId);
213 assert(typedPtr);
214 result.push_back(typedPtr);
215 }
216 return result;
217 }
218
231 template <typename T>
233 {
235 if (key.partId != SCORE_PARTID) {
236 auto it = m_shareMode.find(key.nodeId);
237 // If the nodeId is not found in m_shareMode, it means the document contains no instances,
238 // and every path will return an empty vector. We can safely ignore this case.
239 if (it != m_shareMode.end()) {
240 forShareMode = it->second;
241 }
242 if (forShareMode == Base::ShareMode::Partial) {
243 if constexpr (std::is_base_of_v<OthersBase, T>) {
244 if (!key.cmper1.has_value()) {
245 throw std::invalid_argument("Array searches on partially shared Others must supply a cmper.");
246 }
247 } else if constexpr (std::is_base_of_v<DetailsBase, T>) {
248 if (!key.cmper1.has_value() || !key.cmper2.has_value()) {
249 throw std::invalid_argument("Array searches on partially shared Details must supply both cmpers.");
250 }
251 }
252 }
253 }
254 auto keyResult = getArray<T>(key, key.partId);
255 if (!keyResult.empty() || key.partId == SCORE_PARTID || forShareMode == Base::ShareMode::None) {
256 return keyResult;
257 }
258 ObjectKey scoreKey(key);
259 scoreKey.partId = SCORE_PARTID;
260 return getArray<T>(scoreKey, key.partId);
261 }
262
274 template <typename T>
276 {
277 auto it = m_pool.find(key);
278 if (it == m_pool.end()) {
279 return nullptr;
280 }
281 auto typedPtr = std::dynamic_pointer_cast<T>(it->second);
282 assert(typedPtr); // There is a program bug if the pointer cast fails.
283 return typedPtr;
284 }
285
299 template <typename T>
301 {
302 if (auto partVersion = getSource<T>(key)) {
303 return partVersion;
304 }
305 if (key.partId == SCORE_PARTID) {
306 // if this is already the score version, there is nothing to return.
307 return nullptr;
308 } else {
309 // if this is for a part, do not search score for unshared types.
310 auto it = m_shareMode.find(key.nodeId);
311 if (it != m_shareMode.end() && it->second == Base::ShareMode::None) {
312 return nullptr;
313 }
314 }
315 ObjectKey scoreKey(key);
316 scoreKey.partId = SCORE_PARTID;
317 return getSource<T>(scoreKey);
318 }
319
333 template <typename T>
335 {
336 return bindWithPartId<T>(getEffectiveSourceForPart<T>(key), key.partId);
337 }
338
343 ObjectPool(const DocumentWeakPtr& document, const std::unordered_map<std::string_view, dom::Base::ShareMode>& knownShareModes = {})
344 : m_document(document), m_shareMode(knownShareModes) {}
345
346private:
347 DocumentWeakPtr m_document;
348 std::unordered_map<std::string_view, dom::Base::ShareMode> m_shareMode;
349
350 std::map<ObjectKey, ObjectPtr> m_pool;
351};
352
358{
360 friend class bench::PoolAccessor<OptionsPool>;
361
362public:
364 OptionsPool(const DocumentWeakPtr& document) : m_pool(document) {}
365
367 void add(std::string_view nodeName, const std::shared_ptr<OptionsBase>& instance)
368 {
369 const Base* basePtr = instance.get();
370 if (basePtr->getSourcePartId() != SCORE_PARTID) {
371 MUSX_INTEGRITY_ERROR("Options node " + std::string(nodeName) + " hase non-score part id [" + std::to_string(basePtr->getSourcePartId()) + "]");
372 }
373 m_pool.add({ nodeName, basePtr->getSourcePartId() }, instance);
374 }
375
377 template <typename T>
379 {
380 static_assert(is_pool_type_v<OptionsPool, T>, "Type T is not registered in OptionsPool");
381 return m_pool.getArray<T>({ T::XmlNodeName, SCORE_PARTID }, SCORE_PARTID);
382 }
383
385 template <typename T>
387 {
388 static_assert(is_pool_type_v<OptionsPool, T>, "Type T is not registered in OptionsPool");
389 return m_pool.getSource<T>({ T::XmlNodeName, SCORE_PARTID });
390 }
391};
393using OptionsPoolPtr = std::shared_ptr<OptionsPool>;
394
400{
402 friend class bench::PoolAccessor<OthersPool>;
403 friend MusxInstance<others::StaffComposite> others::StaffComposite::createCurrent(const DocumentPtr& document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition);
404
405 MusxInstance<others::Staff> getRawStaff(Cmper partId, StaffCmper staffId)
406 {
407 return m_pool.getEffectiveSourceForPart<others::Staff>({ std::string(others::Staff::XmlNodeName), partId, staffId, std::nullopt, std::nullopt });
408 }
409
410public:
425
427 void add(std::string_view nodeName, const std::shared_ptr<OthersBase>& instance)
428 { m_pool.add({nodeName, instance->getSourcePartId(), instance->getCmper(), std::nullopt, instance->getInci()}, instance); }
429
431 template <typename T>
432 MusxInstanceList<T> getArray(Cmper partId, std::optional<Cmper> cmper = std::nullopt) const
433 {
434 static_assert(is_pool_type_v<OthersPool, T>, "Type T is not registered in OthersPool");
435 return m_pool.getArrayForPart<T>({ T::XmlNodeName, partId, cmper });
436 }
437
439 template <typename T>
440 MusxInstance<T> get(Cmper partId, Cmper cmper, std::optional<Inci> inci = std::nullopt) const
441 {
442 static_assert(is_pool_type_v<OthersPool, T>, "Type T is not registered in OthersPool");
443 return m_pool.getEffectiveForPart<T>({ T::XmlNodeName, partId, cmper, std::nullopt, inci });
444 }
445};
447using OthersPoolPtr = std::shared_ptr<OthersPool>;
448
456{
458 friend class bench::PoolAccessor<DetailsPool>;
459
460public:
462 DetailsPool(const DocumentWeakPtr& document) : m_pool(document, {
466 // add other known sharemode none items as they are identified.
467 }) {}
468
470 void add(std::string_view nodeName, const std::shared_ptr<DetailsBase>& instance)
471 { m_pool.add({nodeName, instance->getSourcePartId(), instance->getCmper1(), instance->getCmper2(), instance->getInci()}, instance); }
472
474 template <typename T, typename = std::enable_if_t<is_pool_type_v<DetailsPool, T>>>
476 { return m_pool.template getArrayForPart<T>({ T::XmlNodeName, partId }); }
477
479 template <typename T, typename std::enable_if_t<!std::is_base_of_v<EntryDetailsBase, T>, int> = 0>
480 MusxInstanceList<T> getArray(Cmper partId, Cmper cmper1, std::optional<Cmper> cmper2 = std::nullopt) const
481 {
482 static_assert(is_pool_type_v<DetailsPool, T>, "Type T is not registered in DetailsPool");
483 return m_pool.template getArrayForPart<T>({ T::XmlNodeName, partId, cmper1, cmper2 });
484 }
485
487 template <typename T, typename std::enable_if_t<std::is_base_of_v<EntryDetailsBase, T>, int> = 0>
489 {
490 static_assert(is_pool_type_v<DetailsPool, T>, "Type T is not registered in DetailsPool");
491 return m_pool.template getArrayForPart<T>({ T::XmlNodeName, partId, Cmper(entnum >> 16), Cmper(entnum & 0xffff) });
492 }
493
495 template <typename T, typename std::enable_if_t<!std::is_base_of_v<EntryDetailsBase, T>, int> = 0>
496 MusxInstance<T> get(Cmper partId, Cmper cmper1, Cmper cmper2, std::optional<Inci> inci = std::nullopt) const
497 {
498 static_assert(is_pool_type_v<DetailsPool, T>, "Type T is not registered in DetailsPool");
499 return m_pool.getEffectiveForPart<T>({ T::XmlNodeName, partId, cmper1, cmper2, inci });
500 }
501
503 template <typename T, typename std::enable_if_t<std::is_base_of_v<EntryDetailsBase, T>, int> = 0>
504 MusxInstance<T> get(Cmper partId, EntryNumber entnum, std::optional<Inci> inci = std::nullopt) const
505 {
506 static_assert(is_pool_type_v<DetailsPool, T>, "Type T is not registered in DetailsPool");
507 return m_pool.getEffectiveForPart<T>({ T::XmlNodeName, partId, Cmper(entnum >> 16), Cmper(entnum & 0xffff), inci });
508 }
509
516 template <typename T, typename std::enable_if_t<std::is_base_of_v<NoteDetailsBase, T>, int> = 0>
517 MusxInstance<T> getForNote(const NoteInfoPtr& noteInfo, const std::optional<Cmper>& forPartId = std::nullopt)
518 {
519 static_assert(is_pool_type_v<DetailsPool, T>, "Type T is not registered in DetailsPool");
520 auto details = getArray<T>(
521 forPartId.value_or(noteInfo.getEntryInfo().getFrame()->getRequestedPartId()),
522 noteInfo.getEntryInfo()->getEntry()->getEntryNumber()
523 );
524 for (const auto& detail : details) {
525 if (detail->getNoteId() == noteInfo->getNoteId()) {
526 return detail;
527 }
528 }
529 return nullptr;
530 }
531};
532
534using DetailsPoolPtr = std::shared_ptr<DetailsPool>;
535
537class EntryPool // uses different implementation than other pools for more efficient access
538{
539public:
541 EntryPool(const DocumentWeakPtr& document) : m_document(document) {}
542
544 void add(EntryNumber entryNumber, const std::shared_ptr<Entry>& instance)
545 {
546 auto [it, emplaced] = m_pool.emplace(entryNumber, instance);
547 if (!emplaced) {
548 MUSX_INTEGRITY_ERROR("Entry number " + std::to_string(entryNumber) + " added twice.");
549 }
550 }
551
554 {
555 const auto it = m_pool.find(entryNumber);
556 if (it == m_pool.end()) {
557 return nullptr;
558 }
559 return it->second;
560 }
561
562private:
563 DocumentWeakPtr m_document;
564 std::unordered_map<EntryNumber, std::shared_ptr<Entry>> m_pool;
565};
567using EntryPoolPtr = std::shared_ptr<EntryPool>;
568
571{
573 friend class bench::PoolAccessor<TextsPool>;
574
575public:
577 TextsPool(const DocumentWeakPtr& document) : m_pool(document) {}
578
580 void add(std::string_view nodeName, const std::shared_ptr<TextsBase>& instance)
581 {
582 const Base* basePtr = instance.get();
583 if (basePtr->getSourcePartId() != SCORE_PARTID) {
584 MUSX_INTEGRITY_ERROR("Texts node " + std::string(nodeName) + " hase non-score part id [" + std::to_string(basePtr->getSourcePartId()) + "]");
585 }
586 m_pool.add({ nodeName, basePtr->getSourcePartId(), instance->getTextNumber() }, instance);
587 }
588
590 template <typename T>
591 MusxInstanceList<T> getArray(std::optional<Cmper> cmper = std::nullopt) const
592 {
593 static_assert(is_pool_type_v<TextsPool, T>, "Type T is not registered in TextsPool");
594 return m_pool.getArray<T>({ T::XmlNodeName, SCORE_PARTID, cmper }, SCORE_PARTID);
595 }
596
598 template <typename T>
600 {
601 static_assert(is_pool_type_v<TextsPool, T>, "Type T is not registered in TextsPool");
602 return m_pool.getSource<T>({ T::XmlNodeName, SCORE_PARTID, cmper, std::nullopt, std::nullopt });
603 }
604};
606using TextsPoolPtr = std::shared_ptr<TextsPool>;
607
608} // namespace dom
609} // namespace musx
Base class to enforce polymorphism across all DOM classes.
Definition BaseClasses.h:83
Cmper getSourcePartId() const
Gets the source partId for this instance. If an instance is fully shared with the score,...
Definition BaseClasses.h:124
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:91
A pool that manages collections of DetailsBase objects, organized by XML node names and Cmper values.
Definition ObjectPool.h:456
MusxInstanceList< T > getArray(Cmper partId) const
version of ObjectPool::getArray for getting all of them
Definition ObjectPool.h:475
MusxInstance< T > getForNote(const NoteInfoPtr &noteInfo, const std::optional< Cmper > &forPartId=std::nullopt)
Returns the detail for a particular note.
Definition ObjectPool.h:517
DetailsPool(const DocumentWeakPtr &document)
Constructor.
Definition ObjectPool.h:462
MusxInstance< T > get(Cmper partId, EntryNumber entnum, std::optional< Inci > inci=std::nullopt) const
Get a single EntryDetailsBase item out of the pool.
Definition ObjectPool.h:504
MusxInstanceList< T > getArray(Cmper partId, EntryNumber entnum) const
EntryDetailsPool version of ObjectPool::getArray.
Definition ObjectPool.h:488
MusxInstance< T > get(Cmper partId, Cmper cmper1, Cmper cmper2, std::optional< Inci > inci=std::nullopt) const
Get a single DetailsBase item out of the pool (not EntryDetailsBase)
Definition ObjectPool.h:496
void add(std::string_view nodeName, const std::shared_ptr< DetailsBase > &instance)
DetailsPool version of ObjectPool::add.
Definition ObjectPool.h:470
MusxInstanceList< T > getArray(Cmper partId, Cmper cmper1, std::optional< Cmper > cmper2=std::nullopt) const
DetailsPool version of ObjectPool::getArray.
Definition ObjectPool.h:480
std::shared_ptr< const EntryFrame > getFrame() const
Returns the frame.
Definition Entries.h:421
Entry pool.
Definition ObjectPool.h:538
EntryPool(const DocumentWeakPtr &document)
Constructor function.
Definition ObjectPool.h:541
void add(EntryNumber entryNumber, const std::shared_ptr< Entry > &instance)
Add an entry to the EntryPool. (Used by the factory.)
Definition ObjectPool.h:544
MusxInstance< Entry > get(EntryNumber entryNumber) const
Get an entry from the EntryPool.
Definition ObjectPool.h:553
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:96
Wraps an EntryInfo instance and a note index.
Definition Entries.h:861
EntryInfoPtr getEntryInfo() const
Gets the entry info for this note.
Definition Entries.h:896
A pool that manages collections of OthersBase objects, organized by XML node names and Cmper values.
Definition ObjectPool.h:77
ObjectPool(const DocumentWeakPtr &document, const std::unordered_map< std::string_view, dom::Base::ShareMode > &knownShareModes={})
Constructs the object pool.
Definition ObjectPool.h:343
virtual ~ObjectPool()=default
virtual destructor
MusxInstance< T > getSource(const ObjectKey &key) const
Retrieves the first (and usually only) object of a specific type from the pool.
Definition ObjectPool.h:275
MusxInstanceList< T > getArrayForPart(const ObjectKey &key) const
Retrieves a vector of objects of a specific type from the pool.
Definition ObjectPool.h:232
MusxInstanceList< T > getArray(const ObjectKey &key, Cmper requestedPartId) const
Retrieves a vector of objects of a specific type from the pool.
Definition ObjectPool.h:196
MusxInstance< T > getEffectiveSourceForPart(const ObjectKey &key) const
Retrieves the first (and usually only) object of a specific type from the pool for a part.
Definition ObjectPool.h:300
void add(ObjectKey key, ObjectPtr object)
Adds an ObjectBaseType object to the pool.
Definition ObjectPool.h:155
MusxInstance< T > getEffectiveForPart(const ObjectKey &key) const
Retrieves the first (and usually only) object of a specific type from the pool for a part.
Definition ObjectPool.h:334
std::shared_ptr< ObjectBaseType > ObjectPtr
shared pointer to ObjectBaseType
Definition ObjectPool.h:91
A pool that manages collections of OptionsBase objects that have no Cmper value.
Definition ObjectPool.h:358
void add(std::string_view nodeName, const std::shared_ptr< OptionsBase > &instance)
Scalar version of ObjectPool::add.
Definition ObjectPool.h:367
MusxInstance< T > get() const
Get a single item out of the pool.
Definition ObjectPool.h:386
MusxInstanceList< T > getArray() const
Scalar version of ObjectPool::getArray.
Definition ObjectPool.h:378
OptionsPool(const DocumentWeakPtr &document)
Constructor function.
Definition ObjectPool.h:364
A pool that manages collections of OthersBase objects.
Definition ObjectPool.h:400
MusxInstance< T > get(Cmper partId, Cmper cmper, std::optional< Inci > inci=std::nullopt) const
Get a single item out of the pool.
Definition ObjectPool.h:440
void add(std::string_view nodeName, const std::shared_ptr< OthersBase > &instance)
OthersPool version of ObjectPool::add.
Definition ObjectPool.h:427
OthersPool(const DocumentWeakPtr &document)
Constructor.
Definition ObjectPool.h:412
MusxInstanceList< T > getArray(Cmper partId, std::optional< Cmper > cmper=std::nullopt) const
OthersPool version of ObjectPool::getArray.
Definition ObjectPool.h:432
Text pool.
Definition ObjectPool.h:571
MusxInstanceList< T > getArray(std::optional< Cmper > cmper=std::nullopt) const
Texts version of ObjectPool::getArray.
Definition ObjectPool.h:591
TextsPool(const DocumentWeakPtr &document)
Constructor fundtion.
Definition ObjectPool.h:577
MusxInstance< T > get(Cmper cmper) const
Get a single item out of the pool.
Definition ObjectPool.h:599
void add(std::string_view nodeName, const std::shared_ptr< TextsBase > &instance)
Texts version of ObjectPool::add.
Definition ObjectPool.h:580
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition SmartShape.h:619
static constexpr std::string_view XmlNodeName
XML node name for this type.
Definition Details.h:1597
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Details.h:1672
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:371
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:1508
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:1490
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:1656
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:1882
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:1937
static MusxInstance< StaffComposite > createCurrent(const DocumentPtr &document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition)
Calculates the current staff at the specified metric position by applying all relevant staff styles,...
Definition Staff.cpp:793
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:575
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:2444
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:2473
Represents the definition of a Finale staff.
Definition Staff.h:48
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:425
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Others.h:2498
std::shared_ptr< OthersPool > OthersPoolPtr
Shared OthersPool pointer.
Definition ObjectPool.h:447
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:35
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:79
constexpr bool is_pool_type_v
Value shortcut for is_pool_type.
Definition ObjectPool.h:64
std::shared_ptr< DetailsPool > DetailsPoolPtr
Shared DetailsPool pointer.
Definition ObjectPool.h:534
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
std::shared_ptr< TextsPool > TextsPoolPtr
Shared OthersPool pointer.
Definition ObjectPool.h:606
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:61
std::shared_ptr< OptionsPool > OptionsPoolPtr
Shared OptionsPool pointer.
Definition ObjectPool.h:393
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition BaseClasses.h:57
int32_t EntryNumber
Entry identifier.
Definition Fundamentals.h:69
std::shared_ptr< Document > DocumentPtr
Shared Document pointer.
Definition BaseClasses.h:55
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
std::shared_ptr< EntryPool > EntryPoolPtr
Shared EntryPool pointer.
Definition ObjectPool.h:567
object model for musx file (enigmaxml)
Definition BaseClasses.h:36
key type for storing in pool
Definition ObjectPool.h:93
std::optional< Cmper > cmper2
optional cmper2 for Details.
Definition ObjectPool.h:97
ObjectKey(std::string_view n, Cmper p, std::optional< Cmper > c1=std::nullopt, std::optional< Cmper > c2=std::nullopt, std::optional< int > i=std::nullopt)
explicit constructor for optional parameters
Definition ObjectPool.h:102
std::optional< Cmper > cmper1
optional cmper1 for Others, Texts, Details.
Definition ObjectPool.h:96
Cmper partId
the part this item is associated with (or 0 for score).
Definition ObjectPool.h:95
bool operator<(const ObjectKey &other) const
comparison operator for std::map
Definition ObjectPool.h:111
std::string_view nodeId
the identifier for this node. usually the XML node name.
Definition ObjectPool.h:94
std::optional< int > inci
optional inci for multi-inci classes
Definition ObjectPool.h:99
std::string description() const
provides a description of the key for diagnostic purposes
Definition ObjectPool.h:129
Type trait to determine if a class in a given pool.
Definition ObjectPool.h:60