« lib/App/SeismicUnixGui/specs/big_streams/Sseg2su_spec.pm
↑ Summary
lib/App/SeismicUnixGui/specs/big_streams/Sucat_specB.pm »
| 1 | package App::SeismicUnixGui::specs::big_streams::Sucat_spec; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | our $VERSION = '1.0.0'; | ||
| 5 | |||
| 6 | use App::SeismicUnixGui::misc::SeismicUnix qw($su $suffix_su); | ||
| 7 | use App::SeismicUnixGui::misc::L_SU_global_constants; | ||
| 8 | use App::SeismicUnixGui::configs::big_streams::Project_config; | ||
| 9 | |||
| 10 | my $get = App::SeismicUnixGui::misc::L_SU_global_constants->new(); | ||
| 11 | my $Project = App::SeismicUnixGui::configs::big_streams::Project_config->new(); | ||
| 12 | |||
| 13 | my $var = $get->var(); | ||
| 14 | |||
| 15 | my $empty_string = $var->{_empty_string}; | ||
| 16 | my $file_dialog_type = $get->file_dialog_type_href(); | ||
| 17 | my $flow_type = $get->flow_type_href(); | ||
| 18 | |||
| 19 | my $true = $var->{_true}; | ||
| 20 | my $false = $var->{_false}; | ||
| 21 | |||
| 22 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory | ||
| 23 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 24 | |||
| 25 | my $max_index = 9; | ||
| 26 | |||
| 27 | my $Sucat_spec = { | ||
| 28 | _CONFIG => $PL_SEISMIC, | ||
| 29 | _DATA_DIR_IN => $DATA_SEISMIC_SU, # input data directory default | ||
| 30 | _DATA_DIR_OUT => $DATA_SEISMIC_SU, # input data directory default | ||
| 31 | _binding_index_aref => '', | ||
| 32 | _suffix_type_in => $su, | ||
| 33 | _data_suffix_in => $suffix_su, # default | ||
| 34 | _suffix_type_out => $su, | ||
| 35 | _data_suffix_out => $suffix_su, # default | ||
| 36 | _file_dialog_type_aref => '', | ||
| 37 | _flow_type_aref => '', | ||
| 38 | _has_infile => $false, | ||
| 39 | _has_pipe_in => $false, | ||
| 40 | _has_pipe_out => $false, | ||
| 41 | _has_redirect_in => $false, | ||
| 42 | _has_redirect_out => $false, | ||
| 43 | _has_subin_in => $false, | ||
| 44 | _has_subin_out => $false, | ||
| 45 | _is_data => $false, | ||
| 46 | _is_first_of_2 => $false, | ||
| 47 | _is_first_of_3or_more => $false, | ||
| 48 | _is_first_of_4or_more => $false, | ||
| 49 | _is_last_of_2 => $false, | ||
| 50 | _is_last_of_3or_more => $false, | ||
| 51 | _is_last_of_4or_more => $false, | ||
| 52 | _is_suprog => $false, | ||
| 53 | _is_superflow => $true, | ||
| 54 | _max_index => $max_index, | ||
| 55 | _prefix_aref => '', | ||
| 56 | _suffix_aref => '', | ||
| 57 | }; | ||
| 58 | |||
| 59 | =head2 sub binding_index_aref | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | sub binding_index_aref { | ||
| 64 | my ($self) = @_; | ||
| 65 | my @index; | ||
| 66 | |||
| 67 | $index[0] = 6; # file name for list | ||
| 68 | $index[1] = 7; # output file name | ||
| 69 | $index[2] = 8; # alternative inbound_directory | ||
| 70 | $index[3] = 9; # alterantive outbound_directory | ||
| 71 | |||
| 72 | $Sucat_spec->{_binding_index_aref} = \@index; | ||
| 73 | |||
| 74 | return (); | ||
| 75 | } | ||
| 76 | |||
| 77 | =head2 sub get_binding_index_aref | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | sub get_binding_index_aref { | ||
| 82 | my ($self) = @_; | ||
| 83 | my @index; | ||
| 84 | |||
| 85 | if ( $Sucat_spec->{_binding_index_aref} ) { | ||
| 86 | my $index_aref = $Sucat_spec->{_binding_index_aref}; | ||
| 87 | return ($index_aref); | ||
| 88 | |||
| 89 | } | ||
| 90 | else { | ||
| 91 | print( | ||
| 92 | "Sucat_spec, get_binding_index_aref, missing binding_index_aref\n" | ||
| 93 | ); | ||
| 94 | return (); | ||
| 95 | } | ||
| 96 | |||
| 97 | my $index_aref = $Sucat_spec->{_binding_index_aref}; | ||
| 98 | |||
| 99 | } | ||
| 100 | |||
| 101 | =head2 sub get_max_index | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | sub get_max_index { | ||
| 106 | my ($self) = @_; | ||
| 107 | |||
| 108 | if ( $Sucat_spec->{_max_index} ) { | ||
| 109 | |||
| 110 | my $max_idx = $max_index; | ||
| 111 | return ($max_idx); | ||
| 112 | |||
| 113 | } | ||
| 114 | else { | ||
| 115 | print("Sucat_spec, get_max_index, missing max_index\n"); | ||
| 116 | return (); | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | =head2 sub file_dialog_type_aref | ||
| 121 | |||
| 122 | 'Path' - can go to anywhere | ||
| 123 | type of dialog (Data, Flow, SaveAs) is needed | ||
| 124 | for binding | ||
| 125 | one type of dialog for each index | ||
| 126 | |||
| 127 | =cut | ||
| 128 | |||
| 129 | sub file_dialog_type_aref { | ||
| 130 | my ($self) = @_; | ||
| 131 | |||
| 132 | my @type; | ||
| 133 | my $index_aref = get_binding_index_aref(); | ||
| 134 | my @index = @$index_aref; | ||
| 135 | |||
| 136 | # in user_flow, bound index will look for data | ||
| 137 | $type[0] = ''; | ||
| 138 | |||
| 139 | $type[$index[0]] = $file_dialog_type->{_Data_SEISMIC_TXT}; | ||
| 140 | $type[$index[1]] = $file_dialog_type->{_Data_PL_SEISMIC}; | ||
| 141 | $type[$index[2]] = $file_dialog_type->{_Path}; | ||
| 142 | $type[$index[3]] = $file_dialog_type->{_Path}; | ||
| 143 | |||
| 144 | $Sucat_spec->{_file_dialog_type_aref} = \@type; | ||
| 145 | |||
| 146 | return (); | ||
| 147 | |||
| 148 | } | ||
| 149 | |||
| 150 | =head2 sub get_file_dialog_type_aref | ||
| 151 | |||
| 152 | =cut | ||
| 153 | |||
| 154 | sub get_file_dialog_type_aref { | ||
| 155 | my ($self) = @_; | ||
| 156 | |||
| 157 | if ( $Sucat_spec->{_file_dialog_type_aref} ) { | ||
| 158 | |||
| 159 | my @type = @{ $Sucat_spec->{_file_dialog_type_aref} }; | ||
| 160 | # print("Sucat_spec,get_file_dialog_type_aref: types are: @type \n"); | ||
| 161 | return ( \@type ); | ||
| 162 | } | ||
| 163 | else { | ||
| 164 | print( | ||
| 165 | "Sucat_spec,get_file_dialog_type_aref, missing file_dialog_type_aref\n" | ||
| 166 | ); | ||
| 167 | return (); | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 171 | =head2 sub flow_type_aref | ||
| 172 | |||
| 173 | =cut | ||
| 174 | |||
| 175 | sub flow_type_aref { | ||
| 176 | my ($self) = @_; | ||
| 177 | |||
| 178 | my @type; | ||
| 179 | |||
| 180 | $type[0] = $flow_type->{_pre_built_superflow}; | ||
| 181 | |||
| 182 | $Sucat_spec->{_flow_type_aref} = \@type; | ||
| 183 | |||
| 184 | return (); | ||
| 185 | |||
| 186 | } | ||
| 187 | |||
| 188 | =head2 sub get_flow_type_aref | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | sub get_flow_type_aref { | ||
| 193 | my ($self) = @_; | ||
| 194 | |||
| 195 | if ( $Sucat_spec->{_flow_type_aref} ) { | ||
| 196 | my $type_aref = $Sucat_spec->{_flow_type_aref}; | ||
| 197 | return ($type_aref); | ||
| 198 | } | ||
| 199 | else { | ||
| 200 | |||
| 201 | print("Sucat_spec, get_flow_type_aref, missing flow_type_aref \n"); | ||
| 202 | return (); | ||
| 203 | } | ||
| 204 | } | ||
| 205 | |||
| 206 | =head2 sub get_prefix_aref | ||
| 207 | |||
| 208 | =cut | ||
| 209 | |||
| 210 | sub get_prefix_aref { | ||
| 211 | |||
| 212 | my $self = @_; | ||
| 213 | |||
| 214 | if ( defined $Sucat_spec->{_prefix_aref} ) { | ||
| 215 | |||
| 216 | my $prefix_aref= $Sucat_spec->{_prefix_aref}; | ||
| 217 | return($prefix_aref); | ||
| 218 | |||
| 219 | } else { | ||
| 220 | print("Sucat_spec, get_prefix_aref, missing prefix_aref\n"); | ||
| 221 | return(); | ||
| 222 | } | ||
| 223 | |||
| 224 | return(); | ||
| 225 | } | ||
| 226 | |||
| 227 | =head2 sub get_suffix_aref | ||
| 228 | |||
| 229 | =cut | ||
| 230 | |||
| 231 | sub get_suffix_aref { | ||
| 232 | |||
| 233 | my $self = @_; | ||
| 234 | |||
| 235 | if ($Sucat_spec->{_suffix_aref} ) { | ||
| 236 | |||
| 237 | my $suffix_aref= $Sucat_spec->{_suffix_aref}; | ||
| 238 | return($suffix_aref); | ||
| 239 | |||
| 240 | } else { | ||
| 241 | print("Sucat_spec, get_suffix_aref, missing suffix_aref\n"); | ||
| 242 | return(); | ||
| 243 | } | ||
| 244 | |||
| 245 | return(); | ||
| 246 | } | ||
| 247 | |||
| 248 | |||
| 249 | =head2 sub prefix_aref | ||
| 250 | |||
| 251 | =cut | ||
| 252 | |||
| 253 | sub prefix_aref { | ||
| 254 | |||
| 255 | my $self = @_; | ||
| 256 | |||
| 257 | my @prefix; | ||
| 258 | |||
| 259 | for (my $i=0; $i < $max_index; $i++) { | ||
| 260 | |||
| 261 | $prefix[$i] = $empty_string; | ||
| 262 | |||
| 263 | } | ||
| 264 | $Sucat_spec ->{_prefix_aref} = \@prefix; | ||
| 265 | return(); | ||
| 266 | |||
| 267 | } | ||
| 268 | |||
| 269 | |||
| 270 | =head2 sub suffix_aref | ||
| 271 | |||
| 272 | =cut | ||
| 273 | |||
| 274 | sub suffix_aref { | ||
| 275 | |||
| 276 | my $self = @_; | ||
| 277 | |||
| 278 | my @suffix; | ||
| 279 | |||
| 280 | for (my $i=0; $i < $max_index; $i++) { | ||
| 281 | |||
| 282 | $suffix[$i] = $empty_string; | ||
| 283 | |||
| 284 | } | ||
| 285 | $Sucat_spec ->{_suffix_aref} = \@suffix; | ||
| 286 | return(); | ||
| 287 | |||
| 288 | } | ||
| 289 | |||
| 290 | |||
| 291 | =head2 sub get_binding_length | ||
| 292 | |||
| 293 | =cut | ||
| 294 | |||
| 295 | sub get_binding_length { | ||
| 296 | my ($self) = @_; | ||
| 297 | |||
| 298 | if ( $Sucat_spec->{_binding_index_aref} ) { | ||
| 299 | my $length; | ||
| 300 | $length = scalar @{ $Sucat_spec->{_binding_index_aref} }; | ||
| 301 | return ($length); | ||
| 302 | |||
| 303 | } | ||
| 304 | else { | ||
| 305 | |||
| 306 | print("Sucat_spec, get_binding_length, missing length \n"); | ||
| 307 | return (); | ||
| 308 | } | ||
| 309 | |||
| 310 | } | ||
| 311 | |||
| 312 | =head2 sub variables | ||
| 313 | |||
| 314 | return a hash array | ||
| 315 | with definitions | ||
| 316 | |||
| 317 | =cut | ||
| 318 | |||
| 319 | sub variables { | ||
| 320 | my ($self) = @_; | ||
| 321 | |||
| 322 | # print("Sucat_spec,variables, | ||
| 323 | # first_of_2,$Sucat_spec->{_is_first_of_2}\n"); | ||
| 324 | my $hash_ref = $Sucat_spec; | ||
| 325 | return ($hash_ref); | ||
| 326 | } | ||
| 327 | |||
| 328 | 1; |