diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-05-16 15:48:34 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-05-16 15:48:34 +0200 |
commit | 458cf889e6ed331d9e5084cf8e199166ce983286 (patch) | |
tree | 11f070baffdb5589599d47985655881dc115681c /lib/Kratos/DFADriver.pm | |
parent | 2531355bd6c7020904e889164efde3a5bb19631f (diff) |
autogenerate simple models (without args or parameters) from AC++ attributes
Diffstat (limited to 'lib/Kratos/DFADriver.pm')
-rw-r--r-- | lib/Kratos/DFADriver.pm | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Kratos/DFADriver.pm b/lib/Kratos/DFADriver.pm index 8c8f780..7ceaa4a 100644 --- a/lib/Kratos/DFADriver.pm +++ b/lib/Kratos/DFADriver.pm @@ -35,11 +35,24 @@ sub new { $self->{dfa} = Kratos::DFADriver::DFA->new(%opt); $self->{mimosa} = MIMOSA->new(%opt); - $self->{model} = Kratos::DFADriver::Model->new(%opt); $self->{repo} = AspectC::Repo->new; - $self->{class_name} = $self->{model}->class_name; $self->{lp}{iteration} = 1; + if ( -r $opt{xml_file} ) { + $self->{model} = Kratos::DFADriver::Model->new(%opt); + $self->{class_name} = $self->{model}->class_name; + } + elsif ( $opt{class_name} ) { + $self->{model} = Kratos::DFADriver::Model->new_from_repo( + repo => $self->{repo}, + class_name => $opt{class_name}, + xml_file => $opt{xml_file}, + ); + } + else { + die('Neither driver.xml nor class name specified, cannot continue'); + } + bless( $self, $class ); $self->set_paths; |