 |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Go to the documentation of this file.
8 #ifndef LLU_CONTAINERS_DATALIST_H
9 #define LLU_CONTAINERS_DATALIST_H
11 #include <initializer_list>
13 #include <string_view>
26 namespace NodeType = Argument::Typed;
67 DataList(std::initializer_list<value_type> initList);
74 DataList(std::initializer_list<std::pair<std::string, value_type>> initList);
164 std::vector<std::string>
names()
const {
181 if constexpr (!std::is_same_v<T, LLU::NodeType::Any>) {
183 if (node.type() != Argument::WrapperIndex<T>) {
184 ErrorManager::throwException(ErrorName::DLInvalidNodeType);
192 for (
auto&& elem : initList) {
199 for (
auto&& elem : initList) {
200 push_back(elem.first, std::move(elem.second));
221 template<
typename T,
typename IteratorType>
222 struct IteratorAdaptor {
223 using iterator = IteratorType;
225 explicit IteratorAdaptor(
DataList<T>& d) : dl {d} {};
227 iterator begin()
const {
228 return iterator {dl.
begin()};
232 return iterator {dl.begin()};
235 iterator end()
const {
236 return iterator {dl.end()};
240 return iterator {dl.end()};
254 struct ValueAdaptor : Detail::IteratorAdaptor<T, NodeValueIterator<T>> {
268 struct NameAdaptor : Detail::IteratorAdaptor<T, NodeNameIterator> {
278 #endif // LLU_CONTAINERS_DATALIST_H
const_iterator cend() const
Proxy iterator past the last element of the DataStore.
Definition: Generic/DataStore.hpp:104
std::vector< std::string > names() const
Return a vector of DataList node names.
Definition: DataList.h:164
void push_back(value_type nodeData)
Add new node to the DataList.
Definition: DataList.h:210
MContainer specialization for DataStore, provides basic list interface for the underlying raw DataSto...
Definition: Generic/DataStore.hpp:23
const_iterator cbegin() const
Get constant iterator at the beginning of underlying data.
Definition: DataList.h:93
Main namespace of LibraryLink Utilities.
Definition: Queue.h:13
MContainer is an abstract class template for generic containers. Only specializations shall be used.
Definition: Base.hpp:245
MContainer< MArgumentType::DataStore > GenericDataList
MContainer specialization for DataStore is called GenericDataList.
Definition: Generic/DataStore.hpp:17
void push_back(T nodeValue)
Add new nameless node at the end of the underlying DataStore.
Definition: Generic/DataStore.hpp:209
NameAdaptor(DataList< T > &d)
Create NameAdaptor to an existing DataList.
Definition: DataList.h:273
Iterator adaptor for DataList that makes begin() and end() return proxy iterators for node names.
Definition: DataList.h:268
Definition and implementation of generic DataStore wrapper.
ValueAdaptor(DataList< T > &d)
Create ValueAdaptor to an existing DataList.
Definition: DataList.h:259
Simple proxy input iterator that goes over a DataStore and returns node names when dereferenced.
Definition: DataList.hpp:87
name_iterator nameBegin() const
Get proxy iterator over node names (keys) pointing to the first node.
Definition: DataList.h:128
iterator begin() const
Get iterator at the beginning of underlying data.
Definition: DataList.h:86
@ Library
The library (LLU) is responsible for managing the container's memory. Used for Manual passing and con...
value_iterator valueEnd() const
Get proxy iterator over node values pointing past the last node.
Definition: DataList.h:121
DataList(GenericDataList gds)
Create DataList wrapping around an existing GenericDataList.
Definition: DataList.h:180
iterator end() const
Get iterator after the end of underlying data.
Definition: DataList.h:100
Definition of the ErrorManager class responsible for error registration and throwing.
T value_type
Value of a node is of type T.
Definition: DataList.h:51
Top-level wrapper over LibraryLink's DataStore.
Definition: DataList.h:36
NodeIterator< T > iterator
Default DataList iterator is NodeIterator<T>
Definition: DataList.h:39
Special iterators for DataLists. Iteration over keys, values, reversed iteration.
std::vector< DataNode< T > > toVector() const
Return a vector of DataList nodes.
Definition: DataList.h:172
std::vector< T > values() const
Return a vector of DataList node values.
Definition: DataList.h:156
name_iterator nameEnd() const
Get proxy iterator over node names (keys) pointing past the last node.
Definition: DataList.h:135
const_iterator cend() const
Get constant reverse iterator after the end of underlying data.
Definition: DataList.h:107
DataList clone() const
Clone this DataList, performing a deep copy of the underlying DataStore.
Definition: DataList.h:205
const_iterator cbegin() const
Proxy iterator to the first element of the DataStore.
Definition: Generic/DataStore.hpp:99
DataStoreNode front() const
Get the first node of the DataStore.
Definition: Generic/DataStore.hpp:75
Template class and utilities to work with MArgument in type-safe manner.
Simple proxy input iterator that goes over a DataStore and returns proxy DataNodes when dereferenced.
Definition: DataList.hpp:46
Simple proxy input iterator that goes over a DataStore and returns node values of requested type when...
Definition: DataList.hpp:138
value_iterator valueBegin() const
Get proxy iterator over node values pointing to the first node.
Definition: DataList.h:114
Iterator adaptor for DataList that makes begin() and end() return proxy iterators for node values.
Definition: DataList.h:254