msl 1.1.0
 
Loading...
Searching...
No Matches
AbstractNode.h
Go to the documentation of this file.
1// Copyright 2024-2025 Julien Lamy, ICube, Université de Strasbourg-CNRS.
2// Part of msl, distributed under the terms of the MIT license.
3
4#ifndef _c98760d2_f8bf_472c_9671_9d8322e26b0e
5#define _c98760d2_f8bf_472c_9671_9d8322e26b0e
6
7#include <cstddef>
8#include <memory>
9
10#include <MrMeasSrv/MeasUtils/NLSStatus.h>
11
12#include <MrProtSrv/Domain/CoreNative/SeqLim.h>
13#include <MrProtSrv/Domain/MrProtData/MrProt/MrProt.h>
14#include <MrProtSrv/Domain/MrProtData/MrProt/SeqIF/SeqExpo.h>
15#include <MrProtSrv/Domain/MrProtData/MrProt/SeqIF/SeqExpoRFBlockInfo.h>
16
17#include "msl/Dictionary.h"
18
19namespace msl
20{
21
22namespace graph
23{
24
27{
28public:
30
31 virtual ~AbstractNode() = default;
32
34 virtual NLSStatus prepare(
35 MrProt & protocol, SeqLim & limits, SeqExpo & exports) = 0;
36
38 virtual NLSStatus run(
39 MrProt & protocol, SeqLim & limits, SeqExpo & exports) = 0;
40
42 Dictionary::ConstPointer registry() const;
43
45 Dictionary::Pointer registry();
46
48 virtual AbstractNode & setRegistry(Dictionary::Pointer registry);
49
57 virtual uint64_t duration() const = 0;
58
60 virtual MrProtocolData::SeqExpoRFInfo rfInfo() const = 0;
61
63 template<typename T>
64 T const & get(std::string const & key) const
65 {
66 return this->_registry->get<T>(key);
67 }
68
70 template<typename T>
71 T & get(std::string const & key)
72 {
73 return this->_registry->get<T>(key);
74 }
75
77 boost::typeindex::type_info const & type(std::string const & key) const;
78
79protected:
80 Dictionary::Pointer _registry;
81
82 AbstractNode(Dictionary::Pointer registry={});
83 AbstractNode(AbstractNode const &) = default;
85 AbstractNode & operator=(AbstractNode const &) = default;
87};
88
89template<typename T, typename U>
90std::shared_ptr<T> NodeCast(std::shared_ptr<U> const & p)
91{
92 return std::dynamic_pointer_cast<T>(p);
93}
94
95}
96
97}
98
99#endif // _c98760d2_f8bf_472c_9671_9d8322e26b0e
virtual NLSStatus run(MrProt &protocol, SeqLim &limits, SeqExpo &exports)=0
Run the node.
T & get(std::string const &key)
Return an object from the dictionary.
Definition AbstractNode.h:71
boost::typeindex::type_info const & type(std::string const &key) const
Return the type of an object in the dictionary.
virtual uint64_t duration() const =0
Return the duration in microseconds, requires preparation.
AbstractNode & operator=(AbstractNode const &)=default
Dictionary::ConstPointer registry() const
Return the registry.
Dictionary::Pointer _registry
Definition AbstractNode.h:80
T const & get(std::string const &key) const
Return an object from the dictionary.
Definition AbstractNode.h:64
AbstractNode(AbstractNode const &)=default
Dictionary::Pointer registry()
Return the registry.
DECLARE_POINTERS(AbstractNode)
virtual ~AbstractNode()=default
virtual AbstractNode & setRegistry(Dictionary::Pointer registry)
Set the registry.
AbstractNode & operator=(AbstractNode &&)=default
AbstractNode(AbstractNode &&)=default
virtual NLSStatus prepare(MrProt &protocol, SeqLim &limits, SeqExpo &exports)=0
Prepare the node.
AbstractNode(Dictionary::Pointer registry={})
virtual MrProtocolData::SeqExpoRFInfo rfInfo() const =0
Return the RF information for SAR computation, requires preparation.
Definition AbstractNode.h:23
std::shared_ptr< T > NodeCast(std::shared_ptr< U > const &p)
Definition AbstractNode.h:90
Definition acceleration.h:17