Implement relevant methods for DataIngestionLayer
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
#ifndef GCRYPTCLI_DATAINGESTIONLAYER_H
|
||||
#define GCRYPTCLI_DATAINGESTIONLAYER_H
|
||||
|
||||
#include <istream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iosfwd>
|
||||
#include <queue>
|
||||
#include <GCrypt/Block.h>
|
||||
|
||||
using namespace Leonetienne::GCrypt;
|
||||
|
||||
namespace IO {
|
||||
|
||||
@@ -13,6 +15,19 @@ namespace IO {
|
||||
//! Will initialize the ingestion
|
||||
static void Init();
|
||||
|
||||
//! Will attempt to read a data block.
|
||||
//! Requires Init() to have been called
|
||||
static void ReadBlock();
|
||||
|
||||
//! Have we read in all available blocks?
|
||||
static bool ReachedEOF();
|
||||
|
||||
//! Will return true if there is at least one block to be GetBlock()'ed
|
||||
static bool IsBlockReady();
|
||||
|
||||
//! Will return the next block in the queue
|
||||
static Block GetNextBlock();
|
||||
|
||||
private:
|
||||
static std::istream* in;
|
||||
|
||||
@@ -21,6 +36,14 @@ namespace IO {
|
||||
// We still have to CLOSE the file handle afterwards!
|
||||
static std::ifstream ifs;
|
||||
static std::istringstream iss;
|
||||
|
||||
// Indicates whether EOF has been reached
|
||||
static bool reachedEof;
|
||||
// Indicates whether this class is initialized
|
||||
static bool initialized;
|
||||
|
||||
// All read blocks, that haven't been given out yet
|
||||
static std::queue<Block> blocks;
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user