GRPC Core  9.0.0
status_util.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_CORE_LIB_CHANNEL_STATUS_UTIL_H
20 #define GRPC_CORE_LIB_CHANNEL_STATUS_UTIL_H
21 
23 
24 #include <grpc/status.h>
25 
26 #include <stdbool.h>
27 #include <string.h>
28 
31 bool grpc_status_code_from_string(const char* status_str,
33 
36 
37 namespace grpc_core {
38 namespace internal {
39 
42  public:
43  bool Empty() const { return status_code_mask_ == 0; }
44 
45  void Add(grpc_status_code status) { status_code_mask_ |= (1 << status); }
46 
48  return status_code_mask_ & (1 << status);
49  }
50 
51  private:
52  int status_code_mask_ = 0; // A bitfield of status codes in the set.
53 };
54 
55 } // namespace internal
56 } // namespace grpc_core
57 
58 #endif /* GRPC_CORE_LIB_CHANNEL_STATUS_UTIL_H */
A set of grpc_status_code values.
Definition: status_util.h:41
bool Contains(grpc_status_code status) const
Definition: status_util.h:47
bool Empty() const
Definition: status_util.h:43
void Add(grpc_status_code status)
Definition: status_util.h:45
grpc_status_code
Definition: status.h:26
grpc_linked_mdelem status
Definition: lame_client.cc:44
Round Robin Policy.
Definition: backend_metric.cc:24
bool grpc_status_code_from_string(const char *status_str, grpc_status_code *status)
If status_str is a valid status string, sets status to the corresponding status value and returns tru...
Definition: status_util.cc:50
const char * grpc_status_code_to_string(grpc_status_code status)
Returns the string form of status, or "UNKNOWN" if invalid.
Definition: status_util.cc:61