lib/App/SeismicUnixGui/specs/header/sushw_spec.pm untested

filter: Statementstmt 0.0% 0 / 138 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 183 CC 8 SCAR 14.4
CC
8
Cov
0%
get_binding_index_aref
6.0
get_binding_length
6.0
get_file_dialog_type_aref
6.0
CRAP 4.2
1 package App::SeismicUnixGui::specs::header::sushw_spec;
2 use Moose;
3 our $VERSION = '1.0.1';
4  
5 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
6 use App::SeismicUnixGui::misc::SeismicUnix qw($su $suffix_su $suffix_bin $bin);
7 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
8 use aliased 'App::SeismicUnixGui::sunix::header::sushw';
9  
10 my $get = L_SU_global_constants->new();
11 my $Project = Project_config->new();
12 my $sushw = sushw->new();
13  
14 my $var = $get->var();
15  
16 my $empty_string = $var->{_empty_string};
17 my $true = $var->{_true};
18 my $false = $var->{_false};
19 my $file_dialog_type = $get->file_dialog_type_href();
20 my $flow_type = $get->flow_type_href();
21  
22 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
23 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
24 my $PL_SEISMIC = $Project->PL_SEISMIC();
25 my $max_index = 6;
26  
27 my $sushw_spec = {
28 _CONFIG => $PL_SEISMIC,
29 _DATA_DIR_IN => $DATA_SEISMIC_SU,
30 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
31 _binding_index_aref => '',
32 _suffix_type_in => $su,
33 _data_suffix_in => $suffix_su,
34 _suffix_type_out => $su,
35 _data_suffix_out => $suffix_su,
36 _file_dialog_type_aref => '',
37 _flow_type_aref => '',
38 _has_infile => $true,
39 _has_outpar => $false,
40 _has_pipe_in => $true,
41 _has_pipe_out => $true,
42 _has_redirect_in => $true,
43 _has_redirect_out => $true,
44 _has_subin_in => $false,
45 _has_subin_out => $false,
46 _is_data => $false,
47 _is_first_of_2 => $true,
48 _is_first_of_3or_more => $true,
49 _is_first_of_4or_more => $true,
50 _is_last_of_2 => $false,
51 _is_last_of_3or_more => $false,
52 _is_last_of_4or_more => $false,
53 _is_suprog => $true,
54 _is_superflow => $false,
55 _max_index => $max_index,
56 _prefix_aref => '',
57 _suffix_aref => '',
58 };
59  
60 =head2 sub binding_index_aref
61  
62 =cut
63  
64 sub binding_index_aref {
65  
66 my ($self) = @_;
67  
68 my @index;
69  
70 $index[0] = 6; # for inbound binary infile
71  
72 $sushw_spec->{_binding_index_aref} = \@index;
73 return ();
74  
75 }
76  
77 =head2 sub file_dialog_type_aref
78  
79 =cut
80  
81 sub file_dialog_type_aref {
82 my ($self) = @_;
83  
84 my @type;
85  
86 my $index_aref = get_binding_index_aref();
87 my @index = @$index_aref;
88  
89 # bound index will look for data
90 $type[0] = '';
91 $type[ $index[0] ] = $file_dialog_type->{_Data};
92  
93 $sushw_spec->{_file_dialog_type_aref} = \@type;
94  
95 return ();
96  
97 }
98  
99 =head2 sub get_binding_index_aref
100  
101 =cut
102  
103 sub get_binding_index_aref {
104  
105 my ($self) = @_;
106 my @index;
107  
108 if ( $sushw_spec->{_binding_index_aref} ) {
109  
110 my $index_aref = $sushw_spec->{_binding_index_aref};
111 return ($index_aref);
112  
113 } else {
114 print("sushw_spec, get_binding_index_aref, missing binding_index_aref\n");
115 return ();
116 }
117  
118 my $index_aref = $sushw_spec->{_binding_index_aref};
119  
120 }
121  
122 =head2 sub flow_type_aref
123  
124 =cut
125  
126 sub flow_type_aref {
127 my ($self) = @_;
128  
129 my @type;
130  
131 $type[0] = $flow_type->{_user_built};
132  
133 $sushw_spec->{_flow_type_aref} = \@type;
134  
135 return ();
136  
137 }
138  
139 =head2 sub get_binding_length
140  
141 =cut
142  
143 sub get_binding_length {
144 my ($self) = @_;
145  
146 if ( $sushw_spec->{_binding_index_aref} ) {
147 my $length;
148 $length = scalar @{ $sushw_spec->{_binding_index_aref} };
149 return ($length);
150  
151 } else {
152  
153 print("sushw_spec, get_binding_length, missing length \n");
154 return ();
155 }
156  
157 }
158  
159 =head2 sub get_file_dialog_type_aref
160  
161 =cut
162  
163 sub get_file_dialog_type_aref {
164 my ($self) = @_;
165  
166 if ( $sushw_spec->{_file_dialog_type_aref} ) {
167 my @type = @{ $sushw_spec->{_file_dialog_type_aref} };
168 return ( \@type );
169 } else {
170 print("sushw_spec,get_file_dialog_type_aref, missing file_dialog_type_aref\n");
171 return ();
172 }
173 }
174  
175 =head2 sub get_flow_type_aref
176  
177 =cut
178  
179 sub get_flow_type_aref {
180 my ($self) = @_;
181  
182 if ( $sushw_spec->{_flow_type_aref} ) {
183 my $type_aref = $sushw_spec->{_flow_type_aref};
184 return ($type_aref);
185 } else {
186  
187 print("sushw_spec, get_flow_type_aref, missing flow_type_aref \n");
188 return ();
189 }
190 }
191  
192 =head2 sub get_incompatibles
193  
194 =cut
195  
196 sub get_incompatibles {
197  
198 my ($self) = @_;
199 my @needed;
200  
201 my @_need_both;
202  
203 my @_need_only_1;
204  
205 my @_none_needed;
206  
207 my @_all_needed;
208  
209 my $params = {
210  
211 _need_both => \@_need_both,
212 _need_only_1 => \@_need_only_1,
213 _none_needed => \@_none_needed,
214 _all_needed => \@_all_needed,
215  
216 };
217  
218 my @of_two = ( 'xx', 'yy' );
219 push @{ $params->{_need_only_1} }, \@of_two;
220  
221 my $len_1_needed = scalar @{ $params->{_need_only_1} };
222  
223 if ( $len_1_needed >= 1 ) {
224  
225 for ( my $i = 0; $i < $len_1_needed; $i++ ) {
226  
227 print("sushw, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
228  
229 }
230  
231 } else {
232 print("get_incompatibles, no incompatibles\n");
233 }
234  
235 return ($params);
236  
237 }
238  
239 =head2 sub get_prefix_aref
240  
241 =cut
242  
243 sub get_prefix_aref {
244  
245 my ($self) = @_;
246  
247 if ( $sushw_spec->{_prefix_aref} ) {
248  
249 my $prefix_aref = $sushw_spec->{_prefix_aref};
250 return ($prefix_aref);
251  
252 } else {
253 print("sushw_spec, get_prefix_aref, missing prefix_aref\n");
254 return ();
255 }
256  
257 return ();
258 }
259  
260 =head2 sub get_suffix_aref
261  
262 =cut
263  
264 sub get_suffix_aref {
265  
266 my ($self) = @_;
267  
268 if ( $sushw_spec->{_suffix_aref} ) {
269  
270 my $suffix_aref = $sushw_spec->{_suffix_aref};
271 return ($suffix_aref);
272  
273 } else {
274 print("sushw_spec, get_suffix_aref, missing suffix_aref\n");
275 return ();
276 }
277  
278 return ();
279 }
280  
281 =head2 sub prefix_aref
282  
283 Include in the Set up
284 sections of an output Poop flow.
285  
286 prefixes and suffixes to parameter labels
287 are filtered by sunix_pl
288  
289 =cut
290  
291 sub prefix_aref {
292  
293 my ($self) = @_;
294  
295 my @prefix;
296  
297 for ( my $i = 0; $i < $max_index; $i++ ) {
298  
299 $prefix[$i] = $empty_string;
300  
301 }
302  
303 my $index_aref = get_binding_index_aref();
304 my @index = @$index_aref;
305  
306 # label 7 in GUI is input xx_file and needs a home directory
307 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
308  
309 $sushw_spec->{_prefix_aref} = \@prefix;
310 return ();
311  
312 }
313  
314 =head2 sub suffix_aref
315  
316 Initialize suffixes as empty
317 Assign specific suffixes to parameter
318 values
319  
320 =cut
321  
322 sub suffix_aref {
323  
324 my ($self) = @_;
325  
326 my @suffix;
327  
328 for ( my $i = 0; $i < $max_index; $i++ ) {
329  
330 $suffix[$i] = $empty_string;
331  
332 }
333  
334 my $index_aref = get_binding_index_aref();
335 my @index = @$index_aref;
336  
337 # label 7 in GUI is input xx_file and needs a home directory
338 $suffix[ $index[0] ] = "." . '$suffix_bin';
339  
340 $sushw_spec->{_suffix_aref} = \@suffix;
341 return ();
342  
343 }
344  
345 =head2 sub variables
346  
347 return a hash array
348 with definitions
349
350 =cut
351  
352 sub variables {
353 my $self = @_;
354 my $hash_ref = $sushw_spec;
355 return ($hash_ref);
356 }
357  
358 1;