elftosb::DataSource::Segment Class Referenceabstract

Discrete, contiguous part of the source's data. More...

`#include <DataSource.h>`

Inheritance diagram for elftosb::DataSource::Segment:
[legend]
Collaboration diagram for elftosb::DataSource::Segment:
[legend]

## Public Member Functions

| Segment (DataSource &source)
| Default constructor.
virtual | ~Segment ()
| Destructor.
virtual unsigned | getData (unsigned offset, unsigned maxBytes, uint8_t *buffer)=0
| Gets all or a portion of the segment's data. More...
virtual unsigned | getLength ()=0
| Gets the length of the segment's data.
virtual bool | hasNaturalLocation ()=0
| Returns whether the segment has an associated address.
virtual uint32_t | getBaseAddress ()
| Returns the address associated with the segment.

## Protected Attributes

DataSource & | m_source
| The data source to which this segment belongs.

## Detailed Description

Discrete, contiguous part of the source's data.

This class is purely abstract and subclasses of DataSource are expected to subclass it to implement a segment particular to their needs.

## Member Function Documentation

virtual unsigned elftosb::DataSource::Segment::getData | ( | unsigned | offset,
|  | unsigned | maxBytes,
|  | uint8_t * | buffer
| ) |  |

pure virtual

Gets all or a portion of the segment's data.

The data is copied into buffer. Up to maxBytes bytes may be copied, so buffer must be at least that large.

Parameters

  offset | Index of the first byte to start copying from.
  maxBytes | The maximum number of bytes that can be returned. buffer must be at least this large.
  buffer | Pointer to buffer where the data is copied.

Returns
  The number of bytes copied into buffer.

Implemented in elftosb::MemoryImageDataSource::TextSegment, elftosb::IVTDataSource, elftosb::UnmappedDataSource, elftosb::ELFSourceFile::ELFDataSource::ProgBitsSegment, and elftosb::DataSource::PatternSegment.

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

- apps/elftosb/common/DataSource.h