-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathBenchmarkSimpleMrdWriterBase.m
More file actions
69 lines (57 loc) · 2.5 KB
/
Copy pathBenchmarkSimpleMrdWriterBase.m
File metadata and controls
69 lines (57 loc) · 2.5 KB
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
% This file was generated by the "yardl" tool. DO NOT EDIT.
% Abstract writer for protocol BenchmarkSimpleMrd
classdef (Abstract) BenchmarkSimpleMrdWriterBase < handle
properties (Access=protected)
state_
end
methods
function self = BenchmarkSimpleMrdWriterBase()
self.state_ = 0;
end
function close(self)
self.close_();
if self.state_ ~= 1
expected_method = self.state_to_method_name_(self.state_);
throw(yardl.ProtocolError("Protocol writer closed before all steps were called. Expected call to '%s'.", expected_method));
end
end
% Ordinal 0
function write_data(self, value)
if self.state_ ~= 0
self.raise_unexpected_state_(0);
end
self.write_data_(value);
end
function end_data(self)
if self.state_ ~= 0
self.raise_unexpected_state_(0);
end
self.end_stream_();
self.state_ = 1;
end
end
methods (Static)
function res = schema()
res = string('{"protocol":{"name":"BenchmarkSimpleMrd","sequence":[{"name":"data","type":{"stream":{"items":[{"tag":"acquisition","explicitTag":true,"type":"TestModel.SimpleAcquisition"},{"tag":"image","explicitTag":true,"type":{"name":"Image.Image","typeArguments":["float32"]}}]}}}]},"types":[{"alias":{"name":"Image","typeParameters":["T"],"type":{"array":{"items":"T","dimensions":[{"name":"x"},{"name":"y"}]}}}},{"record":{"name":"SimpleAcquisition","fields":[{"name":"flags","type":"uint64"},{"name":"idx","type":"TestModel.SimpleEncodingCounters"},{"name":"data","type":{"array":{"items":"complexfloat32","dimensions":2}}},{"name":"trajectory","type":{"array":{"items":"float32","dimensions":2}}}]}},{"record":{"name":"SimpleEncodingCounters","fields":[{"name":"e1","type":[null,"uint32"]},{"name":"e2","type":[null,"uint32"]},{"name":"slice","type":[null,"uint32"]},{"name":"repetition","type":[null,"uint32"]}]}}]}');
end
end
methods (Abstract, Access=protected)
write_data_(self, value)
end_stream_(self)
close_(self)
end
methods (Access=private)
function raise_unexpected_state_(self, actual)
expected_method = self.state_to_method_name_(self.state_);
actual_method = self.state_to_method_name_(actual);
throw(yardl.ProtocolError("Expected call to '%s' but received call to '%s'", expected_method, actual_method));
end
function name = state_to_method_name_(self, state)
if state == 0
name = "write_data or end_data";
else
name = '<unknown>';
end
end
end
end