BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
pipe.h File Reference

Module for data pipeline processing using pipes. More...

#include <cstddef>
#include <vector>
#include <memory>
#include <b8/type.h>

Go to the source code of this file.

Classes

class  Pipe::CPipe
 Base class for all pipe implementations. More...
 
class  Pipe::CNullPipe
 A null pipe class that does nothing. More...
 
class  Pipe::CMemReaderPipe
 A memory reader pipe class that reads data from a memory buffer. More...
 
class  Pipe::CMemBufferPipe
 A memory buffer pipe class that holds data in a buffer. More...
 
class  Pipe::CFilePipe
 A file pipe class that reads and writes data to a file. More...
 

Functions

void Pipe::Move (std::shared_ptr< Pipe::CPipe > pipe_in_, std::shared_ptr< Pipe::CPipe > pipe_out_)
 Moves data from one pipe to another.
 

Detailed Description

Module for data pipeline processing using pipes.

This module provides functions and classes for data pipeline processing using pipes. The Pipe namespace contains various classes and functions to manage and transfer data between different stages of a pipeline.

Features

  • CNullPipe: A null pipe class that does nothing.
  • CMemBufferPipe: A memory buffer pipe class that holds data in a buffer.
  • Move: A function to move data from one pipe to another.

Usage Example

Here is an example of how to use this module to transfer data between pipes:

#include <iostream>
#include <memory>
#include "pipe.h"
using namespace std;
using namespace Pipe;
* int main() {
// Create input and output pipes
auto pipe_in = std::make_shared<Pipe::CMemBufferPipe>();
auto pipe_out = std::make_shared<Pipe::CMemBufferPipe>();
// Push data into the input pipe
string input_data = "hello, world!";
for (char c : input_data) {
pipe_in->Push(static_cast<u8>(c));
}
// Dump the contents of the input pipe
std::cout << "Input Pipe Dump:" << std::endl;
pipe_in->Dump();
// Move data from the input pipe to the output pipe while applying filtering
u8 reg8;
while (pipe_in->Pop(reg8)) {
// Convert lowercase letters to uppercase
reg8 = std::toupper(reg8);
pipe_out->Push(reg8);
}
// Dump the contents of the output pipe
std::cout << "Output Pipe Dump:" << std::endl;
pipe_out->Dump();
return 0;
}
Module for data pipeline processing using pipes.
Version
1.0
Date
2022

Function Documentation

◆ Move()

void Pipe::Move ( std::shared_ptr< Pipe::CPipe > pipe_in_,
std::shared_ptr< Pipe::CPipe > pipe_out_ )
extern

Moves data from one pipe to another.

This function moves data from the input pipe to the output pipe until the input pipe is empty.

Parameters
pipe_in_The input pipe from which data is read.
pipe_out_The output pipe to which data is written.