Arduino-Storage
External Memory Storage library for Arduino
Storage::Block Class Reference

#include <Storage.h>

Inheritance diagram for Storage::Block:
Inheritance graph
Collaboration diagram for Storage::Block:
Collaboration graph

Public Member Functions

 Block (Storage &mem, uint32_t size)
 
 ~Block ()
 
uint32_t addr ()
 
int read (void *buf, uint32_t offset, size_t size)
 
int write (uint32_t offset, const void *buf, size_t size)
 

Public Attributes

const uint32_t SIZE
 

Protected Attributes

Storagem_mem
 
const uint32_t m_addr
 

Detailed Description

Allocated block of memory on storage.

Definition at line 93 of file Storage.h.

Constructor & Destructor Documentation

Storage::Block::Block ( Storage mem,
uint32_t  size 
)
inline

Construct block with given size on given storage device.

Parameters
[in]memstorage device for block.
[in]sizenumber of bytes.

Definition at line 100 of file Storage.h.

Storage::Block::~Block ( )
inline

Destruct block and free allocated memory on storage device.

Definition at line 110 of file Storage.h.

Member Function Documentation

uint32_t Storage::Block::addr ( )
inline

Returns storage address for the memory block.

Returns
address.

Definition at line 119 of file Storage.h.

int Storage::Block::read ( void *  buf,
uint32_t  offset,
size_t  size 
)
inline

Read given number of bytes from offset within block to given buffer. Returns number of bytes read or negative error code.

Parameters
[in]bufbuffer pointer.
[in]offsetoffset within block.
[in]sizenumber of bytes to read.
Returns
number of bytes read or negative error code.

Definition at line 132 of file Storage.h.

int Storage::Block::write ( uint32_t  offset,
const void *  buf,
size_t  size 
)
inline

Write given number of bytes from buffer to given offset within block. Returns number of bytes written or negative error code.

Parameters
[in]bufbuffer pointer.
[in]offsetoffset within block.
[in]sizenumber of bytes to write.
Returns
number of bytes written or negative error code.

Definition at line 148 of file Storage.h.

Member Data Documentation

const uint32_t Storage::Block::m_addr
protected

Address on storage device.

Definition at line 163 of file Storage.h.

Storage& Storage::Block::m_mem
protected

Storage device from memory block.

Definition at line 160 of file Storage.h.

const uint32_t Storage::Block::SIZE

Size of memory block.

Definition at line 156 of file Storage.h.


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