« lib/App/SeismicUnixGui/misc/oop_declare_data_in.pm
↑ Summary
lib/App/SeismicUnixGui/misc/seismics.pm »
| 1 | package App::SeismicUnixGui::misc::oop_declare_data_out; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | =pod | ||
| 6 | |||
| 7 | =head1 DOCUMENTATION | ||
| 8 | |||
| 9 | =head2 SYNOPSIS | ||
| 10 | |||
| 11 | PERL PROGRAM NAME: oop_declare_data_out | ||
| 12 | AUTHOR: Juan Lorenzo | ||
| 13 | DATE: Nov 29 2017, | ||
| 14 | |||
| 15 | DESCRIPTION: | ||
| 16 | Version: 1.1 | ||
| 17 | |||
| 18 | =head2 USE | ||
| 19 | |||
| 20 | =head3 NOTES | ||
| 21 | |||
| 22 | =head4 | ||
| 23 | Examples | ||
| 24 | |||
| 25 | =head3 SEISMIC UNIX NOTES | ||
| 26 | |||
| 27 | |||
| 28 | =head4 CHANGES and their DATES | ||
| 29 | |||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | =head2 Default perl lines for | ||
| 34 | |||
| 35 | declaring required packages | ||
| 36 | |||
| 37 | =cut | ||
| 38 | |||
| 39 | =head2 data | ||
| 40 | |||
| 41 | private hash | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | my $oop_declare_data_out = { | ||
| 46 | _suffix_type => '', | ||
| 47 | _suffix_type_in => '', | ||
| 48 | _suffix_type_out => '', | ||
| 49 | _param_labels_aref => '', | ||
| 50 | _param_values_aref => '', | ||
| 51 | }; | ||
| 52 | |||
| 53 | my ( @data_in, @data_out, @inbound_notes, @outbound_notes ); | ||
| 54 | |||
| 55 | =head2 sub get_section | ||
| 56 | |||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | sub empty { | ||
| 61 | my ($self) = @_; | ||
| 62 | |||
| 63 | $outbound_notes[0] = ""; | ||
| 64 | |||
| 65 | return (); | ||
| 66 | } | ||
| 67 | |||
| 68 | sub inbound_section { | ||
| 69 | my ($self) = @_; | ||
| 70 | |||
| 71 | # print("oop_declare_data_out ,inbound_section,notes:\n @inbound_notes\n"); | ||
| 72 | |||
| 73 | return ( \@inbound_notes ); | ||
| 74 | |||
| 75 | } | ||
| 76 | |||
| 77 | sub outbound_section { | ||
| 78 | my ($self) = @_; | ||
| 79 | |||
| 80 | # print("oop_declare_data_out ,outbound_section,notes:\n @outbound_notes\n"); | ||
| 81 | return ( \@outbound_notes ); | ||
| 82 | |||
| 83 | } | ||
| 84 | |||
| 85 | sub set_bin_in { | ||
| 86 | |||
| 87 | $inbound_notes[1] = | ||
| 88 | "\t" . 'my (@file_in);' . "\n\t" . 'my (@bin_file_in,@inbound);'; | ||
| 89 | $inbound_notes[2] = | ||
| 90 | "\t" . '$bin_file_in[1]' . "\t" . '= $file_in[1].$suffix_bin;'; | ||
| 91 | $inbound_notes[3] = "\t" | ||
| 92 | . '$inbound[1]' . "\t" | ||
| 93 | . '= $DATA_SEISMIC_BIN.' . "'/'" | ||
| 94 | . '.$bin_file_in[1];'; | ||
| 95 | } | ||
| 96 | |||
| 97 | sub set_bin_out { | ||
| 98 | $outbound_notes[1] = | ||
| 99 | "\t" . 'my (@file_out);' . "\n\t" . 'my (@bin_file_out,@outbound);'; | ||
| 100 | |||
| 101 | $outbound_notes[2] = | ||
| 102 | "\t" . '$bin_file_out[1]' . "\t" . '= $file_out[1].$suffix_bin;'; | ||
| 103 | $outbound_notes[3] = "\t" | ||
| 104 | . '$outbound[1]' . "\t" | ||
| 105 | . '= $DATA_SEISMIC_BIN.' . "'/'" | ||
| 106 | . '.$bin_file_out[1];'; | ||
| 107 | } | ||
| 108 | |||
| 109 | sub set_text_in { | ||
| 110 | |||
| 111 | $inbound_notes[1] = | ||
| 112 | "\t" . 'my (@file_in);' . "\n\t" . 'my (@text_file_in,@inbound);'; | ||
| 113 | $inbound_notes[2] = | ||
| 114 | "\t" . '$text_data_in[1]' . "\t" . '= $file_in[1].$suffix_text;'; | ||
| 115 | $inbound_notes[3] = "\t" | ||
| 116 | . '$inbound[1]' . "\t" | ||
| 117 | . '= $DATA_SEISMIC_TXT.' . "'/'" | ||
| 118 | . '.$text_data_in[1];'; | ||
| 119 | |||
| 120 | } | ||
| 121 | |||
| 122 | sub set_text_out { | ||
| 123 | $outbound_notes[1] = | ||
| 124 | "\t" . 'my (@file_out);' . "\n\t" . 'my (@text_file_out,@outbound);'; | ||
| 125 | |||
| 126 | $outbound_notes[2] = | ||
| 127 | "\t" . '$text_data_out[1]' . "\t" . '= $file_out[1].$suffix_text;'; | ||
| 128 | $outbound_notes[3] = "\t" | ||
| 129 | . '$outbound[1]' . "\t" | ||
| 130 | . '= $DATA_SEISMIC_TXT.' . "'/'" | ||
| 131 | . '.$text_data_out[1];'; | ||
| 132 | |||
| 133 | } | ||
| 134 | |||
| 135 | sub set_su_in { | ||
| 136 | $inbound_notes[1] = | ||
| 137 | "\t" . 'my (@file_in);' . "\n\t" . 'my (@sudata_in,@inbound);'; | ||
| 138 | |||
| 139 | $inbound_notes[2] = | ||
| 140 | "\t" . '$sudata_in[1]' . "\t" . '= $file_in[1].$suffix_su;'; | ||
| 141 | $inbound_notes[3] = "\t" | ||
| 142 | . '$inbound[1]' . "\t" | ||
| 143 | . '= $DATA_SEISMIC_SU.' . "'/'" | ||
| 144 | . '.$sudata_in[1];'; | ||
| 145 | |||
| 146 | } | ||
| 147 | |||
| 148 | sub set_su_out { | ||
| 149 | |||
| 150 | $outbound_notes[1] = | ||
| 151 | "\t" . 'my (@file_out);' . "\n\t" . 'my (@sudata_out,@outbound);'; | ||
| 152 | $outbound_notes[2] = | ||
| 153 | "\t" . '$sudata_out[1]' . "\t" . '= $file_out[1].$suffix_su;'; | ||
| 154 | $outbound_notes[3] = "\t" | ||
| 155 | . '$outbound[1]' . "\t" | ||
| 156 | . '= $DATA_SEISMIC_SU.' . "'/'" | ||
| 157 | . '.$sudata_out[1];'; | ||
| 158 | |||
| 159 | } | ||
| 160 | |||
| 161 | sub set_segb_in { | ||
| 162 | |||
| 163 | $outbound_notes[1] = | ||
| 164 | "\t" . 'my (@file_in);' . "\n\t" . 'my (@segbdata_in,@inbound);'; | ||
| 165 | $outbound_notes[2] = | ||
| 166 | "\t" . '$segbdata_in[1]' . "\t" . '= $file_in[1].$suffix_segb;'; | ||
| 167 | $outbound_notes[3] = "\t" | ||
| 168 | . '$inbound[1]' . "\t" | ||
| 169 | . '= $DATA_SEISMIC_SEGB.' . "'/'" | ||
| 170 | . '.$segbdata_in[1];'; | ||
| 171 | |||
| 172 | } | ||
| 173 | |||
| 174 | sub set_segb_out { | ||
| 175 | |||
| 176 | $outbound_notes[1] = | ||
| 177 | "\t" . 'my (@file_out);' . "\n\t" . 'my (@segbdata_out,@outbound);'; | ||
| 178 | $outbound_notes[2] = | ||
| 179 | "\t" . '$segbdata_out[1]' . "\t" . '= $file_out[1].$suffix_segb;'; | ||
| 180 | $outbound_notes[3] = "\t" | ||
| 181 | . '$outbound[1]' . "\t" | ||
| 182 | . '= $DATA_SEISMIC_SEGB.' . "'/'" | ||
| 183 | . '.$segbdata_out[1];'; | ||
| 184 | |||
| 185 | } | ||
| 186 | |||
| 187 | sub set_segd_in { | ||
| 188 | |||
| 189 | $outbound_notes[1] = | ||
| 190 | "\t" . 'my (@file_in);' . "\n\t" . 'my (@segddata_in,@inbound);'; | ||
| 191 | $outbound_notes[2] = | ||
| 192 | "\t" . '$segddata_in[1]' . "\t" . '= $file_in[1].$suffix_segd;'; | ||
| 193 | $outbound_notes[3] = "\t" | ||
| 194 | . '$inbound[1]' . "\t" | ||
| 195 | . '= $DATA_SEISMIC_SEGD.' . "'/'" | ||
| 196 | . '.$segddata_in[1];'; | ||
| 197 | |||
| 198 | } | ||
| 199 | |||
| 200 | sub set_segd_out { | ||
| 201 | |||
| 202 | $outbound_notes[1] = | ||
| 203 | "\t" . 'my (@file_out);' . "\n\t" . 'my (@segbdata_out,@outbound);'; | ||
| 204 | $outbound_notes[2] = | ||
| 205 | "\t" . '$segddata_out[1]' . "\t" . '= $file_out[1].$suffix_segd;'; | ||
| 206 | $outbound_notes[3] = "\t" | ||
| 207 | . '$outbound[1]' . "\t" | ||
| 208 | . '= $DATA_SEISMIC_SEGD.' . "'/'" | ||
| 209 | . '.$segbdata_out[1];'; | ||
| 210 | |||
| 211 | } | ||
| 212 | |||
| 213 | sub set_segy_in { | ||
| 214 | |||
| 215 | $inbound_notes[1] = | ||
| 216 | "\t" . 'my (@file_in);' . "\n\t" . 'my (@segydata_in,@inbound);'; | ||
| 217 | $inbound_notes[2] = | ||
| 218 | "\t" . '$segydata_in[1]' . "\t" . '= $file_in[1].$suffix_segy;'; | ||
| 219 | $inbound_notes[3] = "\t" | ||
| 220 | . '$inbound[1]' . "\t" | ||
| 221 | . '= $DATA_SEISMIC_SEGY.' . "'/'" | ||
| 222 | . '.$segydata_in[1];'; | ||
| 223 | |||
| 224 | } | ||
| 225 | |||
| 226 | sub set_segy_out { | ||
| 227 | |||
| 228 | $outbound_notes[1] = | ||
| 229 | "\t" . 'my (@file_out);' . "\n\t" . 'my (@segydata_out,@outbound);'; | ||
| 230 | $outbound_notes[2] = | ||
| 231 | "\t" . '$segydata_out[1]' . "\t" . '= $file_out[1].$suffix_segy;'; | ||
| 232 | $outbound_notes[3] = "\t" | ||
| 233 | . '$outbound[1]' . "\t" | ||
| 234 | . '= $DATA_SEISMIC_SU.' . "'/'" | ||
| 235 | . '.$segydata_out[1];'; | ||
| 236 | |||
| 237 | } | ||
| 238 | |||
| 239 | =head2 sub _set_segb_out | ||
| 240 | |||
| 241 | prepare to use segb files | ||
| 242 | |||
| 243 | =cut | ||
| 244 | |||
| 245 | sub _set_segb_out { | ||
| 246 | my ($self) = @_; | ||
| 247 | $outbound_notes[0] = | ||
| 248 | "\n\t" . 'my ($DATA_SEISMIC_SEGB) = $Project->DATA_SEISMIC_SEGB();'; | ||
| 249 | |||
| 250 | } | ||
| 251 | |||
| 252 | =head2 sub _set_segd_out | ||
| 253 | |||
| 254 | prepare to use segd files | ||
| 255 | |||
| 256 | =cut | ||
| 257 | |||
| 258 | sub _set_segd_out { | ||
| 259 | my ($self) = @_; | ||
| 260 | $outbound_notes[0] = | ||
| 261 | "\n\t" . 'my ($DATA_SEISMIC_SEGD) = $Project->DATA_SEISMIC_SEGD();'; | ||
| 262 | |||
| 263 | } | ||
| 264 | |||
| 265 | =head2 sub _set_segy_out | ||
| 266 | |||
| 267 | prepare to use segy files | ||
| 268 | |||
| 269 | =cut | ||
| 270 | |||
| 271 | sub _set_segy_out { | ||
| 272 | my ($self) = @_; | ||
| 273 | $outbound_notes[0] = | ||
| 274 | "\n\t" . 'my ($DATA_SEISMIC_SEGY) = $Project->DATA_SEISMIC_SEGY();'; | ||
| 275 | |||
| 276 | } | ||
| 277 | |||
| 278 | =head2 sub _set_su_out | ||
| 279 | |||
| 280 | prepare to use su files | ||
| 281 | |||
| 282 | =cut | ||
| 283 | |||
| 284 | sub _set_su_out { | ||
| 285 | my ($self) = @_; | ||
| 286 | $outbound_notes[0] = | ||
| 287 | "\n\t" . 'my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();'; | ||
| 288 | |||
| 289 | } | ||
| 290 | |||
| 291 | =head2 sub _set_text_out | ||
| 292 | |||
| 293 | prepare to use su files | ||
| 294 | |||
| 295 | =cut | ||
| 296 | |||
| 297 | sub _set_text_out { | ||
| 298 | my ($self) = @_; | ||
| 299 | $outbound_notes[0] = | ||
| 300 | "\n\t" . 'my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT();'; | ||
| 301 | |||
| 302 | } | ||
| 303 | |||
| 304 | =head2 sub _set_bin_out | ||
| 305 | |||
| 306 | prepare to use su files | ||
| 307 | |||
| 308 | =cut | ||
| 309 | |||
| 310 | sub _set_bin_out { | ||
| 311 | my ($variable) = @_; | ||
| 312 | $outbound_notes[0] = | ||
| 313 | "\n\t" . 'my ($DATA_SEISMIC_BIN) = $Project->DATA_SEISMIC_BIN();'; | ||
| 314 | |||
| 315 | } | ||
| 316 | |||
| 317 | =head2 sub _set_segb_in | ||
| 318 | |||
| 319 | prepare to use segb files | ||
| 320 | |||
| 321 | =cut | ||
| 322 | |||
| 323 | sub _set_segb_in { | ||
| 324 | my ($self) = @_; | ||
| 325 | $inbound_notes[0] = | ||
| 326 | "\n\t" . 'my ($DATA_SEISMIC_SEGB) = $Project->DATA_SEISMIC_SEGB();'; | ||
| 327 | } | ||
| 328 | |||
| 329 | =head2 sub _set_segd_in | ||
| 330 | |||
| 331 | prepare to use segd files | ||
| 332 | |||
| 333 | =cut | ||
| 334 | |||
| 335 | sub _set_segd_in { | ||
| 336 | my ($self) = @_; | ||
| 337 | $inbound_notes[0] = | ||
| 338 | "\n\t" . 'my ($DATA_SEISMIC_SEGD) = $Project->DATA_SEISMIC_SEGD();'; | ||
| 339 | } | ||
| 340 | |||
| 341 | =head2 sub _set_segy_in | ||
| 342 | |||
| 343 | prepare to use segy files | ||
| 344 | |||
| 345 | =cut | ||
| 346 | |||
| 347 | sub _set_segy_in { | ||
| 348 | my ($self) = @_; | ||
| 349 | $inbound_notes[0] = | ||
| 350 | "\n\t" . 'my ($DATA_SEISMIC_SEGY) = $Project->DATA_SEISMIC_SEGY();'; | ||
| 351 | } | ||
| 352 | |||
| 353 | =head2 sub _set_su_in | ||
| 354 | |||
| 355 | prepare to use su files | ||
| 356 | |||
| 357 | =cut | ||
| 358 | |||
| 359 | sub _set_su_in { | ||
| 360 | my ($self) = @_; | ||
| 361 | $inbound_notes[0] = | ||
| 362 | "\n\t" . 'my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();'; | ||
| 363 | } | ||
| 364 | |||
| 365 | =head2 sub _set_text_in | ||
| 366 | |||
| 367 | prepare to use su files | ||
| 368 | |||
| 369 | =cut | ||
| 370 | |||
| 371 | sub _set_text_in { | ||
| 372 | my ($self) = @_; | ||
| 373 | $inbound_notes[0] = | ||
| 374 | "\n\t" . 'my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT();'; | ||
| 375 | } | ||
| 376 | |||
| 377 | =head2 sub _set_bin_in | ||
| 378 | |||
| 379 | prepare to use su files | ||
| 380 | |||
| 381 | =cut | ||
| 382 | |||
| 383 | sub _set_bin_in { | ||
| 384 | my ($variable) = @_; | ||
| 385 | $inbound_notes[0] = | ||
| 386 | "\n\t" . 'my ($DATA_SEISMIC_BIN) = $Project->DATA_SEISMIC_BIN();'; | ||
| 387 | |||
| 388 | } | ||
| 389 | |||
| 390 | =pod | ||
| 391 | |||
| 392 | =head2 subroutine set_suffix_type_in | ||
| 393 | |||
| 394 | you need to know how many numbers per line | ||
| 395 | will be in the output file | ||
| 396 | |||
| 397 | =cut | ||
| 398 | |||
| 399 | sub set_suffix_type_in { | ||
| 400 | my ( $variable, $suffix_type_in ) = @_; | ||
| 401 | |||
| 402 | if ($suffix_type_in) { | ||
| 403 | |||
| 404 | if ( $suffix_type_in eq 'segb' ) { | ||
| 405 | |||
| 406 | _set_segb_in(); | ||
| 407 | |||
| 408 | } | ||
| 409 | elsif ( $suffix_type_in eq 'segd' ) { | ||
| 410 | |||
| 411 | _set_segd_in(); | ||
| 412 | |||
| 413 | } | ||
| 414 | elsif ( $suffix_type_in eq 'segy' ) { | ||
| 415 | |||
| 416 | _set_segy_in(); | ||
| 417 | |||
| 418 | } | ||
| 419 | elsif ( $suffix_type_in eq 'su' ) { | ||
| 420 | |||
| 421 | # print("oop_declare_data_out,set_suffix_type_in,suffix_type_in:$suffix_type_in\n"); | ||
| 422 | _set_su_in(); | ||
| 423 | |||
| 424 | } | ||
| 425 | elsif ( $suffix_type_in eq 'text' ) { | ||
| 426 | |||
| 427 | _set_text_in(); | ||
| 428 | |||
| 429 | } | ||
| 430 | elsif ( $suffix_type_in eq 'bin' ) { | ||
| 431 | |||
| 432 | _set_bin_in(); | ||
| 433 | |||
| 434 | } | ||
| 435 | else { | ||
| 436 | print("\n"); | ||
| 437 | } | ||
| 438 | } | ||
| 439 | } | ||
| 440 | |||
| 441 | =head2 subroutine set_suffix_type_out | ||
| 442 | |||
| 443 | you need to know how many numbers per line | ||
| 444 | will be in the output file | ||
| 445 | |||
| 446 | =cut | ||
| 447 | |||
| 448 | sub set_suffix_type_out { | ||
| 449 | my ( $variable, $suffix_type_out ) = @_; | ||
| 450 | |||
| 451 | if ($suffix_type_out) { | ||
| 452 | |||
| 453 | if ( $suffix_type_out eq 'segb' ) { | ||
| 454 | |||
| 455 | _set_segb_out(); | ||
| 456 | } | ||
| 457 | elsif ( $suffix_type_out eq 'segd' ) { | ||
| 458 | |||
| 459 | # print("oop_declare_data_out,set_suffix_type_out,suffix_type_out:$suffix_type_out\n"); | ||
| 460 | _set_segd_out(); | ||
| 461 | |||
| 462 | } | ||
| 463 | elsif ( $suffix_type_out eq 'segy' ) { | ||
| 464 | |||
| 465 | # print("oop_declare_data_out,set_suffix_type_out,suffix_type_out:$suffix_type_out\n"); | ||
| 466 | _set_segy_out(); | ||
| 467 | |||
| 468 | } | ||
| 469 | elsif ( $suffix_type_out eq 'su' ) { | ||
| 470 | |||
| 471 | # print("oop_declare_data_out,set_suffix_type_out,suffix_type_out:$suffix_type_out\n"); | ||
| 472 | _set_su_out(); | ||
| 473 | |||
| 474 | } | ||
| 475 | elsif ( $suffix_type_out eq 'text' ) { | ||
| 476 | |||
| 477 | _set_text_out(); | ||
| 478 | |||
| 479 | } | ||
| 480 | elsif ( $suffix_type_out eq 'bin' ) { | ||
| 481 | |||
| 482 | _set_bin_out(); | ||
| 483 | |||
| 484 | } | ||
| 485 | else { | ||
| 486 | print( | ||
| 487 | "oop_declare_data_out,set_suffix_type_out,suffix_type_out:$suffix_type_out\n" | ||
| 488 | ); | ||
| 489 | } | ||
| 490 | } | ||
| 491 | } | ||
| 492 | |||
| 493 | 1; |