lib/Jubatus/Classifier/Types.pm untested

filter: Statementstmt 0.0% 0 / 109 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 31 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 150 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
to_msgpack
2.0
from_msgpack
2.0
CRAP 2.0
1 # This file is auto-generated from classifier.idl(0.4.5-347-g86989a6) with jenerator version 0.4.5-532-g61b108e/develop
2 # *** DO NOT EDIT ***
3  
4 package Jubatus::Classifier::EstimateResult;
5  
6 use strict;
7 use warnings;
8 use utf8;
9 use autodie;
10 use AnyEvent::MPRPC;
11  
12 use Jubatus::Common::Types;
13 use Jubatus::Common::Datum;
14 use Jubatus::Common::MessageStringGenerator;
15  
16 our $TYPE = Jubatus::Common::TTuple->new([Jubatus::Common::TString->new(),
17 Jubatus::Common::TFloat->new()]);
18  
19 sub new {
20 my ($self, $label, $score) = @_;
21 my %hash = (
22 'label' => $label,
23 'score' => $score,
24 );
25 bless \%hash, $self;
26 }
27  
28 sub to_msgpack {
29 my ($self) = @_;
30 return $TYPE->to_msgpack([
31 $self->{label}, $self->{score}
32 ]);
33 }
34  
35 sub from_msgpack {
36 my ($self, $args) = @_;
37 my $estimate_result = Jubatus::Classifier::EstimateResult->new(
38 @{ $TYPE->from_msgpack($args) });
39 return $estimate_result;
40 }
41  
42 sub to_s {
43 my ($self, $label, $score) = @_;
44 my $gen = Jubatus::Common::MessageStringGenerator->new();
45 $gen->open("estimate_result");
46 $gen->add("label", $self->{label});
47 $gen->add("score", $self->{score});
48 $gen->close();
49 return $gen->to_s();
50 }
51  
52 sub get_type {
53 return $TYPE;
54 }
55  
56 1;
57  
58 package Jubatus::Classifier::LabeledDatum;
59  
60 use strict;
61 use warnings;
62 use utf8;
63 use autodie;
64 use AnyEvent::MPRPC;
65  
66 use Jubatus::Common::Types;
67 use Jubatus::Common::Datum;
68 use Jubatus::Common::MessageStringGenerator;
69  
70 our $TYPE = Jubatus::Common::TTuple->new([Jubatus::Common::TString->new(),
71 Jubatus::Common::TDatum->new()]);
72  
73 sub new {
74 my ($self, $label, $data) = @_;
75 my %hash = (
76 'label' => $label,
77 'data' => $data,
78 );
79 bless \%hash, $self;
80 }
81  
82 sub to_msgpack {
83 my ($self) = @_;
84 return $TYPE->to_msgpack([
85 $self->{label}, $self->{data}
86 ]);
87 }
88  
89 sub from_msgpack {
90 my ($self, $args) = @_;
91 my $labeled_datum = Jubatus::Classifier::LabeledDatum->new(
92 @{ $TYPE->from_msgpack($args) });
93 return $labeled_datum;
94 }
95  
96 sub to_s {
97 my ($self, $label, $data) = @_;
98 my $gen = Jubatus::Common::MessageStringGenerator->new();
99 $gen->open("labeled_datum");
100 $gen->add("label", $self->{label});
101 $gen->add("data", $self->{data});
102 $gen->close();
103 return $gen->to_s();
104 }
105  
106 sub get_type {
107 return $TYPE;
108 }
109  
110 1;
111  
112 package Jubatus::Classifier::Types;
113  
114 use strict;
115 use warnings;
116 use utf8;
117 use autodie;
118 use AnyEvent::MPRPC;
119  
120 1; # Jubatus::Classifier::Types;
121