blfwk::UnmappedDataSource Class Reference

Data source for data that is not memory mapped (has no natural address). More...

`#include <DataSource.h>`

Inheritance diagram for blfwk::UnmappedDataSource:
[legend]
Collaboration diagram for blfwk::UnmappedDataSource:
[legend]

## Public Member Functions

| UnmappedDataSource ()
| Default constructor.
| UnmappedDataSource (const uint8_t *data, unsigned length)
| Constructor taking the data, which is copied.
void | setData (const uint8_t *data, unsigned length)
| Sets the source's data. More...
virtual unsigned | getSegmentCount ()
| There is only one segment.
virtual DataSource::Segment * | getSegmentAt (unsigned index)
| Returns this object, as it is its own segment.
Segment methods
virtual bool | hasNaturalLocation ()
| Unmapped data sources have no natural address.
virtual unsigned | getData (unsigned offset, unsigned maxBytes, uint8_t *buffer)
| Copies a portion of the data into buffer.
virtual unsigned | getLength ()
| Returns the number of bytes of data managed by the source.
virtual uint32_t | getBaseAddress ()
| Returns the address associated with the segment. More...
Public Member Functions inherited from blfwk::DataSource
| DataSource ()
| Default constructor.
virtual | ~DataSource ()
| Destructor.
void | setTarget (DataTarget *target)
| Sets the associated data target.
DataTarget * | getTarget () const
| Gets the associated data target.
Public Member Functions inherited from blfwk::DataSource::Segment
| Segment (DataSource &source)
| Default constructor.
virtual | ~Segment ()
| Destructor.

## Protected Attributes

smart_array_ptr< uint8_t > | m_data
| The data.
unsigned | m_length
| Byte count of the data.
Protected Attributes inherited from blfwk::DataSource
DataTarget * | m_target
| Corresponding target for this source.
Protected Attributes inherited from blfwk::DataSource::Segment
DataSource & | m_source
| The data source to which this segment belongs.

## Detailed Description

Data source for data that is not memory mapped (has no natural address).

This data source can only manage a single block of data, which has no associated address. It acts as its own Segment.

## Member Function Documentation

uint32_t UnmappedDataSource::getBaseAddress | ( |  | ) |

virtual

Returns the address associated with the segment.

The unmapped datasource as segment's base address is a function of the data target. If the target is not NULL, then the segment's base address is simply the target's beginAddress. Otherwise, if no target has been set, then the base address returned is 0.

Reimplemented from blfwk::DataSource::Segment.

void UnmappedDataSource::setData | ( | const uint8_t * | data,
|  | unsigned | length
| ) |  |

Sets the source's data.

Makes a copy of data that is freed when the data source is destroyed. The caller does not have to maintain data after this call returns.

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

- src/blfwk/DataSource.h
- src/blfwk/src/DataSource.cpp