jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
graph_factory.cpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2011,2012 Preferred Networks and Nippon Telegraph and Telephone Corporation.
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License version 2.1 as published by the Free Software Foundation.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #include <stdexcept>
18 #include <string>
19 
20 #include "graph_factory.hpp"
21 #include "graph.hpp"
22 #include "../common/exception.hpp"
23 #include "../common/jsonconfig.hpp"
24 
25 using jubatus::util::lang::shared_ptr;
26 
27 namespace jubatus {
28 namespace core {
29 namespace graph {
30 
31 shared_ptr<graph_wo_index> graph_factory::create_graph(
32  const std::string& name,
33  const common::jsonconfig::config& param) {
34  if (name == "graph_wo_index") {
35  return shared_ptr<graph_wo_index>(new graph_wo_index(
36  common::jsonconfig::config_cast_check<graph_wo_index::config>(param)));
37  } else {
38  throw JUBATUS_EXCEPTION(unknown_graph("unknown method name: " + name));
39  }
40 }
41 
42 } // namespace graph
43 } // namespace core
44 } // namespace jubatus
static jubatus::util::lang::shared_ptr< graph_wo_index > create_graph(const std::string &name, const common::jsonconfig::config &param)
#define JUBATUS_EXCEPTION(e)
Definition: exception.hpp:79