BDS Public
BdsApi 4.0.1
This is the Blacknest BDS API.
Loading...
Searching...
No Matches

This class implements the BDS Data File/Stream access system. More...

#include <BdsDataFileBds.h>

Inheritance diagram for Bds::DataFileBds:
Bds::DataFile

Public Types

enum  { StreamsMax = 256 }
 
enum  { DefaultBlockSize = 65536 }
 
enum  PackFormat { PackFormat_Unknown = 0 , PackFormat_SM = 1 , PackFormat_CM = 2 , PackFormat_SM_CC = 3 }
 
- Public Types inherited from Bds::DataFile
enum  DataOrder { DataOrderUnknown , DataOrderAll , DataOrderSample , DataOrderChannel }
 
enum  Features { FeatureNone = 0x00 , FeatureCanWrite = 0x01 , FeatureCanRead = 0x02 }
 
enum  WriteOptionsList { WriteOptionNone = 0x00 , WriteOptionSensorData = 0x01 , WriteOptionNoMetadata = 0x02 }
 
enum  ReadOptionsList {
  ReadOptionNone = 0x00 , ReadOptionValidate = 0x01 , ReadOptionFileNameProcess = 0x02 , ReadOptionFixCorruptions = 0x04 ,
  ReadOptionReorder = 0x08 , ReadOptionDeleteDuplicates = 0x10 , ReadOptionInfoExtra = 0x20 , ReadOptionIgnoreSamplerate = 0x40 ,
  ReadOptionPrintBlocks = 0x80 , ReadOptionFixSampleRate = 0x100
}
 

Public Member Functions

 DataFileBds ()
 
 ~DataFileBds ()
 
BError open (BString fileName, BString mode)
 Open the file for reading or writing.
 
BError flush ()
 Flush any data to disk even if blocks are not full.
 
BError close ()
 Close file.
 
BError setFormat (BString format)
 Sets the sub-format.
 
BError setInfo (const DataInfo &dataInfo, const ChannelInfos &channelInfos, WriteOptionsList options=WriteOptionSensorData)
 Sets the information.
 
BError writeData (const DataBlock &data)
 Writes a data block to the file.
 
DataOrder getDataOrder ()
 Get the expected order of writing data, by sample or by channel.
 
BError getInfo (DataInfo &dataInfo, DataFileOptions options, BList< DataError > &errors)
 Get information on open file.
 
BError seekBlock (BUInt32 channel, BUInt segment, BTimeStamp time, BUInt32 &blockNumber, BUInt64 &sampleNumber, DataBlock &dataBlock)
 Find the block that contains the samples for the time requested.
 
BError readData (BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &dataBlock)
 Read the data block for the given channel or all channels if blockNumber is 0.
 
BError setDiskBlockSize (BUInt32 blockSize)
 Sets up file/stream block size.
 
BUInt32 getDiskBlockSize ()
 Returns the data block size in bytes.
 
BError streamletToChannel (BUInt streamlet, BUInt &channel)
 Find streamlet given channel.
 
BError setWritePositionForAppend ()
 Sets the next packet write position.
 
BError setReadPositionToStart ()
 
BError packetRead (BdsDataPacket &packet)
 Reads a packet from the file.
 
BError packetWrite (BdsDataPacket &packet)
 Writes a packet to the file.
 
- Public Member Functions inherited from Bds::DataFile
 DataFile ()
 
virtual ~DataFile ()
 
virtual void init ()
 Initialise.
 
virtual BError open (BString fileName, BString mode)
 Open the file for read or write.
 
virtual BError close ()
 Close the file.
 
virtual BError setFormat (BString format)
 Set the sub-format.
 
virtual BString getFileName ()
 Return the file name.
 
virtual DataOrder getDataOrder ()
 Get the expected order of writing data, by sample or by channel.
 
virtual int getFeatures ()
 Get bitmask of supported features.
 
virtual BString getFixesInfo ()
 Get readable list of fixes that can be applied to faulty data files.
 
void getNotices (BStringList &notices)
 Get a list of any notices.
 
virtual BError setInfo (const DataInfo &dataInfo, const ChannelInfos &channelInfos, WriteOptionsList options=WriteOptionNone)
 Set information on data for write.
 
virtual BError start (BUInt channel, BUInt segment)
 Start writing next segment of data.
 
virtual BError writeData (const DataBlock &data)
 Write a block of data.
 
virtual BError end ()
 End write segment.
 
virtual BError flush ()
 Flush data to disk.
 
virtual BError fileNameProcess ()
 Parse the file name for a date/time.
 
virtual BError getFormat (BString &format)
 Get sub-format.
 
virtual BError getInfo (DataInfo &dataInfo, DataFileOptions options, BList< DataError > &errors)
 Get info on data.
 
virtual BError seekBlock (BUInt32 channel, BUInt segment, BTimeStamp time, BUInt32 &blockNumber, BUInt64 &sampleNumber, DataBlock &data)
 Find requested block on given channel given a time.
 
virtual BError readData (BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &dataBlock)
 Read a block.
 
virtual BError getMetaData (ChannelInfos &channelInfos, BUInt32 options, BList< DataError > &errors)
 Return all known MetaData in the file.
 
void dataErrorFixup (const DataInfo &dataInfo, BList< DataError > &errors)
 Fixup data errors, mainly start/end times to be within data.
 
BInt64 timeCompare (BTimeStamp t1, BTimeStamp t2, BUInt diff)
 Compare timestamps with a margin.
 
int duplicateCheck (const DataBlock &data1, const DataBlock &data2, BUInt channel=0)
 Check if blocks are duplicates.
 
BUInt64 getFilePosition ()
 

Static Public Member Functions

static DataFormats getFormats ()
 Get the names of the supported formats.
 
- Static Public Member Functions inherited from Bds::DataFile
static DataFormats getFormats ()
 Get list of supported formats.
 

Additional Inherited Members

- Protected Attributes inherited from Bds::DataFile
BString ofileName
 
BString omode
 
BTimeStamp ofileNameTime
 
BFile ofile
 
BString oformat
 
BStringList onotices
 

Detailed Description

This class implements the BDS Data File/Stream access system.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
StreamsMax 

◆ anonymous enum

anonymous enum
Enumerator
DefaultBlockSize 

◆ PackFormat

Enumerator
PackFormat_Unknown 
PackFormat_SM 
PackFormat_CM 
PackFormat_SM_CC 

Constructor & Destructor Documentation

◆ DataFileBds()

Bds::DataFileBds::DataFileBds ( )

◆ ~DataFileBds()

Bds::DataFileBds::~DataFileBds ( )

Member Function Documentation

◆ open()

BError Bds::DataFileBds::open ( BString  fileName,
BString  mode 
)
virtual

Open the file for reading or writing.

Reimplemented from Bds::DataFile.

◆ flush()

BError Bds::DataFileBds::flush ( )
virtual

Flush any data to disk even if blocks are not full.

Reimplemented from Bds::DataFile.

◆ close()

BError Bds::DataFileBds::close ( )
virtual

Close file.

Reimplemented from Bds::DataFile.

◆ setFormat()

BError Bds::DataFileBds::setFormat ( BString  format)
virtual

Sets the sub-format.

Reimplemented from Bds::DataFile.

◆ setInfo()

BError Bds::DataFileBds::setInfo ( const DataInfo dataInfo,
const ChannelInfos channelInfos,
WriteOptionsList  options = WriteOptionSensorData 
)
virtual

Sets the information.

Reimplemented from Bds::DataFile.

◆ writeData()

BError Bds::DataFileBds::writeData ( const DataBlock data)
virtual

Writes a data block to the file.

Reimplemented from Bds::DataFile.

◆ getDataOrder()

DataFile::DataOrder Bds::DataFileBds::getDataOrder ( )
virtual

Get the expected order of writing data, by sample or by channel.

Reimplemented from Bds::DataFile.

◆ getInfo()

BError Bds::DataFileBds::getInfo ( DataInfo dataInfo,
DataFileOptions  options,
BList< DataError > &  errors 
)
virtual

Get information on open file.

Reimplemented from Bds::DataFile.

◆ seekBlock()

BError Bds::DataFileBds::seekBlock ( BUInt32  channel,
BUInt  segment,
BTimeStamp  time,
BUInt32 blockNumber,
BUInt64 sampleNumber,
DataBlock dataBlock 
)
virtual

Find the block that contains the samples for the time requested.

Reimplemented from Bds::DataFile.

◆ readData()

BError Bds::DataFileBds::readData ( BUInt32  channel,
BUInt  segment,
BUInt32  blockNumber,
DataBlock dataBlock 
)
virtual

Read the data block for the given channel or all channels if blockNumber is 0.

Reimplemented from Bds::DataFile.

◆ getFormats()

DataFormats Bds::DataFileBds::getFormats ( )
static

Get the names of the supported formats.

◆ setDiskBlockSize()

BError Bds::DataFileBds::setDiskBlockSize ( BUInt32  blockSize)

Sets up file/stream block size.

◆ getDiskBlockSize()

uint32_t Bds::DataFileBds::getDiskBlockSize ( )

Returns the data block size in bytes.

◆ streamletToChannel()

BError Bds::DataFileBds::streamletToChannel ( BUInt  streamlet,
BUInt channel 
)

Find streamlet given channel.

◆ setWritePositionForAppend()

BError Bds::DataFileBds::setWritePositionForAppend ( )

Sets the next packet write position.

◆ setReadPositionToStart()

BError Bds::DataFileBds::setReadPositionToStart ( )

◆ packetRead()

BError Bds::DataFileBds::packetRead ( BdsDataPacket packet)

Reads a packet from the file.

◆ packetWrite()

BError Bds::DataFileBds::packetWrite ( BdsDataPacket packet)

Writes a packet to the file.


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