![]() |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Top-level wrapper over LibraryLink's DataStore.
Designed to be strongly typed i.e. to wrap only homogeneous DataStores but by passing NodeType::Any as template parameter it will work with arbitrary DataStores.
| T | - type of data stored in each node, see the NodeType namespace for possible node types |
Inheritance diagram for LLU::DataList< T >:
Collaboration diagram for LLU::DataList< T >:#include <DataList.h>
Public Types | |
| using | iterator = NodeIterator< T > |
| Default DataList iterator is NodeIterator<T> More... | |
| using | const_iterator = iterator |
All DataList iterators are proxy iterators so in a way they are all const, therefore const_iterator is the same as iterator. More... | |
| using | value_iterator = NodeValueIterator< T > |
| To iterate over node values use a proxy iterator NodeValueIterator<T> More... | |
| using | name_iterator = NodeNameIterator |
| To iterate over node names use a proxy iterator NodeNameIterator. More... | |
| using | value_type = T |
| Value of a node is of type T. More... | |
| using | Container = Argument::CType< Type > |
| The type of underlying LibraryLink structure (e.g. MTensor, MImage, etc.) will be called "Container". More... | |
Public Member Functions | |
| DataList (GenericDataList gds) | |
| Create DataList wrapping around an existing GenericDataList. More... | |
| DataList (std::initializer_list< value_type > initList) | |
| Create DataList from list of values. More... | |
| DataList (std::initializer_list< std::pair< std::string, value_type >> initList) | |
| Create DataList from list of keys and corresponding values. More... | |
| DataList | clone () const |
| Clone this DataList, performing a deep copy of the underlying DataStore. More... | |
| iterator | begin () const |
| Get iterator at the beginning of underlying data. More... | |
| const_iterator | cbegin () const |
| Get constant iterator at the beginning of underlying data. More... | |
| iterator | end () const |
| Get iterator after the end of underlying data. More... | |
| const_iterator | cend () const |
| Get constant reverse iterator after the end of underlying data. More... | |
| value_iterator | valueBegin () const |
| Get proxy iterator over node values pointing to the first node. More... | |
| value_iterator | valueEnd () const |
| Get proxy iterator over node values pointing past the last node. More... | |
| name_iterator | nameBegin () const |
| Get proxy iterator over node names (keys) pointing to the first node. More... | |
| name_iterator | nameEnd () const |
| Get proxy iterator over node names (keys) pointing past the last node. More... | |
| void | push_back (value_type nodeData) |
| Add new node to the DataList. More... | |
| void | push_back (std::string_view name, value_type nodeData) |
| Add new named node to the DataList. More... | |
| std::vector< T > | values () const |
| Return a vector of DataList node values. More... | |
| std::vector< std::string > | names () const |
| Return a vector of DataList node names. More... | |
| std::vector< DataNode< T > > | toVector () const |
| Return a vector of DataList nodes. More... | |
| mint | length () const |
| Get the length of the DataStore. More... | |
| DataStoreNode | front () const |
| Get the first node of the DataStore. More... | |
| DataStoreNode | back () const |
| Get the last node of the DataStore. More... | |
| template<MArgumentType Type, EnableIfUnambiguousWrapperType< Type > = 0> | |
| void | push_back (Argument::WrapperType< Type > nodeValue) |
| Add new nameless node at the end of the underlying DataStore. More... | |
| template<MArgumentType Type, EnableIfUnambiguousWrapperType< Type > = 0> | |
| void | push_back (std::string_view name, Argument::WrapperType< Type > nodeValue) |
| Add new named node at the end of the underlying DataStore. More... | |
| template<MArgumentType Type> | |
| void | push_back (Argument::CType< Type > nodeValue) |
| Add new nameless node at the end of the underlying DataStore. More... | |
| template<MArgumentType Type> | |
| void | push_back (std::string_view name, Argument::CType< Type > nodeValue) |
| Add new named node at the end of the underlying DataStore. More... | |
| void | push_back (const Argument::Typed::Any &node) |
| Add new nameless node at the end of the underlying DataStore. More... | |
| void | push_back (std::string_view name, const Argument::Typed::Any &node) |
| Add new named node at the end of the underlying DataStore. More... | |
| Container | getContainer () const noexcept |
| Get internal container. More... | |
| Container | abandonContainer () const noexcept |
| Give a handle to internal container and stop owning it. More... | |
| mint | shareCount () const noexcept |
| Return share count of internal container, if present and 0 otherwise. More... | |
| void | pass (MArgument &res) const |
| Pass the internal container as result of a LibraryLink function. More... | |
| Ownership | getOwner () const noexcept |
| Get ownership information. More... | |
Protected Member Functions | |
| Container | cloneContainer () const |
| Clone the raw container, if it's present. More... | |
| void | disown () const noexcept |
| Disown internal container if present. More... | |
| void | free () const noexcept |
| Free internal container if present. More... | |
| void | reset (Container newCont, Ownership newOwnerMode=Ownership::Library) noexcept |
| Set a new internal container safely disposing of the old one. More... | |
| using LLU::DataList< T >::const_iterator = iterator |
All DataList iterators are proxy iterators so in a way they are all const, therefore const_iterator is the same as iterator.
|
inherited |
The type of underlying LibraryLink structure (e.g. MTensor, MImage, etc.) will be called "Container".
| using LLU::DataList< T >::iterator = NodeIterator<T> |
Default DataList iterator is NodeIterator<T>
| using LLU::DataList< T >::name_iterator = NodeNameIterator |
To iterate over node names use a proxy iterator NodeNameIterator.
| using LLU::DataList< T >::value_iterator = NodeValueIterator<T> |
To iterate over node values use a proxy iterator NodeValueIterator<T>
| using LLU::DataList< T >::value_type = T |
Value of a node is of type T.
|
explicit |
Create DataList wrapping around an existing GenericDataList.
| gds | - GenericDataList |
| LLU::DataList< T >::DataList | ( | std::initializer_list< value_type > | initList | ) |
| LLU::DataList< T >::DataList | ( | std::initializer_list< std::pair< std::string, value_type >> | initList | ) |
|
inlinenoexceptinherited |
Give a handle to internal container and stop owning it.
Should be used with caution as it may potentially result with resource leak.
|
inlineinherited |
Get the last node of the DataStore.
|
inline |
Get iterator at the beginning of underlying data.
|
inline |
Get constant iterator at the beginning of underlying data.
|
inline |
Get constant reverse iterator after the end of underlying data.
| DataList< T > LLU::DataList< T >::clone |
Clone this DataList, performing a deep copy of the underlying DataStore.
|
inlineprotectedinherited |
Clone the raw container, if it's present.
|
inlineprotectednoexceptinherited |
Disown internal container if present.
|
inline |
Get iterator after the end of underlying data.
|
inlineprotectednoexceptinherited |
Free internal container if present.
|
inlineinherited |
Get the first node of the DataStore.
|
inlinenoexceptinherited |
Get internal container.
|
inlinenoexceptinherited |
Get ownership information.
|
inlineinherited |
Get the length of the DataStore.
|
inline |
Get proxy iterator over node names (keys) pointing to the first node.
|
inline |
Get proxy iterator over node names (keys) pointing past the last node.
|
inline |
Return a vector of DataList node names.
|
inlineinherited |
Pass the internal container as result of a LibraryLink function.
| res | - MArgument which will hold internal container of this MContainerBase |
|
inlineinherited |
Add new nameless node at the end of the underlying DataStore.
| Type | - type of the node data expressed via the MArgumentType enum |
| nodeValue | - a value to be pushed as the new node, must be of a primitive LibraryLink type |
|
inlineinherited |
Add new nameless node at the end of the underlying DataStore.
| Type | - type of the node data expressed via the MArgumentType enum |
| nodeValue | - a value to be pushed as the new node, must be a wrapper over a primitive LibraryLink type |
|
inherited |
Add new nameless node at the end of the underlying DataStore.
| node | - a value to be pushed as the new node |
|
inlineinherited |
Add new named node at the end of the underlying DataStore.
| Type | - type of the node data expressed via the MArgumentType enum |
| name | - name of the new node, names in a DataStore do not have to be unique |
| nodeValue | - a value to be pushed as the new node, must be of a primitive LibraryLink type |
|
inlineinherited |
Add new named node at the end of the underlying DataStore.
| Type | - type of the node data expressed via the MArgumentType enum |
| name | - name of the new node, names in a DataStore do not have to be unique |
| nodeValue | - a value to be pushed as the new node, must be a wrapper over a primitive LibraryLink type |
|
inherited |
Add new named node at the end of the underlying DataStore.
| name | - name of the new node, names in a DataStore do not have to be unique |
| node | - a value to be pushed as the new node, |
| void LLU::DataList< T >::push_back | ( | std::string_view | name, |
| value_type | nodeData | ||
| ) |
Add new named node to the DataList.
| name | - name for the new node |
| nodeData | - actual data to store in the new node |
| void LLU::DataList< T >::push_back | ( | value_type | nodeData | ) |
Add new node to the DataList.
| nodeData | - actual data to store in the new node |
|
inlineprotectednoexceptinherited |
Set a new internal container safely disposing of the old one.
| newCont | - new internal container |
| newOwnerMode | - owner of the new container |
|
inlinenoexceptinherited |
Return share count of internal container, if present and 0 otherwise.
|
inline |
Return a vector of DataList nodes.
|
inline |
Get proxy iterator over node values pointing to the first node.
|
inline |
Get proxy iterator over node values pointing past the last node.
|
inline |
Return a vector of DataList node values.