Vector BLF: Vector::BLF::File Class Reference

Vector BLF

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Vector::BLF::File Class Referencefinal

`#include <File.h>`

## Public Member Functions
virtual void | open (const char *filename, const std::ios_base::openmode mode=std::ios_base::in)
virtual void | open (const std::string &filename, const std::ios_base::openmode mode=std::ios_base::in)
virtual bool | is_open () const
virtual bool | good () const
virtual bool | eof () const
virtual ObjectHeaderBase * | read ()
virtual void | write (ObjectHeaderBase *ohb)
virtual void | close ()
virtual uint32_t | defaultLogContainerSize () const
virtual void | setDefaultLogContainerSize (uint32_t defaultLogContainerSize)

## Static Public Member Functions
static ObjectHeaderBase * | createObject (ObjectType type)

## Public Attributes
FileStatistics | fileStatistics {}
uint64_t | currentUncompressedFileSize {}
std::atomic< uint32_t > | currentObjectCount {}
int | compressionLevel {1}
bool | writeRestorePoints {true}

## Detailed Description

File

This is similar to std::fstream for BLFs

## Member Function Documentation

## ◆ close()

void Vector::BLF::File::close | ( |  | ) |
| virtual

close file

## ◆ createObject()

ObjectHeaderBase * Vector::BLF::File::createObject | ( | ObjectType | type | ) |
| static

create object of given type

Parameters

  type | object type

Returns
  new object

## ◆ defaultLogContainerSize()

uint32_t Vector::BLF::File::defaultLogContainerSize | ( |  | ) | const
| virtual

Get default log container size.

Returns
  default log container size

## ◆ eof()

bool Vector::BLF::File::eof | ( |  | ) | const
| virtual

Check whether eofbit is set.

Returns
  true if end-of-file reached

## ◆ good()

bool Vector::BLF::File::good | ( |  | ) | const
| virtual

Check whether state of stream is good.

Returns
  true if no error flags set

## ◆ is_open()

bool Vector::BLF::File::is_open | ( |  | ) | const
| virtual

is file open?

Returns
  true if file is open

## ◆ open() [1/2]

void Vector::BLF::File::open | ( | const char * | filename,
|  | const std::ios_base::openmode | mode = `std::ios_base::in`
| ) |  |
| virtual

open file

Parameters

  [in] | filename | file name
  [in] | mode | open mode, either in (read) or out (write)

## ◆ open() [2/2]

void Vector::BLF::File::open | ( | const std::string & | filename,
|  | const std::ios_base::openmode | mode = `std::ios_base::in`
| ) |  |
| virtual

open file

Parameters

  [in] | filename | file name
  [in] | mode | open mode, either in (read) or out (write)

## ◆ read()

ObjectHeaderBase * Vector::BLF::File::read | ( |  | ) |
| virtual

Read object from file.

Ownership is taken over from the library to the user. The user has to take care to delete the object.

Todo:
  Use std::unique_ptr in future versions.

Returns
  read object or nullptr

## ◆ setDefaultLogContainerSize()

void Vector::BLF::File::setDefaultLogContainerSize | ( | uint32_t | defaultLogContainerSize | ) |
| virtual

Set default log container size.

Parameters

  [in] | defaultLogContainerSize | default log container size

## ◆ write()

void Vector::BLF::File::write | ( | ObjectHeaderBase * | ohb | ) |
| virtual

Write object to file.

Ownership is taken over from the user to the library. The object should not be further accessed any more.

Todo:
  Use std::unique_ptr in future versions.

Parameters

  [in] | ohb | write object

## Member Data Documentation

## ◆ compressionLevel

int Vector::BLF::File::compressionLevel {1}

compression level

zlib compression levels:

- 0: Z_NO_COMPRESSION
- 1: Z_BEST_SPEED
- 9: Z_BEST_COMPRESSION

Vector BLF compression levels:

- 0: no compression
- 6: default compression
- 10: maximum compression

## ◆ currentObjectCount

std::atomic<uint32_t> Vector::BLF::File::currentObjectCount {}

Current number of objects read

Unknown115 is not counted.

## ◆ currentUncompressedFileSize

uint64_t Vector::BLF::File::currentUncompressedFileSize {}

Current uncompressed file size

This includes the LogContainer headers, and the uncompressed content.

## ◆ fileStatistics

FileStatistics Vector::BLF::File::fileStatistics {}

File statistics from file header. contains total counts/sizes

## ◆ writeRestorePoints

bool Vector::BLF::File::writeRestorePoints {true}

Write restore points at file close.

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

- File.h
- File.cpp