MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::DetailsPool Class Reference

A pool that manages collections of DetailsBase objects, organized by XML node names and Cmper values. More...

#include <ObjectPool.h>

Public Member Functions

 DetailsPool (const DocumentWeakPtr &document)
 Constructor.
 
void add (std::string_view nodeName, std::shared_ptr< DetailsBase > instance)
 DetailsPool version of ObjectPool::add.
 
void integrityCheckAll () const
 Validates every details object. Called by document construction finalization.
 
template<typename T , typename = std::enable_if_t<is_pool_type_v<DetailsPool, T>>>
MusxInstanceList< T > getArray (Cmper partId) const
 version of ObjectPool::getArray for getting all of them
 
template<typename T , typename std::enable_if_t<!std::is_base_of_v< EntryDetailsBase, T >, int > = 0>
MusxInstanceList< T > getArray (Cmper partId, Cmper cmper1, std::optional< Cmper > cmper2=std::nullopt) const
 DetailsPool version of ObjectPool::getArray.
 
template<typename T , typename std::enable_if_t< std::is_base_of_v< EntryDetailsBase, T >, int > = 0>
MusxInstanceList< T > getArray (Cmper partId, EntryNumber entnum) const
 EntryDetailsPool version of ObjectPool::getArray.
 
template<typename T , typename std::enable_if_t<!std::is_base_of_v< EntryDetailsBase, T >, int > = 0>
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)
 
template<typename T >
std::vector< MusxInstance< T > > getAllSources () const
 Returns every physically stored source object of type T.
 
template<typename T >
std::vector< MusxInstance< T > > getAllSources (Cmper cmper1, Cmper cmper2, std::optional< Inci > inci=std::nullopt) const
 Returns physically stored source objects for one comparator pair and optional incidence.
 
template<typename T , typename std::enable_if_t< std::is_base_of_v< EntryDetailsBase, T >, int > = 0>
MusxInstance< T > get (Cmper partId, EntryNumber entnum, std::optional< Inci > inci=std::nullopt) const
 Get a single EntryDetailsBase item out of the pool.
 
template<typename T , typename std::enable_if_t< std::is_base_of_v< NoteDetailsBase, T >, int > = 0>
MusxInstance< T > getForNote (const NoteInfoPtr &noteInfo, const std::optional< Cmper > &forPartId=std::nullopt)
 Returns the detail for a particular note.
 

Friends

class bench::PoolAccessor< DetailsPool >
 

Detailed Description

A pool that manages collections of DetailsBase objects, organized by XML node names and Cmper values.

Examples of OneCmperBase classes are OthersBase and TextsBase.

Member Function Documentation

◆ getAllSources()

template<typename T >
std::vector< MusxInstance< T > > musx::dom::DetailsPool::getAllSources ( Cmper  cmper1,
Cmper  cmper2,
std::optional< Inci inci = std::nullopt 
) const
inline

Returns physically stored source objects for one comparator pair and optional incidence.

Parameters
cmper1The first comparator to select.
cmper2The second comparator to select.
inciIf present, restricts the result to this incidence.
Returns
Source objects in part and incidence order, without sharing fallbacks or copies.

◆ getForNote()

template<typename T , typename std::enable_if_t< std::is_base_of_v< NoteDetailsBase, T >, int > = 0>
MusxInstance< T > musx::dom::DetailsPool::getForNote ( const NoteInfoPtr noteInfo,
const std::optional< Cmper > &  forPartId = std::nullopt 
)
inline

Returns the detail for a particular note.

Template Parameters
TThe type to retrieve (must be derived from NoteDetailsBase)
enable_if_tEnforces T as a base of NoteDetailsBase
Parameters
noteInfoThe note for which to get the note detail
forPartIdThe part for which to get the note detail. If omitted, the noteInfo part is used.
Returns
The instance associated with noteInfo or nullptr if none.