libfoedus-core
FOEDUS Core Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
log_type.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_LOG_LOG_TYPE_HPP_
19 #define FOEDUS_LOG_LOG_TYPE_HPP_
20 
21 #include "foedus/cxx11.hpp"
22 // include all header files that forward-declare log types defined in the xmacro.
23 // don't include headers that really declare them. we just need foward-declarations here.
30 
31 namespace foedus {
32 namespace log {
86 #define X(a, b, c) a = b,
87 enum LogCode {
90 #include "foedus/log/log_type.xmacro" // NOLINT
91 };
92 #undef X
93 
110 };
119  return static_cast<LogCodeKind>(code >> 12);
120 }
128 inline bool is_valid_log_type(LogCode code) {
129  switch (code) {
130 #define X(a, b, c) case a: return true;
131 #include "foedus/log/log_type.xmacro" // NOLINT
132 #undef X
133  default: return false;
134  }
135 }
136 
143 const char* get_log_type_name(LogCode code);
144 
153 template <typename LOG_TYPE>
155 
156 // give a template specialization for each log type class
157 #define X(a, b, c) template <> inline CXX11_CONSTEXPR LogCode get_log_code< c >() { return a ; }
158 #include "foedus/log/log_type.xmacro" // NOLINT
159 #undef X
160 
161 } // namespace log
162 } // namespace foedus
163 
164 #endif // FOEDUS_LOG_LOG_TYPE_HPP_
LogCode
A unique identifier of all log types.
Definition: log_type.hpp:87
markers/fillers
Definition: log_type.hpp:109
LogCodeKind
Represents the kind of log types.
Definition: log_type.hpp:101
Forward declarations of classes in log manager package.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
record targetted logs
Definition: log_type.hpp:103
#define CXX11_CONSTEXPR
Used in public headers in place of "constexpr" of C++11.
Definition: cxx11.hpp:130
Forward declarations of classes in array storage package.
constexpr LogCode get_log_code()
Returns LogCode for the log type defined in log_type.xmacro.
bool is_valid_log_type(LogCode code)
Returns if the LogCode value exists.
Definition: log_type.hpp:128
Forward declarations of classes in sequential storage package.
Forward declarations of classes in storage package.
LogCodeKind get_log_code_kind(LogCode code)
Returns the kind of the given log code.
Definition: log_type.hpp:118
engine targetted logs
Definition: log_type.hpp:107
const char * get_log_type_name(LogCode code)
Returns the names of LogCode enum defined in log_type.xmacro.
Definition: log_type.cpp:28
0 is reserved as a non-existing log type.
Definition: log_type.hpp:89
storage targetted logs
Definition: log_type.hpp:105
Forward declarations of classes in masstree storage package.
Forward declarations of classes in hash storage package.