ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::ir::MMapedData Class Referencefinal

#include <Data.h>

Collaboration diagram for onert::ir::MMapedData:

Public Member Functions

 MMapedData (int fd, const std::ptrdiff_t mmap_offset, const size_t mmap_size, const std::ptrdiff_t data_offset, const size_t data_size)
 
 ~MMapedData ()
 
const uint8_t * base (void) const override
 
- Public Member Functions inherited from onert::ir::ExternalData
 ExternalData (const uint8_t *base, size_t size)
 
size_t size (void) const override
 
- Public Member Functions inherited from onert::ir::Data
virtual ~Data ()=default
 

Detailed Description

Definition at line 73 of file Data.h.

Constructor & Destructor Documentation

◆ MMapedData()

onert::ir::MMapedData::MMapedData ( int  fd,
const std::ptrdiff_t  mmap_offset,
const size_t  mmap_size,
const std::ptrdiff_t  data_offset,
const size_t  data_size 
)
inline

Definition at line 76 of file Data.h.

78 : ExternalData(nullptr, data_size),
79 _mmap_base(
80 static_cast<uint8_t *>(mmap(NULL, mmap_size, PROT_READ, MAP_PRIVATE, fd, mmap_offset))),
81 _mmap_size(mmap_size), _offset(data_offset - mmap_offset)
82 {
83 // DO NOTHING
84 }
ExternalData(const uint8_t *base, size_t size)
Definition Data.h:59

◆ ~MMapedData()

onert::ir::MMapedData::~MMapedData ( )
inline

Definition at line 87 of file Data.h.

88 {
89 if (_mmap_size > 0)
90 {
91 munmap(const_cast<uint8_t *>(_mmap_base), _mmap_size);
92 }
93 }

Member Function Documentation

◆ base()

const uint8_t * onert::ir::MMapedData::base ( void  ) const
inlineoverridevirtual

Reimplemented from onert::ir::ExternalData.

Definition at line 96 of file Data.h.

96{ return _mmap_base + _offset; }

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