JEMRIS 2.9.1
open-source MRI simulations
Loading...
Searching...
No Matches
SequenceTree.h
Go to the documentation of this file.
1
5/*
6 * JEMRIS Copyright (C)
7 * 2006-2023 Tony Stoecker
8 * 2007-2018 Kaveh Vahedipour
9 * 2009-2019 Daniel Pflugfelder
10 *
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26
27#ifndef SEQUENCETREE_H_
28#define SEQUENCETREE_H_
29
31#include "XMLIO.h"
32
33
34using std::map;
35
36using std::string;
37
38// Class declarations to avoid including Module.h and thus a rereferenciation.
39class Module;
40class ConcatSequence;
42
44
46
47 friend class Container;
48
49 public:
50
51 SequenceTree();
61 void Initialize (string seqFile);
62
70 DOMNodeList* GetChildNodes (DOMNode* node);
71
78 DOMNode* GetParentNode (DOMNode* node);
79
85 DOMNamedNodeMap* GetAttributes (DOMNode* node);
86
92 Module* GetModule (DOMNode* node);
93
99 unsigned int AddModule (string name);
100
111 int RunTree (DOMNode* node, void* ptr, unsigned int (*fun) (void*, DOMNode*) , int depth = 0);
112
118 unsigned int Populate (bool verbose = true);
119
128 static unsigned int CreateModule(void* ptr, DOMNode* node);
129
135 Module* GetParent (DOMNode* node);
136
142 vector<Module*> GetChildren (DOMNode* node);
143
149 vector<Module*> GetChildrenDynamic (DOMNode* node);
150
157 Module* GetChild (DOMNode* node, unsigned int position);
158
165
172
181 Module* GetModuleByAttributeValue (string name, string value);
182
190 static vector<string> Tokenize(const string& str, const string& delimiters = ",");
191
197 DOMDocument* GetDOMDocument(){return m_dom_doc;};
198
205
211 map<DOMNode*, Module*>* GetModuleMap(){return &m_Modules;};
212
218 int GetDepth(){return m_depth;};
219
225 string GetSequenceDirectory();
226
233 string GetSequenceFilename();
234
238 void SerializeModules(string xml_file);
239
244
248 bool GetStatus () { return m_state; }
249
250
251
252 private:
253 bool m_state;
257 DOMDocument* m_dom_doc;
259 XMLIO* m_xio;
260 map<DOMNode*, Module*> m_Modules;
261 string m_seq_file;
263 map<DOMNode*, vector<Module*>> m_node2children;
264
265};
266
267#endif /*SEQUENCETREE_H_*/
Implementation of JEMRIS ModulePrototypeFactory.
Implementation of JEMRIS XMLIO.
Concat sequence prototype.
Definition: ConcatSequence.h:48
Prototype of a SequenceContainer.
Definition: ContainerSequence.h:38
Prototype of a Container.
Definition: Container.h:39
Module factory.
Definition: ModulePrototypeFactory.h:35
Module super class! ABC for all Objects in the sequence framework.
Definition: Module.h:41
World parameters provide the parametric data of the sequence.
Definition: Parameters.h:37
Tree representation of the sequence.
Definition: SequenceTree.h:45
ModulePrototypeFactory * GetMPF()
Definition: SequenceTree.h:204
DOMNamedNodeMap * GetAttributes(DOMNode *node)
Definition: SequenceTree.cpp:111
Module * GetModule(DOMNode *node)
Definition: SequenceTree.cpp:116
Parameters * GetParameters()
Definition: SequenceTree.h:243
int RunTree(DOMNode *node, void *ptr, unsigned int(*fun)(void *, DOMNode *), int depth=0)
Definition: SequenceTree.cpp:202
string m_seq_file
Definition: SequenceTree.h:261
DOMNodeList * GetChildNodes(DOMNode *node)
Definition: SequenceTree.cpp:104
DOMDocument * m_dom_doc
Definition: SequenceTree.h:257
bool GetStatus()
Get my status of parsing XML.
Definition: SequenceTree.h:248
vector< Module * > GetChildren(DOMNode *node)
Definition: SequenceTree.cpp:274
SequenceTree()
Definition: SequenceTree.cpp:38
unsigned int Populate(bool verbose=true)
Definition: SequenceTree.cpp:136
vector< Module * > GetChildrenDynamic(DOMNode *node)
Definition: SequenceTree.cpp:304
void SerializeModules(string xml_file)
Definition: SequenceTree.cpp:361
string GetSequenceFilename()
Definition: SequenceTree.cpp:92
static vector< string > Tokenize(const string &str, const string &delimiters=",")
Module * GetParent(DOMNode *node)
Definition: SequenceTree.cpp:262
Parameters * m_parameters
Definition: SequenceTree.h:255
ConcatSequence * m_root_seq
Definition: SequenceTree.h:256
ConcatSequence * GetRootConcatSequence()
Definition: SequenceTree.cpp:330
~SequenceTree()
Definition: SequenceTree.cpp:51
ContainerSequence * GetContainerSequence()
Definition: SequenceTree.cpp:339
unsigned int AddModule(string name)
Definition: SequenceTree.cpp:128
int m_depth
Definition: SequenceTree.h:254
Module * GetModuleByAttributeValue(string name, string value)
Definition: SequenceTree.cpp:348
DOMDocument * GetDOMDocument()
Definition: SequenceTree.h:197
static unsigned int CreateModule(void *ptr, DOMNode *node)
Definition: SequenceTree.cpp:245
void Initialize(string seqFile)
Definition: SequenceTree.cpp:68
int GetDepth()
Definition: SequenceTree.h:218
bool m_state
Definition: SequenceTree.h:253
DOMNode * GetParentNode(DOMNode *node)
Definition: SequenceTree.cpp:97
map< DOMNode *, Module * > * GetModuleMap()
Definition: SequenceTree.h:211
Module * GetChild(DOMNode *node, unsigned int position)
Definition: SequenceTree.cpp:321
string GetSequenceDirectory()
Definition: SequenceTree.cpp:87
XML file-IO class.
Definition: XMLIO.h:61

-- last change 03.10.2023 | Tony Stoecker | Imprint | Data Protection --