IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9870


Ignore:
Timestamp:
Nov 6, 2006, 5:18:39 PM (20 years ago)
Author:
Paul Price
Message:

Adding filenames to configuration parsing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Config/lib/PS/IPP/Config.pm

    r9504 r9870  
    11# Copyright (c) 2006  Paul Price, Joshua Hoblitt
    22#
    3 # $Id: Config.pm,v 1.2 2006-10-12 20:12:14 price Exp $
     3# $Id: Config.pm,v 1.3 2006-11-07 03:18:39 price Exp $
    44
    55package PS::IPP::Config;
     
    142142}
    143143
     144# Return a filename from the camera configuration FILERULES
     145sub filename
     146{
     147    my $self = shift;           # Configuration object
     148    my $name = shift;           # Name of the file
     149    my $output = shift;         # For replacing {OUTPUT}
     150    my $component = shift;      # For replacing {CHIP.NAME} and {CELL.NAME}
     151
     152    my $camera = $self->{camera}; # Camera configuration
     153    unless (defined $camera) {
     154        carp "Camera has not yet been defined.\n";
     155        return undef;
     156    }
     157
     158    my $filerules = _mdLookupMD($camera, 'FILERULES');  # File rules
     159    unless (defined $filerules) {
     160        carp "Can't find FILERULES list in camera configuration.\n";
     161        return undef;
     162    }
     163
     164    my $file = _mdLookupMD($filerules, $name); # The file of interest
     165    unless (defined $file) {
     166        carp "Can't find $name within FILERULES in camera configuration.\n";
     167        return undef;
     168    }
     169
     170    my $filename = _mdLookupStr($file, "FILENAME.RULE"); # File name
     171    unless (defined $filename) {
     172        carp "Can't find FILENAME.RULE for $name within FILERULES in camera configuration.\n";
     173        return undef;
     174    }
     175
     176    $filename =~ s/\{OUTPUT\}/$output/;
     177    $filename =~ s/\{CHIP\.NAME\}/$component/;
     178    $filename =~ s/\{CELL\.NAME\}/$component/;
     179
     180    return $filename;
     181}   
     182
    144183
    145184# Lookup the metadata, checking the type is STR
Note: See TracChangeset for help on using the changeset viewer.