/Users/deen/code/yugabyte-db/src/yb/gutil/callback_internal.h
Line | Count | Source |
1 | | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 | | // Use of this source code is governed by a BSD-style license that can be |
3 | | // found in the LICENSE file. |
4 | | // |
5 | | // The following only applies to changes made to this file as part of YugaByte development. |
6 | | // |
7 | | // Portions Copyright (c) YugaByte, Inc. |
8 | | // |
9 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
10 | | // in compliance with the License. You may obtain a copy of the License at |
11 | | // |
12 | | // http://www.apache.org/licenses/LICENSE-2.0 |
13 | | // |
14 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
15 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
16 | | // or implied. See the License for the specific language governing permissions and limitations |
17 | | // under the License. |
18 | | // |
19 | | |
20 | | // This file contains utility functions and classes that help the |
21 | | // implementation, and management of the Callback objects. |
22 | | |
23 | | #ifndef YB_GUTIL_CALLBACK_INTERNAL_H_ |
24 | | #define YB_GUTIL_CALLBACK_INTERNAL_H_ |
25 | | |
26 | | #include <stddef.h> |
27 | | |
28 | | #include "yb/gutil/ref_counted.h" |
29 | | #include "yb/gutil/template_util.h" |
30 | | #include "yb/gutil/type_traits.h" |
31 | | |
32 | | template <typename T> |
33 | | class ScopedVector; |
34 | | |
35 | | namespace yb { |
36 | | namespace internal { |
37 | | |
38 | | // BindStateBase is used to provide an opaque handle that the Callback |
39 | | // class can use to represent a function object with bound arguments. It |
40 | | // behaves as an existential type that is used by a corresponding |
41 | | // DoInvoke function to perform the function execution. This allows |
42 | | // us to shield the Callback class from the types of the bound argument via |
43 | | // "type erasure." |
44 | | class BindStateBase : public RefCountedThreadSafe<BindStateBase> { |
45 | | protected: |
46 | | friend class RefCountedThreadSafe<BindStateBase>; |
47 | 85.9M | virtual ~BindStateBase() {} |
48 | | }; |
49 | | |
50 | | // Holds the Callback methods that don't require specialization to reduce |
51 | | // template bloat. |
52 | | class CallbackBase { |
53 | | public: |
54 | | // Returns true if Callback is null (doesn't refer to anything). |
55 | | bool is_null() const; |
56 | | |
57 | | // Returns the Callback into an uninitialized state. |
58 | | void Reset(); |
59 | | |
60 | | protected: |
61 | | // In C++, it is safe to cast function pointers to function pointers of |
62 | | // another type. It is not okay to use void*. We create a InvokeFuncStorage |
63 | | // that that can store our function pointer, and then cast it back to |
64 | | // the original type on usage. |
65 | | typedef void(*InvokeFuncStorage)(void); |
66 | | |
67 | | // Returns true if this callback equals |other|. |other| may be null. |
68 | | bool Equals(const CallbackBase& other) const; |
69 | | |
70 | | // Allow initializing of |bind_state_| via the constructor to avoid default |
71 | | // initialization of the scoped_refptr. We do not also initialize |
72 | | // |polymorphic_invoke_| here because doing a normal assignment in the |
73 | | // derived Callback templates makes for much nicer compiler errors. |
74 | | explicit CallbackBase(BindStateBase* bind_state); |
75 | | |
76 | | // Force the destructor to be instantiated inside this translation unit so |
77 | | // that our subclasses will not get inlined versions. Avoids more template |
78 | | // bloat. |
79 | | ~CallbackBase(); |
80 | | |
81 | | scoped_refptr<BindStateBase> bind_state_; |
82 | | InvokeFuncStorage polymorphic_invoke_; |
83 | | }; |
84 | | |
85 | | // A helper template to determine if given type is non-const move-only-type, |
86 | | // i.e. if a value of the given type should be passed via .Pass() in a |
87 | | // destructive way. |
88 | | template <typename T> struct IsMoveOnlyType { |
89 | | template <typename U> |
90 | | static base::YesType Test(const typename U::MoveOnlyTypeForCPP03*); |
91 | | |
92 | | template <typename U> |
93 | | static base::NoType Test(...); |
94 | | |
95 | | static const bool value = sizeof(Test<T>(0)) == sizeof(base::YesType) && |
96 | | !base::is_const<T>::value; |
97 | | }; |
98 | | |
99 | | // This is a typetraits object that's used to take an argument type, and |
100 | | // extract a suitable type for storing and forwarding arguments. |
101 | | // |
102 | | // In particular, it strips off references, and converts arrays to |
103 | | // pointers for storage; and it avoids accidentally trying to create a |
104 | | // "reference of a reference" if the argument is a reference type. |
105 | | // |
106 | | // This array type becomes an issue for storage because we are passing bound |
107 | | // parameters by const reference. In this case, we end up passing an actual |
108 | | // array type in the initializer list which C++ does not allow. This will |
109 | | // break passing of C-string literals. |
110 | | template <typename T, bool is_move_only = IsMoveOnlyType<T>::value> |
111 | | struct CallbackParamTraits { |
112 | | typedef const T& ForwardType; |
113 | | typedef T StorageType; |
114 | | }; |
115 | | |
116 | | // The Storage should almost be impossible to trigger unless someone manually |
117 | | // specifies type of the bind parameters. However, in case they do, |
118 | | // this will guard against us accidentally storing a reference parameter. |
119 | | // |
120 | | // The ForwardType should only be used for unbound arguments. |
121 | | template <typename T> |
122 | | struct CallbackParamTraits<T&, false> { |
123 | | typedef T& ForwardType; |
124 | | typedef T StorageType; |
125 | | }; |
126 | | |
127 | | // Note that for array types, we implicitly add a const in the conversion. This |
128 | | // means that it is not possible to bind array arguments to functions that take |
129 | | // a non-const pointer. Trying to specialize the template based on a "const |
130 | | // T[n]" does not seem to match correctly, so we are stuck with this |
131 | | // restriction. |
132 | | template <typename T, size_t n> |
133 | | struct CallbackParamTraits<T[n], false> { |
134 | | typedef const T* ForwardType; |
135 | | typedef const T* StorageType; |
136 | | }; |
137 | | |
138 | | // See comment for CallbackParamTraits<T[n]>. |
139 | | template <typename T> |
140 | | struct CallbackParamTraits<T[], false> { |
141 | | typedef const T* ForwardType; |
142 | | typedef const T* StorageType; |
143 | | }; |
144 | | |
145 | | // Parameter traits for movable-but-not-copyable scopers. |
146 | | // |
147 | | // Callback<>/Bind() understands movable-but-not-copyable semantics where |
148 | | // the type cannot be copied but can still have its state destructively |
149 | | // transferred (aka. moved) to another instance of the same type by calling a |
150 | | // helper function. When used with Bind(), this signifies transferal of the |
151 | | // object's state to the target function. |
152 | | // |
153 | | // For these types, the ForwardType must not be a const reference, or a |
154 | | // reference. A const reference is inappropriate, and would break const |
155 | | // correctness, because we are implementing a destructive move. A non-const |
156 | | // reference cannot be used with temporaries which means the result of a |
157 | | // function or a cast would not be usable with Callback<> or Bind(). |
158 | | template <typename T> |
159 | | struct CallbackParamTraits<T, true> { |
160 | | typedef T ForwardType; |
161 | | typedef T StorageType; |
162 | | }; |
163 | | |
164 | | // CallbackForward() is a very limited simulation of C++11's std::forward() |
165 | | // used by the Callback/Bind system for a set of movable-but-not-copyable |
166 | | // types. It is needed because forwarding a movable-but-not-copyable |
167 | | // argument to another function requires us to invoke the proper move |
168 | | // operator to create a rvalue version of the type. The supported types are |
169 | | // whitelisted below as overloads of the CallbackForward() function. The |
170 | | // default template compiles out to be a no-op. |
171 | | // |
172 | | // In C++11, std::forward would replace all uses of this function. However, it |
173 | | // is impossible to implement a general std::forward with C++11 due to a lack |
174 | | // of rvalue references. |
175 | | // |
176 | | // In addition to Callback/Bind, this is used by PostTaskAndReplyWithResult to |
177 | | // simulate std::forward() and forward the result of one Callback as a |
178 | | // parameter to another callback. This is to support Callbacks that return |
179 | | // the movable-but-not-copyable types whitelisted above. |
180 | | template <typename T> |
181 | 805M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { |
182 | 805M | return t; |
183 | 805M | } base::enable_if<!(IsMoveOnlyType<yb::server::HybridClock*>::value), yb::server::HybridClock*>::type& yb::internal::CallbackForward<yb::server::HybridClock*>(yb::server::HybridClock*&) Line | Count | Source | 181 | 92.9k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 92.9k | return t; | 183 | 92.9k | } |
base::enable_if<!(IsMoveOnlyType<unsigned long long const>::value), unsigned long long const>::type& yb::internal::CallbackForward<unsigned long long const>(unsigned long long const&) Line | Count | Source | 181 | 17.4k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 17.4k | return t; | 183 | 17.4k | } |
base::enable_if<!(IsMoveOnlyType<long long const>::value), long long const>::type& yb::internal::CallbackForward<long long const>(long long const&) Line | Count | Source | 181 | 72.9M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 72.9M | return t; | 183 | 72.9M | } |
base::enable_if<!(IsMoveOnlyType<yb::server::LogicalClock*>::value), yb::server::LogicalClock*>::type& yb::internal::CallbackForward<yb::server::LogicalClock*>(yb::server::LogicalClock*&) Line | Count | Source | 181 | 22 | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 22 | return t; | 183 | 22 | } |
heartbeater.cc:base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<yb::tserver::(anonymous namespace)::FindLeaderMasterData> const>::value), std::__1::shared_ptr<yb::tserver::(anonymous namespace)::FindLeaderMasterData> const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<yb::tserver::(anonymous namespace)::FindLeaderMasterData> const>(std::__1::shared_ptr<yb::tserver::(anonymous namespace)::FindLeaderMasterData> const&) Line | Count | Source | 181 | 1.25M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 1.25M | return t; | 183 | 1.25M | } |
base::enable_if<!(IsMoveOnlyType<yb::Status const>::value), yb::Status const>::type& yb::internal::CallbackForward<yb::Status const>(yb::Status const&) Line | Count | Source | 181 | 239M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 239M | return t; | 183 | 239M | } |
base::enable_if<!(IsMoveOnlyType<yb::HostPort const>::value), yb::HostPort const>::type& yb::internal::CallbackForward<yb::HostPort const>(yb::HostPort const&) Line | Count | Source | 181 | 3.52M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 3.52M | return t; | 183 | 3.52M | } |
base::enable_if<!(IsMoveOnlyType<yb::tablet::AbstractTablet* const>::value), yb::tablet::AbstractTablet* const>::type& yb::internal::CallbackForward<yb::tablet::AbstractTablet* const>(yb::tablet::AbstractTablet* const&) Line | Count | Source | 181 | 84.6k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 84.6k | return t; | 183 | 84.6k | } |
base::enable_if<!(IsMoveOnlyType<yb::RedisResponsePB* const>::value), yb::RedisResponsePB* const>::type& yb::internal::CallbackForward<yb::RedisResponsePB* const>(yb::RedisResponsePB* const&) Line | Count | Source | 181 | 84.6k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 84.6k | return t; | 183 | 84.6k | } |
base::enable_if<!(IsMoveOnlyType<std::__1::function<void (yb::Status const&)> const>::value), std::__1::function<void (yb::Status const&)> const>::type& yb::internal::CallbackForward<std::__1::function<void (yb::Status const&)> const>(std::__1::function<void (yb::Status const&)> const&) Line | Count | Source | 181 | 84.6k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 84.6k | return t; | 183 | 84.6k | } |
base::enable_if<!(IsMoveOnlyType<yb::tablet::AbstractTablet*>::value), yb::tablet::AbstractTablet*>::type& yb::internal::CallbackForward<yb::tablet::AbstractTablet*>(yb::tablet::AbstractTablet*&) Line | Count | Source | 181 | 169k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 169k | return t; | 183 | 169k | } |
base::enable_if<!(IsMoveOnlyType<std::__1::chrono::time_point<yb::CoarseMonoClock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const>::value), std::__1::chrono::time_point<yb::CoarseMonoClock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const>::type& yb::internal::CallbackForward<std::__1::chrono::time_point<yb::CoarseMonoClock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const>(std::__1::chrono::time_point<yb::CoarseMonoClock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&) Line | Count | Source | 181 | 253k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 253k | return t; | 183 | 253k | } |
base::enable_if<!(IsMoveOnlyType<yb::ReadHybridTime const>::value), yb::ReadHybridTime const>::type& yb::internal::CallbackForward<yb::ReadHybridTime const>(yb::ReadHybridTime const&) Line | Count | Source | 181 | 253k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 253k | return t; | 183 | 253k | } |
base::enable_if<!(IsMoveOnlyType<yb::RedisReadRequestPB const>::value), yb::RedisReadRequestPB const>::type& yb::internal::CallbackForward<yb::RedisReadRequestPB const>(yb::RedisReadRequestPB const&) Line | Count | Source | 181 | 253k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 253k | return t; | 183 | 253k | } |
base::enable_if<!(IsMoveOnlyType<yb::RedisResponsePB*>::value), yb::RedisResponsePB*>::type& yb::internal::CallbackForward<yb::RedisResponsePB*>(yb::RedisResponsePB*&) Line | Count | Source | 181 | 169k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 169k | return t; | 183 | 169k | } |
read_query.cc:base::enable_if<!(IsMoveOnlyType<yb::tserver::(anonymous namespace)::ReadQuery::DoReadImpl()::$_1 const>::value), yb::tserver::(anonymous namespace)::ReadQuery::DoReadImpl()::$_1 const>::type& yb::internal::CallbackForward<yb::tserver::(anonymous namespace)::ReadQuery::DoReadImpl()::$_1 const>(yb::tserver::(anonymous namespace)::ReadQuery::DoReadImpl()::$_1 const&) Line | Count | Source | 181 | 169k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 169k | return t; | 183 | 169k | } |
base::enable_if<!(IsMoveOnlyType<yb::tserver::TSTabletManager*>::value), yb::tserver::TSTabletManager*>::type& yb::internal::CallbackForward<yb::tserver::TSTabletManager*>(yb::tserver::TSTabletManager*&) Line | Count | Source | 181 | 1.18M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 1.18M | return t; | 183 | 1.18M | } |
base::enable_if<!(IsMoveOnlyType<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const>::value), std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const>::type& yb::internal::CallbackForward<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 181 | 2.87M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 2.87M | return t; | 183 | 2.87M | } |
base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<yb::consensus::StateChangeContext> const>::value), std::__1::shared_ptr<yb::consensus::StateChangeContext> const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<yb::consensus::StateChangeContext> const>(std::__1::shared_ptr<yb::consensus::StateChangeContext> const&) Line | Count | Source | 181 | 2.48M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 2.48M | return t; | 183 | 2.48M | } |
Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<yb::ql::TestQLProcessor*>::value), yb::ql::TestQLProcessor*>::type& yb::internal::CallbackForward<yb::ql::TestQLProcessor*>(yb::ql::TestQLProcessor*&) base::enable_if<!(IsMoveOnlyType<yb::Callback<void (yb::Status const&)> const>::value), yb::Callback<void (yb::Status const&)> const>::type& yb::internal::CallbackForward<yb::Callback<void (yb::Status const&)> const>(yb::Callback<void (yb::Status const&)> const&) Line | Count | Source | 181 | 72.9M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 72.9M | return t; | 183 | 72.9M | } |
base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<yb::ql::ExecutedResult> const>::value), std::__1::shared_ptr<yb::ql::ExecutedResult> const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<yb::ql::ExecutedResult> const>(std::__1::shared_ptr<yb::ql::ExecutedResult> const&) Line | Count | Source | 181 | 37.5M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 37.5M | return t; | 183 | 37.5M | } |
base::enable_if<!(IsMoveOnlyType<yb::ql::ParseTree const* const>::value), yb::ql::ParseTree const* const>::type& yb::internal::CallbackForward<yb::ql::ParseTree const* const>(yb::ql::ParseTree const* const&) Line | Count | Source | 181 | 335k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 335k | return t; | 183 | 335k | } |
base::enable_if<!(IsMoveOnlyType<yb::ql::QLProcessor*>::value), yb::ql::QLProcessor*>::type& yb::internal::CallbackForward<yb::ql::QLProcessor*>(yb::ql::QLProcessor*&) Line | Count | Source | 181 | 670k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 670k | return t; | 183 | 670k | } |
base::enable_if<!(IsMoveOnlyType<yb::ql::StatementParameters const>::value), yb::ql::StatementParameters const>::type& yb::internal::CallbackForward<yb::ql::StatementParameters const>(yb::ql::StatementParameters const&) Line | Count | Source | 181 | 998k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 998k | return t; | 183 | 998k | } |
Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<yb::ql::ParseTree*>::value), yb::ql::ParseTree*>::type& yb::internal::CallbackForward<yb::ql::ParseTree*>(yb::ql::ParseTree*&) base::enable_if<!(IsMoveOnlyType<yb::Callback<void (yb::Status const&, std::__1::shared_ptr<yb::ql::ExecutedResult> const&)> const>::value), yb::Callback<void (yb::Status const&, std::__1::shared_ptr<yb::ql::ExecutedResult> const&)> const>::type& yb::internal::CallbackForward<yb::Callback<void (yb::Status const&, std::__1::shared_ptr<yb::ql::ExecutedResult> const&)> const>(yb::Callback<void (yb::Status const&, std::__1::shared_ptr<yb::ql::ExecutedResult> const&)> const&) Line | Count | Source | 181 | 999k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 999k | return t; | 183 | 999k | } |
base::enable_if<!(IsMoveOnlyType<yb::tserver::RemoteBootstrapSessionTest*>::value), yb::tserver::RemoteBootstrapSessionTest*>::type& yb::internal::CallbackForward<yb::tserver::RemoteBootstrapSessionTest*>(yb::tserver::RemoteBootstrapSessionTest*&) Line | Count | Source | 181 | 24 | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 24 | return t; | 183 | 24 | } |
base::enable_if<!(IsMoveOnlyType<yb::consensus::PeerMessageQueue*>::value), yb::consensus::PeerMessageQueue*>::type& yb::internal::CallbackForward<yb::consensus::PeerMessageQueue*>(yb::consensus::PeerMessageQueue*&) Line | Count | Source | 181 | 118M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 118M | return t; | 183 | 118M | } |
base::enable_if<!(IsMoveOnlyType<yb::OpId const>::value), yb::OpId const>::type& yb::internal::CallbackForward<yb::OpId const>(yb::OpId const&) Line | Count | Source | 181 | 72.9M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 72.9M | return t; | 183 | 72.9M | } |
base::enable_if<!(IsMoveOnlyType<yb::consensus::MajorityReplicatedData const>::value), yb::consensus::MajorityReplicatedData const>::type& yb::internal::CallbackForward<yb::consensus::MajorityReplicatedData const>(yb::consensus::MajorityReplicatedData const&) Line | Count | Source | 181 | 104M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 104M | return t; | 183 | 104M | } |
base::enable_if<!(IsMoveOnlyType<yb::consensus::LogCache*>::value), yb::consensus::LogCache*>::type& yb::internal::CallbackForward<yb::consensus::LogCache*>(yb::consensus::LogCache*&) Line | Count | Source | 181 | 48.6M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 48.6M | return t; | 183 | 48.6M | } |
base::enable_if<!(IsMoveOnlyType<char const* const>::value), char const* const>::type& yb::internal::CallbackForward<char const* const>(char const* const&) Line | Count | Source | 181 | 91.9k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 91.9k | return t; | 183 | 91.9k | } |
base::enable_if<!(IsMoveOnlyType<char const*>::value), char const*>::type& yb::internal::CallbackForward<char const*>(char const*&) Line | Count | Source | 181 | 183k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 183k | return t; | 183 | 183k | } |
base::enable_if<!(IsMoveOnlyType<yb::master::CatalogManager*>::value), yb::master::CatalogManager*>::type& yb::internal::CallbackForward<yb::master::CatalogManager*>(yb::master::CatalogManager*&) Line | Count | Source | 181 | 12.0k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 12.0k | return t; | 183 | 12.0k | } |
base::enable_if<!(IsMoveOnlyType<yb::master::Master*>::value), yb::master::Master*>::type& yb::internal::CallbackForward<yb::master::Master*>(yb::master::Master*&) Line | Count | Source | 181 | 16.0k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 16.0k | return t; | 183 | 16.0k | } |
base::enable_if<!(IsMoveOnlyType<yb::master::SysCatalogTable*>::value), yb::master::SysCatalogTable*>::type& yb::internal::CallbackForward<yb::master::SysCatalogTable*>(yb::master::SysCatalogTable*&) Line | Count | Source | 181 | 56.6k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 56.6k | return t; | 183 | 56.6k | } |
Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<yb::master::enterprise::CatalogManager*>::value), yb::master::enterprise::CatalogManager*>::type& yb::internal::CallbackForward<yb::master::enterprise::CatalogManager*>(yb::master::enterprise::CatalogManager*&) Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<std::__1::vector<yb::client::YBTableInfo, std::__1::allocator<yb::client::YBTableInfo> > > const>::value), std::__1::shared_ptr<std::__1::vector<yb::client::YBTableInfo, std::__1::allocator<yb::client::YBTableInfo> > > const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<std::__1::vector<yb::client::YBTableInfo, std::__1::allocator<yb::client::YBTableInfo> > > const>(std::__1::shared_ptr<std::__1::vector<yb::client::YBTableInfo, std::__1::allocator<yb::client::YBTableInfo> > > const&) Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const>::value), std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const>::type& yb::internal::CallbackForward<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const>(std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<yb::client::YBTableInfo> const>::value), std::__1::shared_ptr<yb::client::YBTableInfo> const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<yb::client::YBTableInfo> const>(std::__1::shared_ptr<yb::client::YBTableInfo> const&) Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<yb::client::YBLoggingCallback* const>::value), yb::client::YBLoggingCallback* const>::type& yb::internal::CallbackForward<yb::client::YBLoggingCallback* const>(yb::client::YBLoggingCallback* const&) Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<yb::client::YBLoggingCallback*>::value), yb::client::YBLoggingCallback*>::type& yb::internal::CallbackForward<yb::client::YBLoggingCallback*>(yb::client::YBLoggingCallback*&) Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<yb::LogSeverity const>::value), yb::LogSeverity const>::type& yb::internal::CallbackForward<yb::LogSeverity const>(yb::LogSeverity const&) base::enable_if<!(IsMoveOnlyType<int const>::value), int const>::type& yb::internal::CallbackForward<int const>(int const&) Line | Count | Source | 181 | 9 | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 9 | return t; | 183 | 9 | } |
Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<tm const* const>::value), tm const* const>::type& yb::internal::CallbackForward<tm const* const>(tm const* const&) Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<unsigned long const>::value), unsigned long const>::type& yb::internal::CallbackForward<unsigned long const>(unsigned long const&) base::enable_if<!(IsMoveOnlyType<yb::client::YBClient::Data*>::value), yb::client::YBClient::Data*>::type& yb::internal::CallbackForward<yb::client::YBClient::Data*>(yb::client::YBClient::Data*&) Line | Count | Source | 181 | 77.4k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 77.4k | return t; | 183 | 77.4k | } |
base::enable_if<!(IsMoveOnlyType<scoped_refptr<yb::tools::ChecksumResultReporter> const>::value), scoped_refptr<yb::tools::ChecksumResultReporter> const>::type& yb::internal::CallbackForward<scoped_refptr<yb::tools::ChecksumResultReporter> const>(scoped_refptr<yb::tools::ChecksumResultReporter> const&) Line | Count | Source | 181 | 4.37k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 4.37k | return t; | 183 | 4.37k | } |
base::enable_if<!(IsMoveOnlyType<yb::tools::ChecksumResultReporter*>::value), yb::tools::ChecksumResultReporter*>::type& yb::internal::CallbackForward<yb::tools::ChecksumResultReporter*>(yb::tools::ChecksumResultReporter*&) Line | Count | Source | 181 | 8.74k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 8.74k | return t; | 183 | 8.74k | } |
base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<yb::tools::YsckTabletServer> const>::value), std::__1::shared_ptr<yb::tools::YsckTabletServer> const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<yb::tools::YsckTabletServer> const>(std::__1::shared_ptr<yb::tools::YsckTabletServer> const&) Line | Count | Source | 181 | 13.1k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 13.1k | return t; | 183 | 13.1k | } |
base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<yb::BlockingQueue<std::__1::pair<yb::Schema, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, yb::DefaultLogicalSize> > const>::value), std::__1::shared_ptr<yb::BlockingQueue<std::__1::pair<yb::Schema, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, yb::DefaultLogicalSize> > const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<yb::BlockingQueue<std::__1::pair<yb::Schema, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, yb::DefaultLogicalSize> > const>(std::__1::shared_ptr<yb::BlockingQueue<std::__1::pair<yb::Schema, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, yb::DefaultLogicalSize> > const&) Line | Count | Source | 181 | 13.1k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 13.1k | return t; | 183 | 13.1k | } |
base::enable_if<!(IsMoveOnlyType<yb::tools::ChecksumOptions const>::value), yb::tools::ChecksumOptions const>::type& yb::internal::CallbackForward<yb::tools::ChecksumOptions const>(yb::tools::ChecksumOptions const&) Line | Count | Source | 181 | 13.1k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 13.1k | return t; | 183 | 13.1k | } |
base::enable_if<!(IsMoveOnlyType<yb::HostPort* const>::value), yb::HostPort* const>::type& yb::internal::CallbackForward<yb::HostPort* const>(yb::HostPort* const&) Line | Count | Source | 181 | 8.80k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 8.80k | return t; | 183 | 8.80k | } |
base::enable_if<!(IsMoveOnlyType<yb::Synchronizer* const>::value), yb::Synchronizer* const>::type& yb::internal::CallbackForward<yb::Synchronizer* const>(yb::Synchronizer* const&) Line | Count | Source | 181 | 1.80M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 1.80M | return t; | 183 | 1.80M | } |
base::enable_if<!(IsMoveOnlyType<yb::ql::ParseTree const*>::value), yb::ql::ParseTree const*>::type& yb::internal::CallbackForward<yb::ql::ParseTree const*>(yb::ql::ParseTree const*&) Line | Count | Source | 181 | 665k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 665k | return t; | 183 | 665k | } |
base::enable_if<!(IsMoveOnlyType<yb::debug::TraceResultBuffer*>::value), yb::debug::TraceResultBuffer*>::type& yb::internal::CallbackForward<yb::debug::TraceResultBuffer*>(yb::debug::TraceResultBuffer*&) Line | Count | Source | 181 | 700 | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 700 | return t; | 183 | 700 | } |
base::enable_if<!(IsMoveOnlyType<scoped_refptr<yb::RefCountedString> const>::value), scoped_refptr<yb::RefCountedString> const>::type& yb::internal::CallbackForward<scoped_refptr<yb::RefCountedString> const>(scoped_refptr<yb::RefCountedString> const&) Line | Count | Source | 181 | 1.40k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 1.40k | return t; | 183 | 1.40k | } |
base::enable_if<!(IsMoveOnlyType<bool const>::value), bool const>::type& yb::internal::CallbackForward<bool const>(bool const&) Line | Count | Source | 181 | 1.40k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 1.40k | return t; | 183 | 1.40k | } |
base::enable_if<!(IsMoveOnlyType<yb::debug::TraceBucketData* const>::value), yb::debug::TraceBucketData* const>::type& yb::internal::CallbackForward<yb::debug::TraceBucketData* const>(yb::debug::TraceBucketData* const&) Line | Count | Source | 181 | 1.20k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 1.20k | return t; | 183 | 1.20k | } |
base::enable_if<!(IsMoveOnlyType<yb::debug::TraceLog*>::value), yb::debug::TraceLog*>::type& yb::internal::CallbackForward<yb::debug::TraceLog*>(yb::debug::TraceLog*&) Line | Count | Source | 181 | 16 | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 16 | return t; | 183 | 16 | } |
thread.cc:base::enable_if<!(IsMoveOnlyType<yb::(anonymous namespace)::ThreadMgr*>::value), yb::(anonymous namespace)::ThreadMgr*>::type& yb::internal::CallbackForward<yb::(anonymous namespace)::ThreadMgr*>(yb::(anonymous namespace)::ThreadMgr*&) Line | Count | Source | 181 | 61.3k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 61.3k | return t; | 183 | 61.3k | } |
base::enable_if<!(IsMoveOnlyType<yb::Synchronizer*>::value), yb::Synchronizer*>::type& yb::internal::CallbackForward<yb::Synchronizer*>(yb::Synchronizer*&) Line | Count | Source | 181 | 1.81M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 1.81M | return t; | 183 | 1.81M | } |
Unexecuted instantiation: base::enable_if<!(IsMoveOnlyType<std::__1::weak_ptr<yb::Synchronizer> const>::value), std::__1::weak_ptr<yb::Synchronizer> const>::type& yb::internal::CallbackForward<std::__1::weak_ptr<yb::Synchronizer> const>(std::__1::weak_ptr<yb::Synchronizer> const&) base::enable_if<!(IsMoveOnlyType<yb::cqlserver::CQLProcessor*>::value), yb::cqlserver::CQLProcessor*>::type& yb::internal::CallbackForward<yb::cqlserver::CQLProcessor*>(yb::cqlserver::CQLProcessor*&) Line | Count | Source | 181 | 17.7M | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 17.7M | return t; | 183 | 17.7M | } |
base::enable_if<!(IsMoveOnlyType<std::__1::shared_ptr<yb::ql::ExecutedResult>* const>::value), std::__1::shared_ptr<yb::ql::ExecutedResult>* const>::type& yb::internal::CallbackForward<std::__1::shared_ptr<yb::ql::ExecutedResult>* const>(std::__1::shared_ptr<yb::ql::ExecutedResult>* const&) Line | Count | Source | 181 | 533k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 533k | return t; | 183 | 533k | } |
base::enable_if<!(IsMoveOnlyType<yb::log::Log*>::value), yb::log::Log*>::type& yb::internal::CallbackForward<yb::log::Log*>(yb::log::Log*&) Line | Count | Source | 181 | 320k | typename base::enable_if<!IsMoveOnlyType<T>::value, T>::type& CallbackForward(T& t) { | 182 | 320k | return t; | 183 | 320k | } |
|
184 | | |
185 | | template <typename T> |
186 | | typename base::enable_if<IsMoveOnlyType<T>::value, T>::type CallbackForward(T& t) { |
187 | | return t.Pass(); |
188 | | } |
189 | | |
190 | | } // namespace internal |
191 | | } // namespace yb |
192 | | |
193 | | #endif // YB_GUTIL_CALLBACK_INTERNAL_H_ |