libfoedus-core
FOEDUS Core Library
proc_manager.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
19 
20 #include <string>
21 #include <vector>
22 
23 #include "foedus/proc/proc_id.hpp"
25 
26 namespace foedus {
27 namespace proc {
28 ProcManager::ProcManager(Engine* engine) : pimpl_(nullptr) {
29  pimpl_ = new ProcManagerPimpl(engine);
30 }
32  delete pimpl_;
33  pimpl_ = nullptr;
34 }
35 
37 bool ProcManager::is_initialized() const { return pimpl_->is_initialized(); }
39 
41  return pimpl_->get_proc(name, out);
42 }
43 
45  return pimpl_->pre_register(proc_and_name);
46 }
48  return pimpl_->local_register(proc_and_name);
49 }
51  return pimpl_->emulated_register(proc_and_name);
52 }
53 
54 const std::vector< ProcAndName >& ProcManager::get_pre_registered_procedures() const {
55  return pimpl_->pre_registered_procs_;
56 }
58  return pimpl_->describe_registered_procs();
59 }
60 
61 
62 } // namespace proc
63 } // namespace foedus
ErrorStack local_register(const ProcAndName &proc_and_name)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
ErrorStack emulated_register(const ProcAndName &proc_and_name)
Register a function pointer as a user procedure in all SOCs, assuming that child SOCs are of kChildEm...
ErrorStack uninitialize() override final
Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics...
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
ErrorStack pre_register(const ProcAndName &proc_and_name)
ErrorStack uninitialize() override
An idempotent method to release all resources of this object, if any.
std::string describe_registered_procs() const
For debug uses only.
bool is_initialized() const override
Returns whether the object has been already initialized or not.
ErrorStack initialize() override final
Typical implementation of Initializable::initialize() that provides initialize-once semantics...
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
ErrorStack initialize() override
Acquires resources in this object, usually called right after constructor.
Typedefs of ID types used in procedure package.
std::string describe_registered_procs() const
std::pair< ProcName, Proc > ProcAndName
Just a std::pair.
Definition: proc_id.hpp:119
ErrorStack get_proc(const ProcName &name, Proc *out)
const std::vector< ProcAndName > & get_pre_registered_procedures() const
Returns procedures given to pre_register()
ErrorStack emulated_register(const ProcAndName &proc_and_name)
ErrorStack pre_register(const ProcAndName &proc_and_name)
Pre-register a function pointer as a user procedure so that all SOCs will have it when they are forke...
ErrorStack get_proc(const ProcName &name, Proc *out)
Returns the function pointer of the specified procedure.
ErrorStack local_register(const ProcAndName &proc_and_name)
Register a function pointer as a user procedure in the current SOC.
ErrorStack(* Proc)(const ProcArguments &args)
A function pointer of a user/system stored procedure.
Definition: proc_id.hpp:113
Pimpl object of ProcManager.
bool is_initialized() const override final
Returns whether the object has been already initialized or not.
std::vector< ProcAndName > pre_registered_procs_