uc_dynamic_memory.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3  */
4 
6 
7 namespace uavcan
8 {
9 /*
10  * LimitedPoolAllocator
11  */
13 {
15  {
16  used_blocks_++;
17  return allocator_.allocate(size);
18  }
19  else
20  {
21  return UAVCAN_NULLPTR;
22  }
23 }
24 
25 void LimitedPoolAllocator::deallocate(const void* ptr)
26 {
28 
30  if (used_blocks_ > 0)
31  {
32  used_blocks_--;
33  }
34 }
35 
37 {
39 }
40 
41 }
virtual void deallocate(const void *ptr)
virtual void deallocate(const void *ptr)=0
unsigned long size_t
virtual uint16_t getBlockCapacity() const
UAVCAN_EXPORT const T & min(const T &a, const T &b)
Definition: templates.hpp:281
virtual void * allocate(std::size_t size)
virtual void * allocate(std::size_t size)=0
std::uint16_t uint16_t
Definition: std.hpp:25
virtual uint16_t getBlockCapacity() const =0


uavcan_communicator
Author(s):
autogenerated on Wed Jan 11 2023 03:59:40