#include "PL_Fork1.h" #include "MaterialBuffer.h" #include "logger.h" struct PL_Fork1_Internal { //uint8_t buffer[1920*1080*4]; //size_t buffSize; //size_t buffSizeMax; PipeMaterial lastPm; MB_Frame lastFrame; PL_Fork1_Config config; bool payError; PL_Fork1_Internal() : //buffSize(0), buffSizeMax(sizeof(buffer)), lastPm(), lastFrame(), config(), payError(true) { } ~PL_Fork1_Internal() { } void reset() { //buffSize = 0; payError = true; PipeMaterial _lastPm; lastPm = _lastPm; MB_Frame _lastFrame; lastFrame = _lastFrame; PL_Fork1_Config _config; config = _config; } }; PipeLineElem* create_PL_Fork1() { return new PL_Fork1; } PL_Fork1::PL_Fork1() : internal(new PL_Fork1_Internal), pl(nullptr) { } PL_Fork1::~PL_Fork1() { delete (PL_Fork1_Internal*)internal; internal= nullptr; } bool PL_Fork1::init(void* args) { PL_Fork1_Internal* in = (PL_Fork1_Internal*)internal; in->reset(); if (args == nullptr) { LOG_ERROR << "Config should give" << std::endl; return false; } PL_Fork1_Config* config = (PL_Fork1_Config*)args; in->config = *config; return true; } void PL_Fork1::finit() { PL_Fork1_Internal* in = (PL_Fork1_Internal*)internal; } bool PL_Fork1::pay(const PipeMaterial& pm) { PL_Fork1_Internal* in = (PL_Fork1_Internal*)internal; PL_Fork1_Config& config(in->config); in->lastPm = pm; return false; } bool PL_Fork1::gain(PipeMaterial& pm) { PL_Fork1_Internal* in = (PL_Fork1_Internal*)internal; return false; } void PL_Fork1::attach_pipe_line(PipeLine* pl) { PL_Fork1_Internal* in = (PL_Fork1_Internal*)internal; if (this->pl != nullptr) { LOG_ERROR << "Has areadly attached pipe line" << std::endl; return; } if (pl == nullptr) { LOG_NOTICE << "Detach pipe line" << std::endl; this->pl->remove_elem(this); this->pl = nullptr; return; } this->pl = pl; PipeLine* mainPipeLineManager = this->manager; pl->push_front_elem(this); this->manager = mainPipeLineManager; }