|
MUSX Document Model
|
A pool that manages collections of OthersBase objects, organized by XML node names and Cmper values.
More...
#include <ObjectPool.h>
Classes | |
| struct | ObjectKey |
| key type for storing in pool More... | |
Public Types | |
| using | ObjectPtr = std::shared_ptr< ObjectBaseType > |
shared pointer to ObjectBaseType | |
Public Member Functions | |
| virtual | ~ObjectPool ()=default |
| virtual destructor | |
| void | add (ObjectKey key, ObjectPtr object) |
Adds an ObjectBaseType object to the pool. | |
| template<typename T > | |
| MusxInstanceList< T > | getArray (const ObjectKey &key, Cmper requestedPartId) const |
| Retrieves a vector of objects of a specific type from the pool. | |
| template<typename T > | |
| MusxInstanceList< T > | getArrayForPart (const ObjectKey &key) const |
| Retrieves a vector of objects of a specific type from the pool. | |
| template<typename T > | |
| MusxInstance< T > | getSource (const ObjectKey &key) const |
| Retrieves the first (and usually only) object of a specific type from the pool. | |
| template<typename T > | |
| MusxInstance< T > | getEffectiveSourceForPart (const ObjectKey &key) const |
| Retrieves the first (and usually only) object of a specific type from the pool for a part. | |
| template<typename T > | |
| MusxInstance< T > | getEffectiveForPart (const ObjectKey &key) const |
| Retrieves the first (and usually only) object of a specific type from the pool for a part. | |
| ObjectPool (const DocumentWeakPtr &document, const std::unordered_map< std::string_view, dom::Base::ShareMode > &knownShareModes={}) | |
| Constructs the object pool. | |
A pool that manages collections of OthersBase objects, organized by XML node names and Cmper values.
This class provides functionality to store and retrieve objects derived from a Base object type, It supports dynamic retrieval of objects cast to their specific derived types.
| ObjectBaseType | the base type for the objects in the pool |
|
inline |
Constructs the object pool.
| document | THe document for this pool. |
| knownShareModes | Optional parameter that specifies known share modes for certain elements. These can be particurly important for Base::ShareMode::None because there may be no parts containing them. |
|
inline |
Adds an ObjectBaseType object to the pool.
| key | The key with which to store the object |
| object | A shared pointer to the ObjectBaseType object to add. |
|
inline |
Retrieves a vector of objects of a specific type from the pool.
This function may be used to
| T | The derived type of ObjectBaseType to retrieve. |
| key | The key value used to filter the objects. |
| requestedPartId | The part for which this array was requested. |
T.
|
inline |
Retrieves a vector of objects of a specific type from the pool.
This function may be used to
| T | The derived type of ObjectBaseType to retrieve. |
| key | The key value used to filter the objects. |
T.
|
inline |
Retrieves the first (and usually only) object of a specific type from the pool for a part.
If no part item exists, returns the score item.
If the requestedPartId differs from the sourcePartId, a copy of the source is returned with the requestedPartId set correctly.
| T | The derived type of OthersBase to retrieve. Must have a constexpr static std::string_view XmlNodeName member. |
| key | The key value used to filter the objects. |
|
inline |
Retrieves the first (and usually only) object of a specific type from the pool for a part.
If no part item exists, returns the score item.
| T | The derived type of OthersBase to retrieve. Must have a constexpr static std::string_view XmlNodeName member. |
| key | The key value used to filter the objects. |
|
inline |
Retrieves the first (and usually only) object of a specific type from the pool.
| T | The derived type of OthersBase to retrieve. Must have a constexpr static std::string_view XmlNodeName member. |
| key | The key value used to filter the objects. |