elftosb::IVTDataSource Class Reference

Data source for an IVT structure used by HAB4. More...

`#include <IVTDataSource.h>`

Inheritance diagram for elftosb::IVTDataSource:
[legend]
Collaboration diagram for elftosb::IVTDataSource:
[legend]

## Public Member Functions

| IVTDataSource ()
| Default constructor.
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 unsigned | getData (unsigned offset, unsigned maxBytes, uint8_t *buffer)
| Copy out some or all of the IVT structure.
virtual unsigned | getLength ()
| Gets the length of the segment's data.
virtual bool | hasNaturalLocation ()
| Returns whether the segment has an associated address. More...
virtual uint32_t | getBaseAddress ()
| Returns the address associated with the segment.
IVT access
bool | setFieldByName (const std::string &name, uint32_t value)
| Set one of the IVT's fields by providing its name. More...
hab_ivt_t & | getIVT ()
| Returns a reference to the IVT structure.
Public Member Functions inherited from elftosb::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 elftosb::DataSource::Segment
| Segment (DataSource &source)
| Default constructor.
virtual | ~Segment ()
| Destructor.

## Protected Attributes

hab_ivt_t | m_ivt
| The IVT structure.
bool | m_isSelfSet
| True if the IVT self pointer was explicitly set.
Protected Attributes inherited from elftosb::DataSource
DataTarget * | m_target
| Corresponding target for this source.
Protected Attributes inherited from elftosb::DataSource::Segment
DataSource & | m_source
| The data source to which this segment belongs.

## Detailed Description

Data source for an IVT structure used by HAB4.

This data source represents an IVT structure used by HAB4. Fields of the IVT can be set by name, making it easy to interface with a parser. And it has some intelligence regarding the IVT's self pointer. Before the data is copied out by the getData() method, the self field will be filled in automatically if it has not already been set and there is an associated data target object. This lets the IVT pick up its own address from the location where it is being loaded. Alternatively, if the self pointer is filled in explicitly, then the data source will have a natural location equal to the self pointer.

This data source acts as its own segment.

## Member Function Documentation

bool IVTDataSource::hasNaturalLocation | ( |  | ) |

virtual

Returns whether the segment has an associated address.

The IVT has a natural location if its self pointer was explicitly specified.

Implements elftosb::DataSource::Segment.

bool IVTDataSource::setFieldByName | ( | const std::string & | name,
|  | uint32_t | value
| ) |  |

Set one of the IVT's fields by providing its name.

Acceptable field names are:

- entry
- dcd
- boot_data
- self
- csf

As long as the name parameter specifies one of these fields, the return value will be true. If name contains any other value, then false will be returned and the IVT left unmodified.

Once the self field has been set to any value, the data source will have a natural location. This works even if the self address is 0.

Parameters

  name | The name of the field to set. Field names are case sensitive, just like in the C language.
  value | The value to which the field will be set.

Return values

  true | The field was set successfully.
  false | There is no field with the provided name.

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

- IVTDataSource.h
- IVTDataSource.cpp