msl 1.3.0
Loading...
Searching...
No Matches
Loop.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 _1f315bc4_b23e_4276_929a_4e7c5eb861b0
5#define _1f315bc4_b23e_4276_929a_4e7c5eb861b0
6
7#include <MrMeasSrv/MeasUtils/NLSStatus.h>
8#include <MrMeasSrv/SeqIF/libRT/sSLICE_POS.h>
9
10#include <MrProtSrv/Domain/CoreNative/SeqLim.h>
11#include <MrProtSrv/Domain/MrProtData/MrProt/MrProt.h>
12#include <MrProtSrv/Domain/MrProtData/MrProt/SeqIF/SeqExpo.h>
13#include <MrProtSrv/Domain/MrProtData/MrProt/SeqIF/SeqExpoRFBlockInfo.h>
14
15#include "msl/Counter.h"
16#include "msl/Dictionary.h"
17#include "msl/graph/Node.h"
18
19namespace msl
20{
21namespace graph
22{
23
30class Loop: public Node
31{
32public:
34
36 static Pointer New(
37 std::string const & counter, Dictionary::Pointer registry={});
38
40 template<typename T>
41 static Pointer New(
42 std::string const & counter, T const & child,
44 {
45 return Pointer(new Loop(counter, child, registry));
46 }
47
49 static Pointer New(
50 std::string const & counter, Siblings const & siblings,
52
53 virtual ~Loop() = default;
54
56 NLSStatus prepare(
57 MrProt & protocol, SeqLim & limits, SeqExpo & exports) override;
58
60 NLSStatus run(
61 MrProt & protocol, SeqLim & limits, SeqExpo & exports) override;
62
67 uint64_t duration() const override;
68
73 MrProtocolData::SeqExpoRFInfo rfInfo() const override;
74
75private:
76 std::string _counter;
77
78 Loop(std::string const & counter, Dictionary::Pointer registry={});
79
80 template<typename T>
81 Loop(
82 std::string const & counter, T const & child,
84 : Node(child, registry), _counter(counter)
85 {
86 // Nothing else
87 }
88
89 Loop(
90 std::string const & counter, Siblings const & siblings,
92
93 Loop(Loop const &) = default;
94 Loop(Loop &&) = default;
95 Loop & operator=(Loop const &) = default;
96 Loop & operator=(Loop &&) = default;
97};
98
99}
100}
101
102#endif // _1f315bc4_b23e_4276_929a_4e7c5eb861b0
#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
Dictionary::ConstPointer registry() const
Return the registry.
Node encapsulating a loop structure, using a Counter from the registry.
Definition Loop.h:31
virtual ~Loop()=default
uint64_t duration() const override
Return the sum of the duration of the children times the maximum value of the counter.
MrProtocolData::SeqExpoRFInfo rfInfo() const override
Return the sum of the RF information of the children times the maximum value of the counter.
static Pointer New(std::string const &counter, T const &child, Dictionary::Pointer registry={})
Create a loop with a single child.
Definition Loop.h:41
std::shared_ptr< Loop > Pointer
Reference-counted pointer to Loop
Definition Loop.h:33
NLSStatus run(MrProt &protocol, SeqLim &limits, SeqExpo &exports) override
Reset the counter and run the children for each index of the counter.
static Pointer New(std::string const &counter, Dictionary::Pointer registry={})
Create a loop with no child.
NLSStatus prepare(MrProt &protocol, SeqLim &limits, SeqExpo &exports) override
Reset the counter and prepare the children.
static Pointer New(std::string const &counter, Siblings const &siblings, Dictionary::Pointer registry={})
Create a loop with multiple children.
Container node, prepare and run its children sequentially.
Definition Node.h:28
std::vector< AbstractNode::Pointer > Siblings
Child container.
Definition Node.h:33
AbstractNode::ConstPointer child(std::size_t index) const
Return a child at given position.
Top-level namespace of the msl library.
Definition acceleration.h:17