ONE - On-device Neural Engine
Loading...
Searching...
No Matches
flatbuffers::grpc::SliceAllocator Class Reference

#include <grpc.h>

Collaboration diagram for flatbuffers::grpc::SliceAllocator:

Public Member Functions

 SliceAllocator ()
 
 SliceAllocator (const SliceAllocator &other)=delete
 
SliceAllocatoroperator= (const SliceAllocator &other)=delete
 
 SliceAllocator (SliceAllocator &&other)
 
SliceAllocatoroperator= (SliceAllocator &&other)
 
void swap (SliceAllocator &other)
 
virtual ~SliceAllocator ()
 
virtual uint8_t * allocate (size_t size) override
 
virtual void deallocate (uint8_t *p, size_t size) override
 
virtual uint8_t * reallocate_downward (uint8_t *old_p, size_t old_size, size_t new_size, size_t in_use_back, size_t in_use_front) override
 
- Public Member Functions inherited from flatbuffers::Allocator
virtual ~Allocator ()
 

Friends

class MessageBuilder
 

Additional Inherited Members

- Protected Member Functions inherited from flatbuffers::Allocator
void memcpy_downward (uint8_t *old_p, size_t old_size, uint8_t *new_p, size_t new_size, size_t in_use_back, size_t in_use_front)
 

Detailed Description

Definition at line 74 of file grpc.h.

Constructor & Destructor Documentation

◆ SliceAllocator() [1/3]

flatbuffers::grpc::SliceAllocator::SliceAllocator ( )
inline

Definition at line 76 of file grpc.h.

76{}

◆ SliceAllocator() [2/3]

flatbuffers::grpc::SliceAllocator::SliceAllocator ( const SliceAllocator other)
delete

◆ SliceAllocator() [3/3]

flatbuffers::grpc::SliceAllocator::SliceAllocator ( SliceAllocator &&  other)
inline

Definition at line 81 of file grpc.h.

81 {
82 // default-construct and swap idiom
83 swap(other);
84 }
void swap(SliceAllocator &other)
Definition grpc.h:93

References swap().

◆ ~SliceAllocator()

virtual flatbuffers::grpc::SliceAllocator::~SliceAllocator ( )
inlinevirtual

Definition at line 98 of file grpc.h.

98{}

Member Function Documentation

◆ allocate()

virtual uint8_t * flatbuffers::grpc::SliceAllocator::allocate ( size_t  size)
inlineoverridevirtual

Implements flatbuffers::Allocator.

Definition at line 100 of file grpc.h.

100 {
101 FLATBUFFERS_ASSERT(slice_.size() == 0);
102 slice_ = ::grpc::Slice(size);
103 return const_cast<uint8_t *>(slice_.begin());
104 }
#define FLATBUFFERS_ASSERT
Definition base.h:21
int32_t size[5]
Definition Slice.cpp:35

References FLATBUFFERS_ASSERT, and size.

◆ deallocate()

virtual void flatbuffers::grpc::SliceAllocator::deallocate ( uint8_t *  p,
size_t  size 
)
inlineoverridevirtual

Implements flatbuffers::Allocator.

Definition at line 106 of file grpc.h.

106 {
107 FLATBUFFERS_ASSERT(p == slice_.begin());
108 FLATBUFFERS_ASSERT(size == slice_.size());
109 slice_ = ::grpc::Slice();
110 }
Configuration p

References FLATBUFFERS_ASSERT, p, and size.

◆ operator=() [1/2]

SliceAllocator & flatbuffers::grpc::SliceAllocator::operator= ( const SliceAllocator other)
delete

◆ operator=() [2/2]

SliceAllocator & flatbuffers::grpc::SliceAllocator::operator= ( SliceAllocator &&  other)
inline

Definition at line 86 of file grpc.h.

86 {
87 // move-construct and swap idiom
88 SliceAllocator temp(std::move(other));
89 swap(temp);
90 return *this;
91 }

References swap().

◆ reallocate_downward()

virtual uint8_t * flatbuffers::grpc::SliceAllocator::reallocate_downward ( uint8_t *  old_p,
size_t  old_size,
size_t  new_size,
size_t  in_use_back,
size_t  in_use_front 
)
inlineoverridevirtual

Reimplemented from flatbuffers::Allocator.

Definition at line 112 of file grpc.h.

114 {
115 FLATBUFFERS_ASSERT(old_p == slice_.begin());
116 FLATBUFFERS_ASSERT(old_size == slice_.size());
117 FLATBUFFERS_ASSERT(new_size > old_size);
118 ::grpc::Slice old_slice = slice_;
119 ::grpc::Slice new_slice = ::grpc::Slice(new_size);
120 uint8_t *new_p = const_cast<uint8_t *>(new_slice.begin());
121 memcpy_downward(old_p, old_size, new_p, new_size, in_use_back,
122 in_use_front);
123 slice_ = new_slice;
124 return new_p;
125 }
void memcpy_downward(uint8_t *old_p, size_t old_size, uint8_t *new_p, size_t new_size, size_t in_use_back, size_t in_use_front)
Definition allocator.h:57

References FLATBUFFERS_ASSERT, and flatbuffers::Allocator::memcpy_downward().

◆ swap()

void flatbuffers::grpc::SliceAllocator::swap ( SliceAllocator other)
inline

Definition at line 93 of file grpc.h.

93 {
94 using std::swap;
95 swap(slice_, other.slice_);
96 }

References swap().

Referenced by operator=(), SliceAllocator(), and swap().

Friends And Related Symbol Documentation

◆ MessageBuilder

friend class MessageBuilder
friend

Definition at line 136 of file grpc.h.


The documentation for this class was generated from the following file: