Files
pcas/src/tools/DBD/Breaktable.pm
Andrew Johnson 29a9ad3f90 Make the DBD parser recognize Pod syntax directly
Source DBD files can include Pod blocks, as long as the dbdExpand.pl
script doesn't try and include it in expanded DBD output files.
This makes it easier to write the Pod, and perldoc can parse most
of the result for checking (it complains about the =field directives
though, which dbdToHtml.pl handles itself).
2012-09-04 00:35:17 -05:00

52 lines
1.0 KiB
Perl

package DBD::Breaktable;
use DBD::Base;
@ISA = qw(DBD::Base);
use Carp;
sub init {
my ($this, $name) = @_;
$this->SUPER::init($name, "breakpoint table");
$this->{POINT_LIST} = [];
$this->{COMMENTS} = [];
return $this;
}
sub add_point {
my ($this, $raw, $eng) = @_;
confess "DBD::Breaktable::add_point: Raw value undefined!"
unless defined $raw;
confess "DBD::Breaktable::add_point: Engineering value undefined!"
unless defined $eng;
unquote $raw;
unquote $eng;
push @{$this->{POINT_LIST}}, [$raw, $eng];
}
sub points {
return @{shift->{POINT_LIST}};
}
sub point {
my ($this, $idx) = @_;
return $this->{POINT_LIST}[$idx];
}
sub add_comment {
my $this = shift;
push @{$this->{COMMENTS}}, @_;
}
sub comments {
return @{shift->{COMMENTS}};
}
sub equals {
my ($a, $b) = @_;
return $a->SUPER::equals($b)
&& join(',', map "$_->[0]:$_->[1]", @{$a->{POINT_LIST}})
eq join(',', map "$_->[0]:$_->[1]", @{$b->{POINT_LIST}});
}
1;