-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathprocess.m
More file actions
136 lines (120 loc) · 4.62 KB
/
process.m
File metadata and controls
136 lines (120 loc) · 4.62 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
classdef process < handle
%PROCESS Base class for all processing steps in the USTB pipeline
%
% PROCESS is the superclass for all processing objects in the USTB.
% The USTB pipeline is organized in three types of processes:
% preprocess, midprocess, and postprocess. Each processing class
% implements a go() method that executes the processing step.
%
% Properties:
% name name of the process
% reference reference to the publication where it is disclosed
% implemented_by contact of the implementer(s)
% version version of the implementation
%
% See also PIPELINE, MIDPROCESS, POSTPROCESS, PREPROCESS
% authors: Alfonso Rodriguez-Molares (alfonso.r.molares@ntnu.no)
% Ole Marius Hoel Rindal <olemarius@olemarius.net>
%
% $Date: 2017/09/10$
%% Logistics
properties (Access = public)
name='' % name of the process
reference='' % reference to the publication where it is disclossed
implemented_by='' % contact of the implementer/s
version='' % verion
end
%% Protected
properties (Access = protected)
last_hash
end
%% HASH tools
methods
function out = hash(h)
%% HASH Gives hash for all the non-dependent & public properties
% loop over all non-dependent & public properties
str=[];
list_properties=properties(h);
for n=1:numel(list_properties)
property_name=list_properties{n};
mp = findprop(h,property_name);
if strcmp(mp.GetAccess,'public')&&~mp.Dependent
%fprintf(1,'%s -> %s\n',property_name,tools.hash(h.(property_name)));
if isa(h.(property_name),'uff')
for ne=1:numel(h.(property_name))
str = [ str; h.(property_name)(ne).hash()];
end
elseif isa(h.(property_name),'uff.window')||isa(h.(property_name),'dimension')||isa(h.(property_name),'code')||isa(h.(property_name),'spherical_transmit_delay_model')
str=[str;tools.hash(char(h.(property_name)))];
else
str=[str;tools.hash(h.(property_name))];
end
end
end
out=tools.hash(str);
end
function h=save_hash(h)
h.last_hash=h.hash();
end
function equal=check_hash(h)
if isempty(h.last_hash) equal=false;
else
equal=strcmp(h.hash(),h.last_hash);
if equal
warning('Inputs and outputs are unchanged. Skipping process...');
end
end
end
end
%% Display methods
methods
function print_name(h)
idx = 1;
while idx+50 < length(h.name)
if idx < 50
fprintf('Name:\t\t %s \n',h.name(idx:idx+49));
else
fprintf('\t\t %s \n',h.name(idx:idx+49));
end
idx = idx+50;
end
if idx < 50
fprintf('Name:\t\t %s \n',h.name(idx:end));
else
fprintf('\t\t %s \n',h.name(idx:end));
end
end
function print_reference(h)
idx = 1;
while idx+50 < length(h.reference)
if idx < 50
fprintf('Reference:\t %s \n',h.reference(idx:idx+49));
else
fprintf('\t\t %s \n',h.reference(idx:idx+49));
end
idx = idx+50;
end
if idx < 50
fprintf('Name:\t %s \n',h.reference(idx:end));
else
fprintf('\t\t %s \n',h.reference(idx:end));
end
end
function print_implemented_by(h)
idx = 1;
while idx+50 < length(h.implemented_by)
if idx < 50
fprintf('Implemented by:\t %s \n',h.implemented_by(idx:idx+49));
else
fprintf('\t\t %s \n',h.implemented_by(idx:idx+49));
end
idx = idx+50;
end
if idx < 50
fprintf('Name:\t %s \n',h.implemented_by(idx:end));
else
fprintf('\t\t %s \n',h.implemented_by(idx:end));
end
end
end
end