
| Current Path : /var/www/web-klick.de/dsh/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/web-klick.de/dsh/snippets_amtc-jobdeck-mebes.txt |
# The somewhat bread-and-butter AMTC-Perl libraries (you may want to check for the latest versions before use):
use lib '/sftw/AMTC-Jobdeck-Mebes/AMTC-Jobdeck-Mebes-1.5/lib',
'/sftw/amtc-common-perl/amtc-common-perl-5.20.2.1.008/lib',
'/sftw/perl/pmp-r5.20.2.5.0/lib';
use AMTC::FileUtils;
use AMTC::Jobdeck::Mebes::Builder;
use AMTC::Jobdeck::Mebes::Jobdeck; # (Patrick) This should be created by ::Builder (I guess).
use AMTC::Jobdeck::Mebes::JobdeckInfo; # (Patrick) Special jobdeck-"query" package (subsection below).
use AMTC::Jobdeck::Annotated::Jobdeck; # (Patrick) Never worked with that, but is essential for the project.
# ------------------------------------------------------------------------------
# AMTC::Jobdeck::Mebes::Builder
# ------------------------------------------------------------------------------
# read text file into array with AMTC custom lib
my @file_lines = AMTC::FileUtils::read_file($file_path);
# build parser object + parse()
my $jb = AMTC::Jobdeck::Mebes::Builder->new->parse(@file_lines); # parse from array of strings
# OPTIONS
my $jb_options = $jb->options(); # get OPTIONS section
my $has_option_m = $jb_options->has_option('M'); # check if 'OPTION M' is present, int_bool(1 | 0)
my $has_option_t = $jb_options->has_option('T'); # check if 'OPTION T' is present, int_bool(1 | 0)
# CHIPS
my @chips_level_all = $jb->chips->all(); # get all CHIPs present
my @chips_level_all = $jb->chips->by_level(0); # alternative call (level=0 equals 'all')
my @chips_level_3 = $jb->chips->by_level(3); # get all CHIPs for level 3
my @chips_by_name = $jb->chips->by_name($chip_name); # get all CHIPs by name
$chip->name(); # get a CHIP name (e.g. 'PRIME1-01')
my @pattern_assignments = $chip->pattern_assignments(); # get pattern-assignments from CHIP
my @pattern_assignments = $chip->pattern_assignment_by_level($level); # get pattern-assignments from CHIP + filter by level
my $pattern_name = $pattern_assignment->pattern_name(); # e.g. 'TOAAVVC-EF-01'
my $scale_factor = $pattern_assignment->get_opt2('SF'); # get scale-factor from pattern-assignment
# Jobdeck Section Example
# -----------------------
# CHIP PRIME1-01, # name
# $ (3,TOAAVVC-EF-01,AD=0.1,SF=1) # pattern-assignments
# ROWS 76200/76200
# -----------------------
# TITLES
my @jb_levels = $jb->titles->all_levels(); # get titles
my $has_d_title = $jb->titles->has_title('DTITLE', $level); # check DTITLE presence by level
my %jb_d_title = $jb->titles->get_title('DTITLE', $level); # get DTITLE by level
my $title_location = $jb_d_title{$level}->location(); # get DTITLE location by level
my $title_mirror = $title->mirror();
my $title_rotation = $title->rotation();
my $title_justification = $title->justification() // 'NA'; # (example with double slash OR operator)
my $title_text = $title->text();
# OTHER
$jb->{'slice'}->get('args'); # get jobdeck slice code
# file-section-* | example to query a specific jobdeck file section
my @filesection3_cmd = $jb->{'filesection3_cmds'}; # get commands of file-section-3 (e.g. 'ALPHA', 'ORTHO')
my @filesection4_cmd = $jb->{'filesection4_cmds'}; # get commands of file-section-4 (e.g. 'OFID')
my $name = $filesection3_cmd->get('name'); # get command specific properties
my $args = $filesection3_cmd->get('args'); # get command specific properties
# ------------------------------------------------------------------------------
# AMTC::Jobdeck::Mebes::JobdeckInfo
# -> optional subpackage to report contextual jobdeck properties
# ------------------------------------------------------------------------------
# optional subpackage to report contextual jobdeck properties
my $jb_info = AMTC::Jobdeck::Mebes::JobdeckInfo->new($jb);
my @jb_levels = $jb_info->unique_levels(); # get all unique levels present in a jobdeck
# basic jobdeck information...
my $resist_is_postive = $jb_info->level_info($level)->resist_is_positive();
my $resist_is_negative = $jb_info->level_info($level)->resist_is_negative();
my $is_mirrored = $jb_info->level_info($level)->level_is_mirrored();
# ...and example convertions to human readable strings (e.g. for reporting)
my $resist = $resist_is_postive ? 'PCAR' : 'NCAR';
my $mirror_verbal = $is_mirrored ? 'is mirrored (WR)' : 'is not mirrored (RR)';
my $mirror = $is_mirrored ? 'YES' : 'NO';
# ------------------------------------------------------------------------------
# Other
# ------------------------------------------------------------------------------
use Data::Dumper;
print("jb=\n" . Dumper($jb) . "\n"); # print runtime jobdeck data structure
# ------------------------------------------------------------------------------
# Notes/Issues
#
# * subsequent calls of different jobdecks within EVAL blocks can cause
# memory overlaps within runtime memory addresses (at least that's the
# practical effect) -> avoid EVAL-loops -> use command line calls
# ------------------------------------------------------------------------------