|
12 | 12 | ); |
13 | 13 |
|
14 | 14 | if ($gen_mode eq "CLN" || $gen_mode eq "SDP") { |
15 | | - print "#include <$_>\n" for qw(cstring gromox/exmdb_client.hpp gromox/exmdb_rpc.hpp); |
| 15 | + print "#include <$_>\n" for qw(cstring utility gromox/exmdb_client.hpp gromox/exmdb_rpc.hpp); |
16 | 16 | if ($gen_mode eq "SDP") { |
17 | 17 | print "#include <$_>\n" for qw(gromox/exmdb_common_util.hpp gromox/exmdb_ext.hpp gromox/exmdb_provider_client.hpp gromox/exmdb_server.hpp); |
18 | 18 | } |
|
56 | 56 | print "\tauto &r = *r1;\n"; |
57 | 57 | } |
58 | 58 | print "\treturn exmdb_server::$func(", join(", ", "q0->dir", |
59 | | - (map { my($type, $field) = @$_; "q.$field"; } @$iargs), |
60 | | - (map { my($type, $field) = @$_; "&r.$field"; } @$oargs), |
| 59 | + (map { my($type, $field) = @$_; (substr($type, -1, 1) eq "&" ? "*" : "")."q.$field"; } @$iargs), |
| 60 | + (map { my($type, $field) = @$_; (substr($type, -1, 1) eq "&" ? "" : "&")."r.$field"; } @$oargs), |
61 | 61 | ), ");\n}\n"; |
62 | 62 | next; |
63 | 63 | } |
|
68 | 68 | my($type, $field) = @$_; |
69 | 69 | if (substr($type, -1, 1) eq "*") { |
70 | 70 | print ", deconst($field)"; |
| 71 | + } elsif (substr($type, -1, 1) eq "&") { |
| 72 | + # struct members should continue to use a pointer, |
| 73 | + # because refs are so awkward to assign (more so during |
| 74 | + # deserialization than with serialization) |
| 75 | + print ", deconst(&$field)"; |
71 | 76 | } else { |
72 | 77 | print ", $field"; |
73 | 78 | } |
|
76 | 81 | print "\tif (!exmdb_client_do_rpc(&q, &r))\n\t\treturn false;\n"; |
77 | 82 | for (@$oargs) { |
78 | 83 | my($type, $field) = @$_; |
79 | | - print "\t*$field = r.$field;\n"; |
| 84 | + print "\t", (substr($type, -1, 1) eq "&" ? "" : "*"), |
| 85 | + "$field = std::move(r.$field);\n"; |
80 | 86 | } |
81 | 87 | print "\treturn TRUE;\n}\n\n"; |
82 | 88 | } |
|
0 commit comments