| 1 | # | ||||||||||||||
| 2 | # Autogenerated by Thrift Compiler (0.22.0) | ||||||||||||||
| 3 | # | ||||||||||||||
| 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||||||||||||||
| 5 | # | ||||||||||||||
| 6 | 1 | ▶ | use 5.10.0; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | 1 | ▶ | use Thrift::Exception; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 1 | ▶ | use Thrift::MessageType; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | 1 | ▶ | use Thrift::Type; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | |||||||||||||||
| 13 | 1 | ▶ | use Types; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 14 | |||||||||||||||
| 15 | |||||||||||||||
| 16 | # HELPER FUNCTIONS AND STRUCTURES | ||||||||||||||
| 17 | |||||||||||||||
| 18 | package Aggr_addValue_args; | ||||||||||||||
| 19 | 1 | ▶ | use base qw(Class::Accessor); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 20 | 1 | Aggr_addValue_args->mk_accessors( qw( value ) ); | |||||||||||||
| 21 | |||||||||||||||
| 22 | 10 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.8
| |||||||||||||||
| 23 | 10 | my $classname = shift; | |||||||||||||
| 24 | 10 | my $self = {}; | |||||||||||||
| 25 | 10 | ▶ | my $vals = shift || {}; | ||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||
| 26 | 10 | $self->{value} = undef; | |||||||||||||
| 27 | 10 | ▶ | if (UNIVERSAL::isa($vals,'HASH')) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 28 | 10 | ▶ | if (defined $vals->{value}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 29 | 0 | $self->{value} = $vals->{value}; | |||||||||||||
| 30 | } | ||||||||||||||
| 31 | } | ||||||||||||||
| 32 | 10 | return bless ($self, $classname); | |||||||||||||
| 33 | } | ||||||||||||||
| 34 | |||||||||||||||
| 35 | 0 | ▶ | sub getName { | ||||||||||||
|
Subroutine
getName: not called CC=1 SCAR=6.9
| |||||||||||||||
| 36 | 0 | return 'Aggr_addValue_args'; | |||||||||||||
| 37 | } | ||||||||||||||
| 38 | |||||||||||||||
| 39 | 5 | ▶ | sub read { | ||||||||||||
|
Subroutine
read: called CC=5 SCAR=16.3
| |||||||||||||||
| 40 | 5 | my ($self, $input) = @_; | |||||||||||||
| 41 | 5 | my $xfer = 0; | |||||||||||||
| 42 | 5 | my $fname; | |||||||||||||
| 43 | 5 | my $ftype = 0; | |||||||||||||
| 44 | 5 | my $fid = 0; | |||||||||||||
| 45 | 5 | $xfer += $input->readStructBegin(\$fname); | |||||||||||||
| 46 | 5 | while (1) | |||||||||||||
| 47 | { | ||||||||||||||
| 48 | 10 | $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); | |||||||||||||
| 49 | 10 | ▶ | if ($ftype == Thrift::TType::STOP) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 50 | 5 | last; | |||||||||||||
| 51 | } | ||||||||||||||
| 52 | 5 | SWITCH: for($fid) | |||||||||||||
| 53 | { | ||||||||||||||
| 54 | 5 | ▶ | /^1$/ && do{ if ($ftype == Thrift::TType::I32) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 55 | 5 | $xfer += $input->readI32(\$self->{value}); | |||||||||||||
| 56 | } else { | ||||||||||||||
| 57 | 0 | $xfer += $input->skip($ftype); | |||||||||||||
| 58 | } | ||||||||||||||
| 59 | 5 | last; }; | |||||||||||||
| 60 | 0 | $xfer += $input->skip($ftype); | |||||||||||||
| 61 | } | ||||||||||||||
| 62 | 5 | $xfer += $input->readFieldEnd(); | |||||||||||||
| 63 | } | ||||||||||||||
| 64 | 5 | $xfer += $input->readStructEnd(); | |||||||||||||
| 65 | 5 | return $xfer; | |||||||||||||
| 66 | } | ||||||||||||||
| 67 | |||||||||||||||
| 68 | 5 | ▶ | sub write { | ||||||||||||
|
Subroutine
write: called CC=2 SCAR=6.9
| |||||||||||||||
| 69 | 5 | my ($self, $output) = @_; | |||||||||||||
| 70 | 5 | my $xfer = 0; | |||||||||||||
| 71 | 5 | $xfer += $output->writeStructBegin('Aggr_addValue_args'); | |||||||||||||
| 72 | 5 | ▶ | if (defined $self->{value}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 73 | 5 | $xfer += $output->writeFieldBegin('value', Thrift::TType::I32, 1); | |||||||||||||
| 74 | 5 | $xfer += $output->writeI32($self->{value}); | |||||||||||||
| 75 | 5 | $xfer += $output->writeFieldEnd(); | |||||||||||||
| 76 | } | ||||||||||||||
| 77 | 5 | $xfer += $output->writeFieldStop(); | |||||||||||||
| 78 | 5 | $xfer += $output->writeStructEnd(); | |||||||||||||
| 79 | 5 | return $xfer; | |||||||||||||
| 80 | } | ||||||||||||||
| 81 | |||||||||||||||
| 82 | package Aggr_addValue_result; | ||||||||||||||
| 83 | 1 | ▶ | use base qw(Class::Accessor); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 84 | |||||||||||||||
| 85 | 10 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||
| 86 | 10 | my $classname = shift; | |||||||||||||
| 87 | 10 | my $self = {}; | |||||||||||||
| 88 | 10 | ▶ | my $vals = shift || {}; | ||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||
| 89 | 10 | return bless ($self, $classname); | |||||||||||||
| 90 | } | ||||||||||||||
| 91 | |||||||||||||||
| 92 | 0 | ▶ | sub getName { | ||||||||||||
|
Subroutine
getName: not called CC=1 SCAR=6.9
| |||||||||||||||
| 93 | 0 | return 'Aggr_addValue_result'; | |||||||||||||
| 94 | } | ||||||||||||||
| 95 | |||||||||||||||
| 96 | 5 | ▶ | sub read { | ||||||||||||
|
Subroutine
read: called CC=3 SCAR=11.4
| |||||||||||||||
| 97 | 5 | my ($self, $input) = @_; | |||||||||||||
| 98 | 5 | my $xfer = 0; | |||||||||||||
| 99 | 5 | my $fname; | |||||||||||||
| 100 | 5 | my $ftype = 0; | |||||||||||||
| 101 | 5 | my $fid = 0; | |||||||||||||
| 102 | 5 | $xfer += $input->readStructBegin(\$fname); | |||||||||||||
| 103 | 5 | while (1) | |||||||||||||
| 104 | { | ||||||||||||||
| 105 | 5 | $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); | |||||||||||||
| 106 | 5 | ▶ | if ($ftype == Thrift::TType::STOP) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 107 | 5 | last; | |||||||||||||
| 108 | } | ||||||||||||||
| 109 | 0 | SWITCH: for($fid) | |||||||||||||
| 110 | { | ||||||||||||||
| 111 | 0 | $xfer += $input->skip($ftype); | |||||||||||||
| 112 | } | ||||||||||||||
| 113 | 0 | $xfer += $input->readFieldEnd(); | |||||||||||||
| 114 | } | ||||||||||||||
| 115 | 5 | $xfer += $input->readStructEnd(); | |||||||||||||
| 116 | 5 | return $xfer; | |||||||||||||
| 117 | } | ||||||||||||||
| 118 | |||||||||||||||
| 119 | 5 | ▶ | sub write { | ||||||||||||
|
Subroutine
write: called CC=1 SCAR=0.0
| |||||||||||||||
| 120 | 5 | my ($self, $output) = @_; | |||||||||||||
| 121 | 5 | my $xfer = 0; | |||||||||||||
| 122 | 5 | $xfer += $output->writeStructBegin('Aggr_addValue_result'); | |||||||||||||
| 123 | 5 | $xfer += $output->writeFieldStop(); | |||||||||||||
| 124 | 5 | $xfer += $output->writeStructEnd(); | |||||||||||||
| 125 | 5 | return $xfer; | |||||||||||||
| 126 | } | ||||||||||||||
| 127 | |||||||||||||||
| 128 | package Aggr_getValues_args; | ||||||||||||||
| 129 | 1 | ▶ | use base qw(Class::Accessor); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 130 | |||||||||||||||
| 131 | 2 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||
| 132 | 2 | my $classname = shift; | |||||||||||||
| 133 | 2 | my $self = {}; | |||||||||||||
| 134 | 2 | ▶ | my $vals = shift || {}; | ||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||
| 135 | 2 | return bless ($self, $classname); | |||||||||||||
| 136 | } | ||||||||||||||
| 137 | |||||||||||||||
| 138 | 0 | ▶ | sub getName { | ||||||||||||
|
Subroutine
getName: not called CC=1 SCAR=6.9
| |||||||||||||||
| 139 | 0 | return 'Aggr_getValues_args'; | |||||||||||||
| 140 | } | ||||||||||||||
| 141 | |||||||||||||||
| 142 | 1 | ▶ | sub read { | ||||||||||||
|
Subroutine
read: called CC=3 SCAR=11.4
| |||||||||||||||
| 143 | 1 | my ($self, $input) = @_; | |||||||||||||
| 144 | 1 | my $xfer = 0; | |||||||||||||
| 145 | 1 | my $fname; | |||||||||||||
| 146 | 1 | my $ftype = 0; | |||||||||||||
| 147 | 1 | my $fid = 0; | |||||||||||||
| 148 | 1 | $xfer += $input->readStructBegin(\$fname); | |||||||||||||
| 149 | 1 | while (1) | |||||||||||||
| 150 | { | ||||||||||||||
| 151 | 1 | $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); | |||||||||||||
| 152 | 1 | ▶ | if ($ftype == Thrift::TType::STOP) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 153 | 1 | last; | |||||||||||||
| 154 | } | ||||||||||||||
| 155 | 0 | SWITCH: for($fid) | |||||||||||||
| 156 | { | ||||||||||||||
| 157 | 0 | $xfer += $input->skip($ftype); | |||||||||||||
| 158 | } | ||||||||||||||
| 159 | 0 | $xfer += $input->readFieldEnd(); | |||||||||||||
| 160 | } | ||||||||||||||
| 161 | 1 | $xfer += $input->readStructEnd(); | |||||||||||||
| 162 | 1 | return $xfer; | |||||||||||||
| 163 | } | ||||||||||||||
| 164 | |||||||||||||||
| 165 | 1 | ▶ | sub write { | ||||||||||||
|
Subroutine
write: called CC=1 SCAR=0.0
| |||||||||||||||
| 166 | 1 | my ($self, $output) = @_; | |||||||||||||
| 167 | 1 | my $xfer = 0; | |||||||||||||
| 168 | 1 | $xfer += $output->writeStructBegin('Aggr_getValues_args'); | |||||||||||||
| 169 | 1 | $xfer += $output->writeFieldStop(); | |||||||||||||
| 170 | 1 | $xfer += $output->writeStructEnd(); | |||||||||||||
| 171 | 1 | return $xfer; | |||||||||||||
| 172 | } | ||||||||||||||
| 173 | |||||||||||||||
| 174 | package Aggr_getValues_result; | ||||||||||||||
| 175 | 1 | ▶ | use base qw(Class::Accessor); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 176 | 1 | Aggr_getValues_result->mk_accessors( qw( success ) ); | |||||||||||||
| 177 | |||||||||||||||
| 178 | 2 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=5 SCAR=17.6
| |||||||||||||||
| 179 | 2 | my $classname = shift; | |||||||||||||
| 180 | 2 | my $self = {}; | |||||||||||||
| 181 | 2 | ▶ | my $vals = shift || {}; | ||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||
| 182 | 2 | $self->{success} = undef; | |||||||||||||
| 183 | 2 | $self->{err} = undef; | |||||||||||||
| 184 | 2 | ▶ | if (UNIVERSAL::isa($vals,'HASH')) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 185 | 2 | ▶ | if (defined $vals->{success}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 186 | 0 | $self->{success} = $vals->{success}; | |||||||||||||
| 187 | } | ||||||||||||||
| 188 | 2 | ▶ | if (defined $vals->{err}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 189 | 0 | $self->{err} = $vals->{err}; | |||||||||||||
| 190 | } | ||||||||||||||
| 191 | } | ||||||||||||||
| 192 | 2 | return bless ($self, $classname); | |||||||||||||
| 193 | } | ||||||||||||||
| 194 | |||||||||||||||
| 195 | 0 | ▶ | sub getName { | ||||||||||||
|
Subroutine
getName: not called CC=1 SCAR=6.9
| |||||||||||||||
| 196 | 0 | return 'Aggr_getValues_result'; | |||||||||||||
| 197 | } | ||||||||||||||
| 198 | |||||||||||||||
| 199 | 1 | ▶ | sub read { | ||||||||||||
|
Subroutine
read: called CC=8 SCAR=22.6
| |||||||||||||||
| 200 | 1 | my ($self, $input) = @_; | |||||||||||||
| 201 | 1 | my $xfer = 0; | |||||||||||||
| 202 | 1 | my $fname; | |||||||||||||
| 203 | 1 | my $ftype = 0; | |||||||||||||
| 204 | 1 | my $fid = 0; | |||||||||||||
| 205 | 1 | $xfer += $input->readStructBegin(\$fname); | |||||||||||||
| 206 | 1 | while (1) | |||||||||||||
| 207 | { | ||||||||||||||
| 208 | 2 | $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); | |||||||||||||
| 209 | 2 | ▶ | if ($ftype == Thrift::TType::STOP) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 210 | 1 | last; | |||||||||||||
| 211 | } | ||||||||||||||
| 212 | 1 | SWITCH: for($fid) | |||||||||||||
| 213 | { | ||||||||||||||
| 214 | 1 | ▶ | /^0$/ && do{ if ($ftype == Thrift::TType::LIST) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 215 | { | ||||||||||||||
| 216 | 1 | my $_size0 = 0; | |||||||||||||
| 217 | 1 | $self->{success} = []; | |||||||||||||
| 218 | 1 | my $_etype3 = 0; | |||||||||||||
| 219 | 1 | $xfer += $input->readListBegin(\$_etype3, \$_size0); | |||||||||||||
| 220 | 1 | ▶ | for (my $_i4 = 0; $_i4 < $_size0; ++$_i4) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 221 | { | ||||||||||||||
| 222 | 5 | my $elem5 = undef; | |||||||||||||
| 223 | 5 | $xfer += $input->readI32(\$elem5); | |||||||||||||
| 224 | 5 | push(@{$self->{success}},$elem5); | |||||||||||||
| 225 | } | ||||||||||||||
| 226 | 1 | $xfer += $input->readListEnd(); | |||||||||||||
| 227 | } | ||||||||||||||
| 228 | } else { | ||||||||||||||
| 229 | 0 | $xfer += $input->skip($ftype); | |||||||||||||
| 230 | } | ||||||||||||||
| 231 | 1 | last; }; | |||||||||||||
| 232 | 0 | ▶ | /^1$/ && do{ if ($ftype == Thrift::TType::STRUCT) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 233 | 0 | $self->{err} = Error->new(); | |||||||||||||
| 234 | 0 | $xfer += $self->{err}->read($input); | |||||||||||||
| 235 | } else { | ||||||||||||||
| 236 | 0 | $xfer += $input->skip($ftype); | |||||||||||||
| 237 | } | ||||||||||||||
| 238 | 0 | last; }; | |||||||||||||
| 239 | 0 | $xfer += $input->skip($ftype); | |||||||||||||
| 240 | } | ||||||||||||||
| 241 | 1 | $xfer += $input->readFieldEnd(); | |||||||||||||
| 242 | } | ||||||||||||||
| 243 | 1 | $xfer += $input->readStructEnd(); | |||||||||||||
| 244 | 1 | return $xfer; | |||||||||||||
| 245 | } | ||||||||||||||
| 246 | |||||||||||||||
| 247 | 1 | ▶ | sub write { | ||||||||||||
|
Subroutine
write: called CC=4 SCAR=14.2
| |||||||||||||||
| 248 | 1 | my ($self, $output) = @_; | |||||||||||||
| 249 | 1 | my $xfer = 0; | |||||||||||||
| 250 | 1 | $xfer += $output->writeStructBegin('Aggr_getValues_result'); | |||||||||||||
| 251 | 1 | ▶ | if (defined $self->{success}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 252 | 1 | $xfer += $output->writeFieldBegin('success', Thrift::TType::LIST, 0); | |||||||||||||
| 253 | { | ||||||||||||||
| 254 | 1 | $xfer += $output->writeListBegin(Thrift::TType::I32, scalar(@{$self->{success}})); | |||||||||||||
| 255 | { | ||||||||||||||
| 256 | 1 | foreach my $iter6 (@{$self->{success}}) | |||||||||||||
| 257 | { | ||||||||||||||
| 258 | 5 | $xfer += $output->writeI32($iter6); | |||||||||||||
| 259 | } | ||||||||||||||
| 260 | } | ||||||||||||||
| 261 | 1 | $xfer += $output->writeListEnd(); | |||||||||||||
| 262 | } | ||||||||||||||
| 263 | 1 | $xfer += $output->writeFieldEnd(); | |||||||||||||
| 264 | } | ||||||||||||||
| 265 | 1 | ▶ | if (defined $self->{err}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 266 | 0 | $xfer += $output->writeFieldBegin('err', Thrift::TType::STRUCT, 1); | |||||||||||||
| 267 | 0 | $xfer += $self->{err}->write($output); | |||||||||||||
| 268 | 0 | $xfer += $output->writeFieldEnd(); | |||||||||||||
| 269 | } | ||||||||||||||
| 270 | 1 | $xfer += $output->writeFieldStop(); | |||||||||||||
| 271 | 1 | $xfer += $output->writeStructEnd(); | |||||||||||||
| 272 | 1 | return $xfer; | |||||||||||||
| 273 | } | ||||||||||||||
| 274 | |||||||||||||||
| 275 | package AggrIf; | ||||||||||||||
| 276 | |||||||||||||||
| 277 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 278 | |||||||||||||||
| 279 | |||||||||||||||
| 280 | 0 | ▶ | sub addValue{ | ||||||||||||
|
Subroutine
addValue: not called CC=1 SCAR=6.9
| |||||||||||||||
| 281 | 0 | my $self = shift; | |||||||||||||
| 282 | 0 | my $value = shift; | |||||||||||||
| 283 | |||||||||||||||
| 284 | 0 | die 'implement interface'; | |||||||||||||
| 285 | } | ||||||||||||||
| 286 | |||||||||||||||
| 287 | 0 | ▶ | sub getValues{ | ||||||||||||
|
Subroutine
getValues: not called CC=1 SCAR=6.9
| |||||||||||||||
| 288 | 0 | my $self = shift; | |||||||||||||
| 289 | |||||||||||||||
| 290 | 0 | die 'implement interface'; | |||||||||||||
| 291 | } | ||||||||||||||
| 292 | |||||||||||||||
| 293 | package AggrRest; | ||||||||||||||
| 294 | |||||||||||||||
| 295 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 296 | |||||||||||||||
| 297 | |||||||||||||||
| 298 | 0 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||
| 299 | 0 | my ($classname, $impl) = @_; | |||||||||||||
| 300 | 0 | my $self ={ impl => $impl }; | |||||||||||||
| 301 | |||||||||||||||
| 302 | 0 | return bless($self,$classname); | |||||||||||||
| 303 | } | ||||||||||||||
| 304 | |||||||||||||||
| 305 | 0 | ▶ | sub addValue{ | ||||||||||||
|
Subroutine
addValue: not called CC=2 SCAR=17.9
| |||||||||||||||
| 306 | 0 | my ($self, $request) = @_; | |||||||||||||
| 307 | |||||||||||||||
| 308 | 0 | ▶ | my $value = ($request->{'value'}) ? $request->{'value'} : undef; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 309 | 0 | return $self->{impl}->addValue($value); | |||||||||||||
| 310 | } | ||||||||||||||
| 311 | |||||||||||||||
| 312 | 0 | ▶ | sub getValues{ | ||||||||||||
|
Subroutine
getValues: not called CC=1 SCAR=6.9
| |||||||||||||||
| 313 | 0 | my ($self, $request) = @_; | |||||||||||||
| 314 | |||||||||||||||
| 315 | 0 | return $self->{impl}->getValues(); | |||||||||||||
| 316 | } | ||||||||||||||
| 317 | |||||||||||||||
| 318 | package AggrClient; | ||||||||||||||
| 319 | |||||||||||||||
| 320 | |||||||||||||||
| 321 | 1 | ▶ | use base qw(AggrIf); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 322 | 1 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||
| 323 | 1 | my ($classname, $input, $output) = @_; | |||||||||||||
| 324 | 1 | my $self = {}; | |||||||||||||
| 325 | 1 | $self->{input} = $input; | |||||||||||||
| 326 | 1 | ▶ | $self->{output} = defined $output ? $output : $input; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 327 | 1 | $self->{seqid} = 0; | |||||||||||||
| 328 | 1 | return bless($self,$classname); | |||||||||||||
| 329 | } | ||||||||||||||
| 330 | |||||||||||||||
| 331 | 0 | ▶ | sub addValue{ | ||||||||||||
|
Subroutine
addValue: not called CC=1 SCAR=6.9
| |||||||||||||||
| 332 | 0 | my $self = shift; | |||||||||||||
| 333 | 0 | my $value = shift; | |||||||||||||
| 334 | |||||||||||||||
| 335 | 0 | $self->send_addValue($value); | |||||||||||||
| 336 | 0 | $self->recv_addValue(); | |||||||||||||
| 337 | } | ||||||||||||||
| 338 | |||||||||||||||
| 339 | 5 | ▶ | sub send_addValue{ | ||||||||||||
|
Subroutine
send_addValue: called CC=1 SCAR=0.0
| |||||||||||||||
| 340 | 5 | my $self = shift; | |||||||||||||
| 341 | 5 | my $value = shift; | |||||||||||||
| 342 | |||||||||||||||
| 343 | 5 | $self->{output}->writeMessageBegin('addValue', Thrift::TMessageType::CALL, $self->{seqid}); | |||||||||||||
| 344 | 5 | my $args = Aggr_addValue_args->new(); | |||||||||||||
| 345 | 5 | $args->{value} = $value; | |||||||||||||
| 346 | 5 | $args->write($self->{output}); | |||||||||||||
| 347 | 5 | $self->{output}->writeMessageEnd(); | |||||||||||||
| 348 | 5 | $self->{output}->getTransport()->flush(); | |||||||||||||
| 349 | } | ||||||||||||||
| 350 | |||||||||||||||
| 351 | 0 | ▶ | sub recv_addValue{ | ||||||||||||
|
Subroutine
recv_addValue: not called CC=2 SCAR=17.9
| |||||||||||||||
| 352 | 0 | my $self = shift; | |||||||||||||
| 353 | |||||||||||||||
| 354 | 0 | my $rseqid = 0; | |||||||||||||
| 355 | 0 | my $fname; | |||||||||||||
| 356 | 0 | my $mtype = 0; | |||||||||||||
| 357 | |||||||||||||||
| 358 | 0 | $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid); | |||||||||||||
| 359 | 0 | ▶ | if ($mtype == Thrift::TMessageType::EXCEPTION) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 360 | 0 | my $x = Thrift::TApplicationException->new(); | |||||||||||||
| 361 | 0 | $x->read($self->{input}); | |||||||||||||
| 362 | 0 | $self->{input}->readMessageEnd(); | |||||||||||||
| 363 | 0 | die $x; | |||||||||||||
| 364 | } | ||||||||||||||
| 365 | 0 | my $result = Aggr_addValue_result->new(); | |||||||||||||
| 366 | 0 | $result->read($self->{input}); | |||||||||||||
| 367 | 0 | $self->{input}->readMessageEnd(); | |||||||||||||
| 368 | |||||||||||||||
| 369 | 0 | return; | |||||||||||||
| 370 | } | ||||||||||||||
| 371 | 0 | ▶ | sub getValues{ | ||||||||||||
|
Subroutine
getValues: not called CC=1 SCAR=6.9
| |||||||||||||||
| 372 | 0 | my $self = shift; | |||||||||||||
| 373 | |||||||||||||||
| 374 | 0 | $self->send_getValues(); | |||||||||||||
| 375 | 0 | return $self->recv_getValues(); | |||||||||||||
| 376 | } | ||||||||||||||
| 377 | |||||||||||||||
| 378 | 1 | ▶ | sub send_getValues{ | ||||||||||||
|
Subroutine
send_getValues: called CC=1 SCAR=0.0
| |||||||||||||||
| 379 | 1 | my $self = shift; | |||||||||||||
| 380 | |||||||||||||||
| 381 | 1 | $self->{output}->writeMessageBegin('getValues', Thrift::TMessageType::CALL, $self->{seqid}); | |||||||||||||
| 382 | 1 | my $args = Aggr_getValues_args->new(); | |||||||||||||
| 383 | 1 | $args->write($self->{output}); | |||||||||||||
| 384 | 1 | $self->{output}->writeMessageEnd(); | |||||||||||||
| 385 | 1 | $self->{output}->getTransport()->flush(); | |||||||||||||
| 386 | } | ||||||||||||||
| 387 | |||||||||||||||
| 388 | 0 | ▶ | sub recv_getValues{ | ||||||||||||
|
Subroutine
recv_getValues: not called CC=4 SCAR=30.0
| |||||||||||||||
| 389 | 0 | my $self = shift; | |||||||||||||
| 390 | |||||||||||||||
| 391 | 0 | my $rseqid = 0; | |||||||||||||
| 392 | 0 | my $fname; | |||||||||||||
| 393 | 0 | my $mtype = 0; | |||||||||||||
| 394 | |||||||||||||||
| 395 | 0 | $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid); | |||||||||||||
| 396 | 0 | ▶ | if ($mtype == Thrift::TMessageType::EXCEPTION) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 397 | 0 | my $x = Thrift::TApplicationException->new(); | |||||||||||||
| 398 | 0 | $x->read($self->{input}); | |||||||||||||
| 399 | 0 | $self->{input}->readMessageEnd(); | |||||||||||||
| 400 | 0 | die $x; | |||||||||||||
| 401 | } | ||||||||||||||
| 402 | 0 | my $result = Aggr_getValues_result->new(); | |||||||||||||
| 403 | 0 | $result->read($self->{input}); | |||||||||||||
| 404 | 0 | $self->{input}->readMessageEnd(); | |||||||||||||
| 405 | |||||||||||||||
| 406 | 0 | ▶ | if (defined $result->{success} ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 407 | 0 | return $result->{success}; | |||||||||||||
| 408 | } | ||||||||||||||
| 409 | 0 | ▶ | if (defined $result->{err}) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 410 | 0 | die $result->{err}; | |||||||||||||
| 411 | } | ||||||||||||||
| 412 | 0 | die "getValues failed: unknown result"; | |||||||||||||
| 413 | } | ||||||||||||||
| 414 | package AggrProcessor; | ||||||||||||||
| 415 | |||||||||||||||
| 416 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 417 | |||||||||||||||
| 418 | |||||||||||||||
| 419 | 1 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||
| 420 | 1 | my ($classname, $handler) = @_; | |||||||||||||
| 421 | 1 | my $self = {}; | |||||||||||||
| 422 | 1 | $self->{handler} = $handler; | |||||||||||||
| 423 | 1 | return bless ($self, $classname); | |||||||||||||
| 424 | } | ||||||||||||||
| 425 | |||||||||||||||
| 426 | 6 | ▶ | sub process { | ||||||||||||
|
Subroutine
process: called CC=2 SCAR=8.9
| |||||||||||||||
| 427 | 6 | my ($self, $input, $output) = @_; | |||||||||||||
| 428 | 6 | my $rseqid = 0; | |||||||||||||
| 429 | 6 | my $fname = undef; | |||||||||||||
| 430 | 6 | my $mtype = 0; | |||||||||||||
| 431 | |||||||||||||||
| 432 | 6 | $input->readMessageBegin(\$fname, \$mtype, \$rseqid); | |||||||||||||
| 433 | 6 | my $methodname = 'process_'.$fname; | |||||||||||||
| 434 | 6 | ▶ | if (!$self->can($methodname)) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 435 | 0 | $input->skip(Thrift::TType::STRUCT); | |||||||||||||
| 436 | 0 | $input->readMessageEnd(); | |||||||||||||
| 437 | 0 | my $x = Thrift::TApplicationException->new('Function '.$fname.' not implemented.', Thrift::TApplicationException::UNKNOWN_METHOD); | |||||||||||||
| 438 | 0 | $output->writeMessageBegin($fname, Thrift::TMessageType::EXCEPTION, $rseqid); | |||||||||||||
| 439 | 0 | $x->write($output); | |||||||||||||
| 440 | 0 | $output->writeMessageEnd(); | |||||||||||||
| 441 | 0 | $output->getTransport()->flush(); | |||||||||||||
| 442 | 0 | return; | |||||||||||||
| 443 | } | ||||||||||||||
| 444 | 6 | $self->$methodname($rseqid, $input, $output); | |||||||||||||
| 445 | 6 | return 1; | |||||||||||||
| 446 | } | ||||||||||||||
| 447 | |||||||||||||||
| 448 | 5 | ▶ | sub process_addValue { | ||||||||||||
|
Subroutine
process_addValue: called CC=1 SCAR=0.0
| |||||||||||||||
| 449 | 5 | my ($self, $seqid, $input, $output) = @_; | |||||||||||||
| 450 | 5 | my $args = Aggr_addValue_args->new(); | |||||||||||||
| 451 | 5 | $args->read($input); | |||||||||||||
| 452 | 5 | $input->readMessageEnd(); | |||||||||||||
| 453 | 5 | my $result = Aggr_addValue_result->new(); | |||||||||||||
| 454 | 5 | $self->{handler}->addValue($args->value); | |||||||||||||
| 455 | 5 | $output->writeMessageBegin('addValue', Thrift::TMessageType::REPLY, $seqid); | |||||||||||||
| 456 | 5 | $result->write($output); | |||||||||||||
| 457 | 5 | $output->writeMessageEnd(); | |||||||||||||
| 458 | 5 | $output->getTransport()->flush(); | |||||||||||||
| 459 | } | ||||||||||||||
| 460 | |||||||||||||||
| 461 | 1 | ▶ | sub process_getValues { | ||||||||||||
|
Subroutine
process_getValues: called CC=3 SCAR=13.3
| |||||||||||||||
| 462 | 1 | my ($self, $seqid, $input, $output) = @_; | |||||||||||||
| 463 | 1 | my $args = Aggr_getValues_args->new(); | |||||||||||||
| 464 | 1 | $args->read($input); | |||||||||||||
| 465 | 1 | $input->readMessageEnd(); | |||||||||||||
| 466 | 1 | my $result = Aggr_getValues_result->new(); | |||||||||||||
| 467 | 1 | eval { | |||||||||||||
| 468 | 1 | $result->{success} = $self->{handler}->getValues(); | |||||||||||||
| 469 | 1 | ▶ | }; if( UNIVERSAL::isa($@,'Error') ){ | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 470 | 0 | $result->{err} = $@; | |||||||||||||
| 471 | 0 | $@ = undef; | |||||||||||||
| 472 | } | ||||||||||||||
| 473 | 1 | ▶ | if ($@) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 474 | 0 | $@ =~ s/^\s+|\s+$//g; | |||||||||||||
| 475 | 0 | my $err = Thrift::TApplicationException->new("Unexpected Exception: " . $@, Thrift::TApplicationException::INTERNAL_ERROR); | |||||||||||||
| 476 | 0 | $output->writeMessageBegin('getValues', Thrift::TMessageType::EXCEPTION, $seqid); | |||||||||||||
| 477 | 0 | $err->write($output); | |||||||||||||
| 478 | 0 | $output->writeMessageEnd(); | |||||||||||||
| 479 | 0 | $output->getTransport()->flush(); | |||||||||||||
| 480 | 0 | $@ = undef; | |||||||||||||
| 481 | 0 | return; | |||||||||||||
| 482 | } | ||||||||||||||
| 483 | 1 | $output->writeMessageBegin('getValues', Thrift::TMessageType::REPLY, $seqid); | |||||||||||||
| 484 | 1 | $result->write($output); | |||||||||||||
| 485 | 1 | $output->writeMessageEnd(); | |||||||||||||
| 486 | 1 | $output->getTransport()->flush(); | |||||||||||||
| 487 | } | ||||||||||||||
| 488 | |||||||||||||||
| 489 | 1 | 1; | |||||||||||||