msl 1.3.0
Loading...
Searching...
No Matches
DictionaryItem.h
Go to the documentation of this file.
1// Copyright 2026 Julien Lamy, ICube, Université de Strasbourg-CNRS.
2// Part of msl, distributed under the terms of the MIT license.
3
4#ifndef _7746111a_39fb_49d2_821f_a9cfa7a4bacf
5#define _7746111a_39fb_49d2_821f_a9cfa7a4bacf
6
7#include <string>
8
9#include "msl/Dictionary.h"
11
12namespace msl
13{
14
20template<typename T>
22{
23public:
25 DictionaryItem() = default;
26
29
31 DictionaryItem(graph::AbstractNode::Pointer node, std::string const & key="");
32
34 DictionaryItem(graph::AbstractNode * node, std::string const & key="");
35
36 DictionaryItem(DictionaryItem<T> const &) = default;
38 DictionaryItem<T> & operator=(DictionaryItem<T> const &) = default;
39 DictionaryItem<T> & operator=(DictionaryItem<T> &&) = default;
40 ~DictionaryItem() = default;
41
44
47
49 std::string key() const;
50
52 DictionaryItem<T> & setKey(std::string const & key);
53
55 T const & operator()() const;
56
59
60private:
61 Dictionary::Pointer & _dictionary;
62 std::string _key;
63};
64
65}
66
67#include "DictionaryItem.txx"
68
69#endif // _7746111a_39fb_49d2_821f_a9cfa7a4bacf
std::string key() const
Return the dictionary key.
T const & operator()() const
Return the value.
DictionaryItem(graph::AbstractNode::Pointer node, std::string const &key="")
Create an accessor from a node registry and an optional key.
DictionaryItem< T > & setKey(std::string const &key)
Set the dictionary key.
T & operator()()
Return the value.
DictionaryItem(graph::AbstractNode *node, std::string const &key="")
Create an accessor from a node registry and an optional key.
DictionaryItem()=default
Uninitialized accessor.
Dictionary::Pointer dictionary() const
Return the source dictionary.
DictionaryItem< T > & setDictionary(Dictionary::Pointer dictionary)
Set the source dictionary.
DictionaryItem(Dictionary::Pointer &dictionary, std::string const &key="")
Create an accessor from a dictionary and an optional key.
std::shared_ptr< Dictionary > Pointer
Reference-counted pointer to Dictionary.
Definition Dictionary.h:34
Base class for all graph nodes.
Definition AbstractNode.h:28
std::shared_ptr< AbstractNode > Pointer
Reference-counted pointer to AbstractNode.
Definition AbstractNode.h:30
Top-level namespace of the msl library.
Definition acceleration.h:17