config_selector.cc
Go to the documentation of this file.
1 //
2 // Copyright 2020 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
18 
20 
23 
24 namespace grpc_core {
25 
26 namespace {
27 
28 void* ConfigSelectorArgCopy(void* p) {
29  ConfigSelector* config_selector = static_cast<ConfigSelector*>(p);
30  config_selector->Ref().release();
31  return p;
32 }
33 
34 void ConfigSelectorArgDestroy(void* p) {
35  ConfigSelector* config_selector = static_cast<ConfigSelector*>(p);
36  config_selector->Unref();
37 }
38 
39 int ConfigSelectorArgCmp(void* p, void* q) { return QsortCompare(p, q); }
40 
41 const grpc_arg_pointer_vtable kChannelArgVtable = {
42  ConfigSelectorArgCopy, ConfigSelectorArgDestroy, ConfigSelectorArgCmp};
43 
44 } // namespace
45 
48  const_cast<char*>(GRPC_ARG_CONFIG_SELECTOR),
49  const_cast<ConfigSelector*>(this), &kChannelArgVtable);
50 }
51 
53  const grpc_channel_args& args) {
54  ConfigSelector* config_selector =
55  grpc_channel_args_find_pointer<ConfigSelector>(&args,
57  return config_selector != nullptr ? config_selector->Ref() : nullptr;
58 }
59 
60 } // namespace grpc_core
grpc_arg
Definition: grpc_types.h:103
grpc_core::ConfigSelector::MakeChannelArg
grpc_arg MakeChannelArg() const
Definition: config_selector.cc:46
grpc_core
Definition: call_metric_recorder.h:31
useful.h
config_selector.h
xds_manager.p
p
Definition: xds_manager.py:60
grpc_arg_pointer_vtable
Definition: grpc_types.h:85
grpc_channel_args
Definition: grpc_types.h:132
GRPC_ARG_CONFIG_SELECTOR
#define GRPC_ARG_CONFIG_SELECTOR
Definition: config_selector.h:42
grpc_core::ConfigSelector::GetFromChannelArgs
static RefCountedPtr< ConfigSelector > GetFromChannelArgs(const grpc_channel_args &args)
Definition: config_selector.cc:52
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::RefCountedPtr
Definition: ref_counted_ptr.h:35
grpc_core::QsortCompare
int QsortCompare(const T &a, const T &b)
Definition: useful.h:95
grpc_core::ConfigSelector
Definition: config_selector.h:48
channel_args.h
grpc_channel_arg_pointer_create
grpc_arg grpc_channel_arg_pointer_create(char *name, void *value, const grpc_arg_pointer_vtable *vtable)
Definition: channel_args.cc:492
grpc_core::RefCounted::Ref
RefCountedPtr< Child > Ref() GRPC_MUST_USE_RESULT
Definition: ref_counted.h:287
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:52