Interface representing a generic array-like accessor.
More...
#include <iolink/storage/RandomAccess.h>
|
virtual RandomAccessCapabilitySet | capabilities () const =0 |
|
bool | support (RandomAccessCapabilitySet flags) |
| Checks if the RandomAccess supports the given capabilities.
|
|
virtual size_t | size () const =0 |
| Return the number of bytes of the resource accessed.
|
|
std::string | toString () const |
| Return a string representation.
|
|
virtual size_t | read (size_t offset, size_t size, void *dst) |
| Read content of data into given buffer. More...
|
|
virtual size_t | write (size_t offset, size_t size, const void *src) |
| Write content of src buffer into data. More...
|
|
virtual void | resize (size_t newSize) |
| Resize content data. More...
|
|
virtual void * | buffer () |
| Return a mutable pointer to the internal memory buffer. More...
|
|
virtual const void * | bufferReadOnly () const |
| Return an immutable pointer to the internal memory buffer. More...
|
|
virtual size_t | bufferSize () |
| Size in bytes of the internal buffer. More...
|
|
virtual std::shared_ptr< DataStorage > | storage () const =0 |
| Get the storage to which this data accessor belong.
|
|
virtual const std::string & | resourceId () const =0 |
| Return the resource identifier of this data accessor.
|
|
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: