msl 1.3.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
23namespace graph
24{
25
28{
29public:
31
32 virtual ~AbstractNode() = default;
33
35 virtual NLSStatus prepare(
36 MrProt & protocol, SeqLim & limits, SeqExpo & exports) = 0;
37
39 virtual NLSStatus run(
40 MrProt & protocol, SeqLim & limits, SeqExpo & exports) = 0;
41
44
47
50
58 virtual uint64_t duration() const = 0;
59
61 virtual MrProtocolData::SeqExpoRFInfo rfInfo() const = 0;
62
64 template<typename T>
65 T const & get(std::string const & key) const
66 {
67 return this->_registry->get<T>(key);
68 }
69
71 template<typename T>
72 T & get(std::string const & key)
73 {
74 return this->_registry->get<T>(key);
75 }
76
78 boost::typeindex::type_info const & type(std::string const & key) const;
79
80protected:
81 Dictionary::Pointer _registry;
82
84 AbstractNode(AbstractNode const &) = default;
85 AbstractNode(AbstractNode &&) = default;
86 AbstractNode & operator=(AbstractNode const &) = default;
87 AbstractNode & operator=(AbstractNode &&) = default;
88};
89
91template<typename T, typename U>
92std::shared_ptr<T> NodeCast(std::shared_ptr<U> const & p)
93{
94 return std::dynamic_pointer_cast<T>(p);
95}
96
97}
98
99}
100
101#endif // _c98760d2_f8bf_472c_9671_9d8322e26b0e
#define DECLARE_POINTERS(name)
Declare pointer type aliases.
Definition Dictionary.h:18
std::shared_ptr< Dictionary > Pointer
Reference-counted pointer to Dictionary
Definition Dictionary.h:39
std::shared_ptr< Dictionary const > ConstPointer
Reference-counted constant pointer to Dictionary
Definition Dictionary.h:39
Base class for all graph nodes.
Definition AbstractNode.h:28
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:72
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.
Dictionary::ConstPointer registry() const
Return the registry.
T const & get(std::string const &key) const
Return an object from the dictionary.
Definition AbstractNode.h:65
Dictionary::Pointer registry()
Return the registry.
virtual ~AbstractNode()=default
virtual AbstractNode & setRegistry(Dictionary::Pointer registry)
Set the registry.
virtual NLSStatus prepare(MrProt &protocol, SeqLim &limits, SeqExpo &exports)=0
Prepare the node.
virtual MrProtocolData::SeqExpoRFInfo rfInfo() const =0
Return the RF information for SAR computation, requires preparation.
std::shared_ptr< T > NodeCast(std::shared_ptr< U > const &p)
Up- or down-cast node pointers.
Definition AbstractNode.h:92
Top-level namespace of the msl library.
Definition acceleration.h:17