GRPC C++  1.3.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
core_codegen.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2016, Google Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Google Inc. nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
35 #define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
36 
37 // This file should be compiled as part of grpc++.
38 
40 #include <grpc/byte_buffer.h>
42 
43 namespace grpc {
44 
47  private:
48  grpc_completion_queue* grpc_completion_queue_create(void* reserved) override;
49  void grpc_completion_queue_destroy(grpc_completion_queue* cq) override;
50  grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag,
51  gpr_timespec deadline,
52  void* reserved) override;
53 
54  void* gpr_malloc(size_t size) override;
55  void gpr_free(void* p) override;
56 
57  void gpr_mu_init(gpr_mu* mu) override;
58  void gpr_mu_destroy(gpr_mu* mu) override;
59  void gpr_mu_lock(gpr_mu* mu) override;
60  void gpr_mu_unlock(gpr_mu* mu) override;
61  void gpr_cv_init(gpr_cv* cv) override;
62  void gpr_cv_destroy(gpr_cv* cv) override;
63  int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline) override;
64  void gpr_cv_signal(gpr_cv* cv) override;
65  void gpr_cv_broadcast(gpr_cv* cv) override;
66 
67  void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override;
68 
69  int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
70  grpc_byte_buffer* buffer) override;
71  void grpc_byte_buffer_reader_destroy(
72  grpc_byte_buffer_reader* reader) override;
73  int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
74  grpc_slice* slice) override;
75 
76  grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice,
77  size_t nslices) override;
78 
79  grpc_slice grpc_empty_slice() override;
80  grpc_slice grpc_slice_malloc(size_t length) override;
81  void grpc_slice_unref(grpc_slice slice) override;
82  grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) override;
83  void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice) override;
84  void grpc_slice_buffer_pop(grpc_slice_buffer* sb) override;
85  grpc_slice grpc_slice_from_static_buffer(const void* buffer,
86  size_t length) override;
87  grpc_slice grpc_slice_from_copied_buffer(const void* buffer,
88  size_t length) override;
89  void grpc_metadata_array_init(grpc_metadata_array* array) override;
90  void grpc_metadata_array_destroy(grpc_metadata_array* array) override;
91 
92  gpr_timespec gpr_inf_future(gpr_clock_type type) override;
93  gpr_timespec gpr_time_0(gpr_clock_type type) override;
94 
95  virtual const Status& ok() override;
96  virtual const Status& cancelled() override;
97 
98  void assert_fail(const char* failed_assertion, const char* file,
99  int line) override;
100 };
101 
102 } // namespace grpc
103 
104 #endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
The result of an operation.
Definition: grpc_types.h:393
Definition: slice.h:90
Definition: grpc_types.h:55
Definition: grpc_types.h:404
Definition: slice.h:108
pthread_cond_t gpr_cv
Definition: sync_posix.h:42
Definition: sync_windows.h:39
Interface between the codegen library and the minimal subset of core features required by the generat...
Definition: core_codegen_interface.h:56
Did it work? If it didn't, why?
Definition: status.h:45
Definition: gpr_types.h:63
gpr_clock_type
Definition: gpr_types.h:47
Definition: byte_buffer_reader.h:43
Implementation of the core codegen interface.
Definition: core_codegen.h:46
struct grpc_completion_queue grpc_completion_queue
Completion Queues enable notification of the completion of asynchronous actions.
Definition: grpc_types.h:71