#include <Memory.h>
Definition at line 41 of file Memory.h.
◆ MappedMemory()
MappedMemory::MappedMemory |
( |
| ) |
|
|
default |
◆ ~MappedMemory()
MappedMemory::~MappedMemory |
( |
| ) |
|
Definition at line 25 of file Memory.cpp.
26{
27 if (_base)
28 {
29 munmap(_base, _size);
30 }
31}
◆ getPointer()
int MappedMemory::getPointer |
( |
uint8_t ** |
buffer | ) |
const |
|
overridevirtual |
◆ set()
int MappedMemory::set |
( |
size_t |
size, |
|
|
int |
prot, |
|
|
int |
fd, |
|
|
size_t |
offset |
|
) |
| |
Definition at line 33 of file Memory.cpp.
34{
35#if 0
36 if (fd < 0)
37 {
38 LOG(ERROR) <<
"ANeuralNetworksMemory_createFromFd invalid fd " << fd;
40 }
41 if (
size == 0 || fd < 0)
42 {
43 LOG(ERROR) <<
"Invalid size or fd";
45 }
46 int dupfd = dup(fd);
47 if (dupfd == -1)
48 {
49 LOG(ERROR) <<
"Failed to dup the fd";
51 }
52#endif
53 void *
const base = mmap(
nullptr,
size, prot, MAP_PRIVATE, fd,
offset);
54
55 if (base == MAP_FAILED)
56 {
58 }
59
60 _base = static_cast<uint8_t *>(base);
62
64}
@ ANEURALNETWORKS_UNEXPECTED_NULL
@ ANEURALNETWORKS_BAD_DATA
__global uchar * offset(const Image *img, int x, int y)
References ANEURALNETWORKS_BAD_DATA, ANEURALNETWORKS_NO_ERROR, ANEURALNETWORKS_UNEXPECTED_NULL, LOG, offset(), and size.
◆ validateSize()
bool MappedMemory::validateSize |
( |
uint32_t |
offset, |
|
|
uint32_t |
length |
|
) |
| const |
|
overridevirtual |
The documentation for this class was generated from the following files: