| IOLink 1.11.0

Loading...
Searching...
No Matches
Public Member Functions | List of all members
iolink::RandomAccess Class Referenceabstract

Interface representing a generic array-like accessor. More...

`#include <iolink/storage/RandomAccess.h>`

Inheritance diagram for iolink::RandomAccess:

## Public Member Functions
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.
virtual size_t | write (size_t offset, size_t size, const void *src)
| Write content of src buffer into data.
virtual void | resize (size_t newSize)
| Resize content data.
virtual void * | buffer ()
| Return a mutable pointer to the internal CPU memory buffer.
virtual const void * | bufferReadOnly () const
| Return an immutable pointer to the internal CPU memory buffer.
virtual size_t | bufferSize ()
| Size in bytes of the internal CPU buffer.
Public Member Functions inherited from iolink::DataAccess
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.

## Detailed Description

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

## Member Function Documentation

## ◆ buffer()

virtual void * iolink::RandomAccess::buffer | ( |  | ) |
| virtual

Return a mutable pointer to the internal CPU memory buffer.

Available when the RandomAccess has the MEMORY_ACCESS capability.

Exceptions

  NotImplemented | If the implementation does not support memory access.

## ◆ bufferReadOnly()

virtual const void * iolink::RandomAccess::bufferReadOnly | ( |  | ) | const
| virtual

Return an immutable pointer to the internal CPU memory buffer.

Available when the RandomAccess has the MEMORY_ACCESS capability.

Exceptions

  NotImplemented | If the implementation does not support memory access.

## ◆ bufferSize()

virtual size_t iolink::RandomAccess::bufferSize | ( |  | ) |
| virtual

Size in bytes of the internal CPU buffer.

Available when the RandomAccess has the MEMORY_ACCESS capability.

Exceptions

  NotImplemented | If the implementation does not support memory access.

## ◆ capabilities()

virtual RandomAccessCapabilitySet iolink::RandomAccess::capabilities | ( |  | ) | const
| pure virtual

Returns
  capabilities for current RandomAccess

## ◆ 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:

- iolink/public/include/iolink/storage/RandomAccess.h