jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
linear_mixable.hpp
Go to the documentation of this file.
1 // Copyright (C) 2014 Preferred Networks and Nippon Telegraph and Telephone Corporation.
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License version 2.1 as published by the Free Software Foundation.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 
16 #ifndef JUBATUS_CORE_FRAMEWORK_LINEAR_MIXABLE_HPP_
17 #define JUBATUS_CORE_FRAMEWORK_LINEAR_MIXABLE_HPP_
18 
19 #include <msgpack.hpp>
20 #include "jubatus/util/lang/shared_ptr.h"
21 #include "../common/exception.hpp"
22 #include "mixable.hpp"
23 #include "packer.hpp"
24 
25 namespace jubatus {
26 namespace core {
27 namespace framework {
28 
30  public:
31  virtual ~diff_object_raw();
32  virtual void convert_binary(packer&) const = 0;
33 };
34 
35 typedef jubatus::util::lang::shared_ptr<diff_object_raw> diff_object;
36 
37 // public interface for Jubatus users
38 class linear_mixable : public virtual mixable {
39  public:
41  virtual ~linear_mixable();
42 
43  virtual diff_object convert_diff_object(const msgpack::object&) const = 0;
44  // mix assumes fold left?
45  virtual void mix(const msgpack::object& obj, diff_object) const = 0;
46  virtual void get_diff(packer&) const = 0;
47  virtual bool put_diff(const diff_object& obj) = 0;
48 };
49 
50 
51 } // namespace framework
52 } // namespace core
53 } // namespace jubatus
54 
55 #endif // JUBATUS_CORE_FRAMEWORK_LINEAR_MIXABLE_HPP_
virtual void mix(const msgpack::object &obj, diff_object) const =0
jubatus::util::lang::shared_ptr< diff_object_raw > diff_object
virtual bool put_diff(const diff_object &obj)=0
virtual diff_object convert_diff_object(const msgpack::object &) const =0
virtual void get_diff(packer &) const =0
virtual void convert_binary(packer &) const =0