Interface representing a generic array-like accessor.
More...
#include <iolink/storage/RandomAccess.h>
Interface representing a generic array-like accessor.
This interface capabilities are indicated by the RandomAccessCapabilitySet returned by the method RandomAccess::capabilities. Each capability enables the use of a specific set of methods. When one of those methods is called, if its corresponding capability is not supported, a NotImplemented exception will be thrown.
- See also
- RandomAccessCapability for capabilities managed by this object
◆ buffer()
virtual void* iolink::RandomAccess::buffer |
( |
| ) |
|
|
virtual |
Return a mutable pointer to the internal memory buffer.
Available when the RandomAccess has the MEMORY_ACCESS capability.
- Exceptions
-
◆ bufferReadOnly()
virtual const void* iolink::RandomAccess::bufferReadOnly |
( |
| ) |
const |
|
virtual |
Return an immutable pointer to the internal memory buffer.
Available when the RandomAccess has the MEMORY_ACCESS capability.
- Exceptions
-
◆ bufferSize()
virtual size_t iolink::RandomAccess::bufferSize |
( |
| ) |
|
|
virtual |
Size in bytes of the internal buffer.
Available when the RandomAccess has the MEMORY_ACCESS capability.
- Exceptions
-
◆ capabilities()
◆ read()
virtual size_t iolink::RandomAccess::read |
( |
size_t |
offset, |
|
|
size_t |
size, |
|
|
void * |
dst |
|
) |
| |
|
virtual |
Read content of data into given buffer.
Available when the RandomAccess has the READ capability.
- Parameters
-
offset | Offset in byte to the begining of read area |
size | Size in byte of read area |
dst | Destination buffer. This buffer should have a size of "size" |
- Exceptions
-
exception | if offset is out of range |
- Returns
- Count of actually read bytes (can be zero or less than given size).
◆ resize()
virtual void iolink::RandomAccess::resize |
( |
size_t |
newSize | ) |
|
|
virtual |
Resize content data.
Available when the RandomAccess has the RESIZE capability.
- Parameters
-
newSize | New size of data. Content of data is undefined after being resized. |
◆ write()
virtual size_t iolink::RandomAccess::write |
( |
size_t |
offset, |
|
|
size_t |
size, |
|
|
const void * |
src |
|
) |
| |
|
virtual |
Write content of src buffer into data.
Available when the RandomAccess has the WRITE capability.
- Parameters
-
offset | Offset in byte to the beginning of write area |
size | Size in byte of write area |
src | Source buffer. This buffer should have a size of "size" |
- Exceptions
-
exception | if offset is out of range |
- Returns
- Count of actually written bytes (can be zero or less than given size).
The documentation for this class was generated from the following file: