Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* @file api.Heap.hpp |
3 |
|
|
* @author Sergey Baigudin, sergey@baigudin.software |
4 |
|
|
* @copyright 2016-2022, Sergey Baigudin, Baigudin Software |
5 |
|
|
*/ |
6 |
|
|
#ifndef API_HEAP_HPP_ |
7 |
|
|
#define API_HEAP_HPP_ |
8 |
|
|
|
9 |
|
|
#include "api.Object.hpp" |
10 |
|
|
|
11 |
|
|
namespace eoos |
12 |
|
|
{ |
13 |
|
|
namespace api |
14 |
|
|
{ |
15 |
|
|
|
16 |
|
|
/** |
17 |
|
|
* @class Heap |
18 |
|
|
* @brief Heap memory interface. |
19 |
|
|
*/ |
20 |
|
|
class Heap : public Object |
21 |
|
|
{ |
22 |
|
|
|
23 |
|
|
public: |
24 |
|
|
|
25 |
|
|
/** |
26 |
|
|
* @brief Destructor. |
27 |
|
|
*/ |
28 |
|
|
virtual ~Heap() = 0; |
29 |
|
|
|
30 |
|
|
/** |
31 |
|
|
* @brief Allocates memory. |
32 |
|
|
* |
33 |
|
|
* @param size Required memory size in byte. |
34 |
|
|
* @param ptr NULLPTR value becomes to allocate memory, and |
35 |
|
|
* other given values are simply returned |
36 |
|
|
* as memory address. |
37 |
|
|
* @return Pointer to allocated memory or NULLPTR. |
38 |
|
|
*/ |
39 |
|
|
virtual void* allocate(size_t size, void* ptr) = 0; |
40 |
|
|
|
41 |
|
|
/** |
42 |
|
|
* @brief Frees allocated memory. |
43 |
|
|
* |
44 |
|
|
* @param ptr Pointer to allocated memory. |
45 |
|
|
*/ |
46 |
|
|
virtual void free(void* ptr) = 0; |
47 |
|
|
|
48 |
|
|
}; |
49 |
|
|
|
50 |
|
368 |
inline Heap::~Heap() {} |
51 |
|
|
|
52 |
|
|
} // namespace api |
53 |
|
|
} // namespace eoos |
54 |
|
|
#endif // API_HEAP_HPP_ |
55 |
|
|
|