libfoedus-core
FOEDUS Core Library
proc_manager.hpp
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  */
18 #ifndef FOEDUS_PROC_PROC_MANAGER_HPP_
19 #define FOEDUS_PROC_PROC_MANAGER_HPP_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "foedus/fwd.hpp"
25 #include "foedus/initializable.hpp"
26 #include "foedus/proc/fwd.hpp"
27 #include "foedus/proc/proc_id.hpp"
28 
29 namespace foedus {
30 namespace proc {
35 class ProcManager CXX11_FINAL : public virtual Initializable {
36  public:
37  explicit ProcManager(Engine* engine);
38  ~ProcManager();
39 
40  // Disable default constructors
44 
46  bool is_initialized() const CXX11_OVERRIDE;
48 
55  ErrorStack get_proc(const ProcName& name, Proc* out);
56 
68  ErrorStack pre_register(const ProcAndName& proc_and_name);
70  ErrorStack pre_register(const ProcName& name, Proc proc) {
71  return pre_register(ProcAndName(name, proc));
72  }
73 
75  const std::vector< ProcAndName >& get_pre_registered_procedures() const;
76 
85  ErrorStack local_register(const ProcAndName& proc_and_name);
86 
97  ErrorStack emulated_register(const ProcAndName& proc_and_name);
98 
100  std::string describe_registered_procs() const;
101 
102  private:
103  ProcManagerPimpl *pimpl_;
104 };
105 } // namespace proc
106 } // namespace foedus
107 #endif // FOEDUS_PROC_PROC_MANAGER_HPP_
The pure-virtual interface to initialize/uninitialize non-trivial resources.
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...
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Procedure manager, which maintains the list of system/user procedures.
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.
ProcManager & operator=(const ProcManager &)=delete
bool is_initialized() const override
Returns whether the object has been already initialized or not.
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
Definition: cxx11.hpp:131
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::pair< ProcName, Proc > ProcAndName
Just a std::pair.
Definition: proc_id.hpp:119
const std::vector< ProcAndName > & get_pre_registered_procedures() const
Returns procedures given to pre_register()
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...
#define CXX11_OVERRIDE
Used in public headers in place of "override" of C++11.
Definition: cxx11.hpp:134
#define CXX11_FUNC_DELETE
Used in public headers in place of " = delete" of C++11.
Definition: cxx11.hpp:128
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.
Forward declarations of classes in proc package.
ErrorStack pre_register(const ProcName &name, Proc proc)
Just a synonym.