Classes | Macros | Typedefs
include/grpc/impl/codegen/slice.h File Reference
#include <grpc/impl/codegen/port_platform.h>
#include <stddef.h>
#include <grpc/impl/codegen/gpr_slice.h>
Include dependency graph for include/grpc/impl/codegen/slice.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  grpc_slice
 
struct  grpc_slice_buffer
 
union  grpc_slice::grpc_slice_data
 
struct  grpc_slice::grpc_slice_data::grpc_slice_inlined
 
struct  grpc_slice::grpc_slice_data::grpc_slice_refcounted
 

Macros

#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS   8
 
#define GRPC_SLICE_END_PTR(slice)   GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
 
#define GRPC_SLICE_INLINE_EXTRA_SIZE   sizeof(void*)
 
#define GRPC_SLICE_INLINED_SIZE   (sizeof(size_t) + sizeof(uint8_t*) - 1 + GRPC_SLICE_INLINE_EXTRA_SIZE)
 
#define GRPC_SLICE_IS_EMPTY(slice)   (GRPC_SLICE_LENGTH(slice) == 0)
 
#define GRPC_SLICE_LENGTH(slice)
 
#define GRPC_SLICE_SET_LENGTH(slice, newlen)
 
#define GRPC_SLICE_START_PTR(slice)
 

Typedefs

typedef struct grpc_slice grpc_slice
 
typedef struct grpc_slice_buffer grpc_slice_buffer
 

Macro Definition Documentation

◆ GRPC_SLICE_BUFFER_INLINE_ELEMENTS

#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS   8

Definition at line 79 of file include/grpc/impl/codegen/slice.h.

◆ GRPC_SLICE_END_PTR

#define GRPC_SLICE_END_PTR (   slice)    GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)

Definition at line 110 of file include/grpc/impl/codegen/slice.h.

◆ GRPC_SLICE_INLINE_EXTRA_SIZE

#define GRPC_SLICE_INLINE_EXTRA_SIZE   sizeof(void*)

Slice API

A slice represents a contiguous reference counted array of bytes. It is cheap to take references to a slice, and it is cheap to create a slice pointing to a subset of another slice.

The data-structure for slices is exposed here to allow non-gpr code to build slices from whatever data they have available.

When defining interfaces that handle slices, care should be taken to define reference ownership semantics (who should call unref?) and mutability constraints (is the callee allowed to modify the slice?)

Definition at line 47 of file include/grpc/impl/codegen/slice.h.

◆ GRPC_SLICE_INLINED_SIZE

#define GRPC_SLICE_INLINED_SIZE   (sizeof(size_t) + sizeof(uint8_t*) - 1 + GRPC_SLICE_INLINE_EXTRA_SIZE)

Definition at line 49 of file include/grpc/impl/codegen/slice.h.

◆ GRPC_SLICE_IS_EMPTY

#define GRPC_SLICE_IS_EMPTY (   slice)    (GRPC_SLICE_LENGTH(slice) == 0)

Definition at line 112 of file include/grpc/impl/codegen/slice.h.

◆ GRPC_SLICE_LENGTH

#define GRPC_SLICE_LENGTH (   slice)
Value:
((slice).refcount ? (slice).data.refcounted.length \
: (slice).data.inlined.length)

Definition at line 104 of file include/grpc/impl/codegen/slice.h.

◆ GRPC_SLICE_SET_LENGTH

#define GRPC_SLICE_SET_LENGTH (   slice,
  newlen 
)
Value:
((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
: ((slice).data.inlined.length = (uint8_t)(newlen)))

Definition at line 107 of file include/grpc/impl/codegen/slice.h.

◆ GRPC_SLICE_START_PTR

#define GRPC_SLICE_START_PTR (   slice)
Value:
((slice).refcount ? (slice).data.refcounted.bytes \
: (slice).data.inlined.bytes)

Definition at line 101 of file include/grpc/impl/codegen/slice.h.

Typedef Documentation

◆ grpc_slice

typedef struct grpc_slice grpc_slice

Definition at line 30 of file include/grpc/impl/codegen/slice.h.

◆ grpc_slice_buffer

Represents an expandable array of slices, to be interpreted as a single item.

uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
refcount
size_t refcount
Definition: abseil-cpp/absl/strings/internal/cordz_info.cc:122
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:31