diff src/parallel_execution/generate_stub.pl @ 693:aeab4866ee36

defined separate_code_and_data_gear_after_parse test
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 21 Aug 2020 17:07:01 +0900
parents 04df4583de36
children 469aff29c27c
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl	Fri Aug 21 15:57:24 2020 +0900
+++ b/src/parallel_execution/generate_stub.pl	Fri Aug 21 17:07:01 2020 +0900
@@ -11,6 +11,7 @@
 use FindBin;
 use lib "$FindBin::Bin/lib";
 
+use Gears::Interface;
 use Gears::Util;
 
 
@@ -197,11 +198,11 @@
                     }
                   }
                   unless ($typeName){
-                    print "[ERROR] $.: $_\n";
-                    die "[ERROR] not found $instance type\n";
+                    die "[ERROR] not found $instance type $.: $_\n";
                   }
                 }
 
+                my $res = findExistsOutputDataGear($typeName, $method);
                 print "[INFO] found instance $instance, typeName $typeName, cuurentCodeGear: $currentCodeGear, method: $method\n";
 
             } elsif (/^}$/) {
@@ -445,6 +446,37 @@
     return 1;
 }
 
+
+
+sub findExistsOutputDataGear {
+    my ($interfaceName, $method) = @_;
+                use DDP {deparse => 1};
+
+    my $interfacePATH = $interfaceNameToHeaderPath->{$interfaceName};
+    unless ($interfacePATH) {
+      return undef;
+    }
+
+    my $parsedInterface = Gears::Interface->separate_code_and_data_gear_after_parse($interfacePATH);
+
+    unless ($parsedInterface) {
+      return undef;
+    }
+
+    unless (exists $parsedInterface->{hasOutputArgs}->{$method}) {
+      return undef;
+    }
+
+    my $vname2types = $parsedInterface->{hasOutputArgs}->{$method};
+
+    use Data::Dumper;
+    print Dumper $parsedInterface;
+    p $parsedInterface;
+    my @outputArgs = keys %$vname2types;
+    return \@outputArgs;
+}
+
+
 sub generateDataGear {
     my ($filename) = @_;
     open my $in,"<",$filename or die("can't open $filename $!");