Apache Singa
A General Distributed Deep Learning Library
Public Member Functions | Protected Member Functions | List of all members
singa::io::BinFileReader Class Reference

Binfilereader reads tuples from binary file with key-value pairs. More...

#include <reader.h>

Inheritance diagram for singa::io::BinFileReader:
Inheritance graph
[legend]
Collaboration diagram for singa::io::BinFileReader:
Collaboration graph
[legend]

Public Member Functions

bool Open (const std::string &path) override
 
bool Open (const std::string &path, int capacity)
 user defines capacity More...
 
void Close () override
 
bool Read (std::string *key, std::string *value) override
 
int Count () override
 
void SeekToFirst () override
 
std::string path ()
 return path to binary file
 
- Public Member Functions inherited from singa::io::Reader
virtual ~Reader ()
 In case that users forget to call Close() to release resources, e.g., memory, you can release them here. More...
 

Protected Member Functions

bool OpenFile ()
 Open a file with path_ and initialize buf_.
 
bool ReadField (std::string *content)
 Read the next filed, including content_len and content; return true if succeed. More...
 
bool PrepareNextField (int size)
 Read data from disk if the current data in the buffer is not a full field. More...
 

Detailed Description

Binfilereader reads tuples from binary file with key-value pairs.

Member Function Documentation

◆ Close()

void singa::io::BinFileReader::Close ( )
overridevirtual

Implements singa::io::Reader.

◆ Count()

int singa::io::BinFileReader::Count ( )
overridevirtual

Implements singa::io::Reader.

◆ Open() [1/2]

bool singa::io::BinFileReader::Open ( const std::string &  path)
overridevirtual

Implements singa::io::Reader.

◆ Open() [2/2]

bool singa::io::BinFileReader::Open ( const std::string &  path,
int  capacity 
)

user defines capacity

user defines capacity

◆ PrepareNextField()

bool singa::io::BinFileReader::PrepareNextField ( int  size)
protected

Read data from disk if the current data in the buffer is not a full field.

size is the size of the next field.

◆ Read()

bool singa::io::BinFileReader::Read ( std::string *  key,
std::string *  value 
)
overridevirtual

Implements singa::io::Reader.

◆ ReadField()

bool singa::io::BinFileReader::ReadField ( std::string *  content)
protected

Read the next filed, including content_len and content; return true if succeed.

◆ SeekToFirst()

void singa::io::BinFileReader::SeekToFirst ( )
overridevirtual

Implements singa::io::Reader.


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