IOLink  IOL_v1.2.0_release
iolink::RandomAccess Class Referenceabstract

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

#include <iolink/storage/RandomAccess.h>

Inheritance diagram for iolink::RandomAccess:
iolink::DataAccess

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. 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...
 

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 memory buffer.

Available when the RandomAccess has the MEMORY_ACCESS capability.

Exceptions
NotImplementedIf the implementation does not support memory access.

◆ 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
NotImplementedIf the implementation does not support memory access.

◆ 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
NotImplementedIf 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
offsetOffset in byte to the begining of read area
sizeSize in byte of read area
dstDestination buffer. This buffer should have a size of "size"
Exceptions
exceptionif 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
newSizeNew 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
offsetOffset in byte to the beginning of write area
sizeSize in byte of write area
srcSource buffer. This buffer should have a size of "size"
Exceptions
exceptionif 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: