Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
classdef SCDclass_taskcontainer
% This class is a container class
% for tasks object, a task object is a
% generic object customizable for
% specifying tasks at init and
% terminate phases
properties
numtasks % number of configured tasks
tasks % tasks list
end
methods
function obj = SCDclass_taskcontainer()
% contructor, empty container
obj.numtasks=0;
end
function obj = addtask(obj, task)
% Adds a parameter object
if obj.numtasks==0
obj.tasks=task;
else
obj.tasks=[obj.tasks; task];
end
obj.numtasks=obj.numtasks+1;
end
function obj = printtasks(obj)
% prints the parameters object list
if obj.numtasks>0
for ii=1:obj.numtasks
obj.tasks(ii).printinfo();
end
end
end
function obj = exectasksoninit(obj, shot)
% execs the init method of all configurted task
if obj.numtasks>0
for ii=1:obj.numtasks
obj.tasks(ii).init(shot);
end
end
end
function obj = exectasksonterm(obj, shot)
% execs the term method of all configurted task
if obj.numtasks>0
for ii=1:obj.numtasks
obj.tasks(ii).term(shot);
end
end
end
function obj = bindlasttask(obj, modelname, datadictionary)
if obj.numtasks>0
obj.tasks(end)=obj.tasks(end).setmodelname(modelname);
obj.tasks(end)=obj.tasks(end).setdatadictionary(datadictionary);
end
end
function obj = importtaskobjects(obj, source)
% parameters import
desttasktargets={};
if obj.numtasks>0
for ii=1:obj.numtasks
desttasktargets{end+1}=obj.tasks(ii).getid;
end
end
numtaskstoimport = source.numtasks;
taskstoimport = source.tasks;
if numtaskstoimport>0
for ii=1:numtaskstoimport
if ~ismember(taskstoimport(ii).getid, desttasktargets)
obj=obj.addtask(taskstoimport(ii));
else
warning('SCDclass_taskcontainer:importtaskobjects','A task object with target ''%s'' is already present in the dest. expcode, skipping!',taskstoimport(ii).getid);
end
end
end
end
end
end