# Barry::DeviceBuilder Class Reference

`#include <m_desktop.h>`

Inheritance diagram for Barry::DeviceBuilder:

[legend]
Collaboration diagram for Barry::DeviceBuilder:

[legend]

List of all members.

## Detailed Description

Takes a list of database dbId's and behaves like a Builder, trying to avoid copies where possible on the device loading end.

Definition at line 181 of file m_desktop.h.

## Public Member Functions

void | Restart ()
| sets the internal iterator to the start of the list in order to perform a fresh run
virtual bool | BuildRecord (DBData &data, size_t &offset, const IConverter *ic)
| Called to build the record field data.
virtual bool | FetchRecord (DBData &data, const IConverter *ic)
| Same as BuildRecord, but does not care about any offsets.
virtual bool | EndOfFile () const
| Sometimes a builder can have multiple databases stored in it, so when Build/Fetch returns false, check if there is more data with this function.

## Classes

struct | DBLabel

## Member Function Documentation

void Barry::DeviceBuilder::Restart | ( |  | ) | `[inline]`

sets the internal iterator to the start of the list in order to perform a fresh run

Definition at line 223 of file m_desktop.h.

bool Barry::DeviceBuilder::BuildRecord | ( | DBData & | data,
|  | size_t & | offset,
|  | const IConverter * | ic |
| ) |  |  | `[virtual]`

Called to build the record field data.

Store the raw data in data, using offset to know where to write. Be sure to update offset, and be sure to adjust the size of the data packet (possibly with Data::ReleaseBuffer()).

Returns true if successful, and false if at the end of the series. Note that if EndOfFile() is false after this function returns false, then there may be another series available, which the next call to BuildRecord() will determine.

Implements Barry::Builder.

Definition at line 590 of file m_desktop.cc.

References FetchRecord(), Barry::DBData::GetData(), Barry::DBData::GetDBName(), Barry::DBData::GetOffset(), Barry::DBData::GetRecType(), Barry::DBData::GetUniqueId(), Barry::DBData::GetVersion(), Barry::DBData::SetDBName(), Barry::DBData::SetIds(), Barry::DBData::SetOffset(), Barry::DBData::SetVersion(), and Barry::DBData::UseData().

Here is the call graph for this function:

bool Barry::DeviceBuilder::FetchRecord | ( | DBData & | data,
|  | const IConverter * | ic |
| ) |  |  | `[virtual]`

Same as BuildRecord, but does not care about any offsets.

The caller should call DBData::GetOffset() afterward to discover if there is an offset to the result.

This is usually the fastest of the two functions, since extra copying may be required if a specific offset is given. When building records from Record classes, both functions are the same speed. But when building records from the device, the device decides the offset, so FetchRecord() is faster, since BuildRecord requires a copy to adjust to the right offset.

The caller should use the function that results in the least amount of copying for the caller. If the caller doesn't care about where the resulting record is in data, use FetchRecord().

Implements Barry::Builder.

Definition at line 612 of file m_desktop.cc.

References EndOfFile(), Barry::Mode::DBLoader::GetNextRecord(), Barry::Mode::DBLoader::IsBusy(), Barry::DBData::SetDBName(), and Barry::Mode::DBLoader::StartDBLoad().

Referenced by BuildRecord().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Barry::DeviceBuilder::EndOfFile | ( |  | ) | const`[virtual]`

Sometimes a builder can have multiple databases stored in it, so when Build/Fetch returns false, check if there is more data with this function.

This function is not used by database-oriented functions, but by pipe- oriented functions.

Implements Barry::Builder.

Definition at line 648 of file m_desktop.cc.

Referenced by FetchRecord().

Here is the caller graph for this function:

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

- m_desktop.h
- m_desktop.cc