#include <builder.h>
This defines the API used by the Controller and Packet classes for building a raw device record to write to the device.
Definition at line 59 of file builder.h.
Public Member Functions | |
virtual bool | BuildRecord (DBData &data, size_t &offset, const IConverter *ic)=0 |
Called to build the record field data. | |
virtual bool | FetchRecord (DBData &data, const IConverter *ic)=0 |
Same as BuildRecord, but does not care about any offsets. | |
virtual bool | EndOfFile () const =0 |
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. |
virtual bool Barry::Builder::BuildRecord | ( | DBData & | data, | |
size_t & | offset, | |||
const IConverter * | ic | |||
) | [pure 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.
Implemented in Barry::DBDataBuilder, Barry::RecordBuilder< RecordT, StorageT >, Barry::DeviceBuilder, Barry::Restore, and Barry::BoostBuilder.
Referenced by Barry::DBPacket::SetRecord(), and Barry::DBPacket::SetRecordByIndex().
virtual bool Barry::Builder::FetchRecord | ( | DBData & | data, | |
const IConverter * | ic | |||
) | [pure 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().
Implemented in Barry::DBDataBuilder, Barry::RecordBuilder< RecordT, StorageT >, Barry::DeviceBuilder, Barry::Restore, and Barry::BoostBuilder.
Referenced by Barry::Pipe::PumpEntry().
virtual bool Barry::Builder::EndOfFile | ( | ) | const [pure 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.
Implemented in Barry::DBDataBuilder, Barry::RecordBuilder< RecordT, StorageT >, Barry::DeviceBuilder, Barry::Restore, and Barry::BoostBuilder.
Referenced by Barry::Pipe::PumpFile().