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>

+ Inheritance diagram for musx::dom::DetailsPool:

Public Member Functions

 DetailsPool ()
 Constructor.
 
void add (const std::string &nodeName, const std::shared_ptr< DetailsBase > &instance)
 DetailsPool version of ObjectPool::add.
 
template<typename T >
std::vector< std::shared_ptr< 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>
std::vector< std::shared_ptr< 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>
std::vector< std::shared_ptr< 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>
std::shared_ptr< T > get (Cmper partId, Cmper cmper1, Cmper cmper2, std::optional< Inci > inci=std::nullopt) const
 DetailsPool version of ObjectPool::get.
 
template<typename T , typename std::enable_if_t< std::is_base_of_v< EntryDetailsBase, T >, int > = 0>
std::shared_ptr< T > get (Cmper partId, EntryNumber entnum, std::optional< Inci > inci=std::nullopt) const
 EntryDetailsPool version of ObjectPool::get.
 
template<typename T , typename std::enable_if_t< std::is_base_of_v< NoteDetailsBase, T >, int > = 0>
std::shared_ptr< T > getForNote (const NoteInfoPtr &noteInfo, const std::optional< Cmper > &forPartId=std::nullopt)
 Returns the detail for a particular note.
 

Additional Inherited Members

- Protected Types inherited from musx::dom::ObjectPool< DetailsBase >
using ObjectPtr = std::shared_ptr< DetailsBase >
 shared pointer to ObjectBaseType
 
- Protected Member Functions inherited from musx::dom::ObjectPool< DetailsBase >
 ObjectPool (const std::unordered_map< std::string, dom::Base::ShareMode > &knownShareModes={})
 Constructs the object pool.
 
virtual ~ObjectPool ()=default
 virtual destructor
 
void add (const ObjectKey &key, ObjectPtr object)
 Adds an OthersBase object to the pool.
 
std::vector< std::shared_ptr< T > > getArray (const ObjectKey &key) const
 Retrieves a vector of objects of a specific type from the pool.
 
std::vector< std::shared_ptr< T > > getArrayForPart (const ObjectKey &key) const
 Retrieves a vector of objects of a specific type from the pool.
 
std::shared_ptr< T > get (const ObjectKey &key) const
 Retrieves the first (and usually only) object of a specific type from the pool.
 
std::shared_ptr< T > getEffectiveForPart (const ObjectKey &key) const
 Retrieves the first (and usually only) object of a specific type from the pool for a part.
 

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

◆ getForNote()

template<typename T , typename std::enable_if_t< std::is_base_of_v< NoteDetailsBase, T >, int > = 0>
std::shared_ptr< 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.