| | |
| | | #ifndef _PL_FORK_H_
|
| | | #define _PL_FORK_H_
|
| | | #include "PL_Fork.h"
|
| | | #include "MaterialBuffer.h"
|
| | | #include "logger.h"
|
| | |
|
| | | #include "PipeLine.h"
|
| | |
|
| | | struct PL_Fork_Config
|
| | | struct PL_Fork_Internal
|
| | | {
|
| | | //uint8_t buffer[1920*1080*4];
|
| | | //size_t buffSize;
|
| | | //size_t buffSizeMax;
|
| | |
|
| | | PipeMaterial lastPm;
|
| | | |
| | | MB_Frame lastFrame;
|
| | | |
| | | PL_Fork_Config config;
|
| | |
|
| | | bool payError;
|
| | |
|
| | | PL_Fork_Internal() : |
| | | //buffSize(0), buffSizeMax(sizeof(buffer)), |
| | | lastPm(), lastFrame(), config(), payError(true)
|
| | | {
|
| | | }
|
| | | |
| | | ~PL_Fork_Internal()
|
| | | {
|
| | | }
|
| | | |
| | | void reset()
|
| | | {
|
| | | //buffSize = 0;
|
| | | payError = true;
|
| | | |
| | | PipeMaterial _lastPm;
|
| | | lastPm = _lastPm;
|
| | | |
| | | MB_Frame _lastFrame;
|
| | | lastFrame = _lastFrame;
|
| | | |
| | | PL_Fork_Config _config;
|
| | | config = _config;
|
| | | }
|
| | | };
|
| | |
|
| | | class PL_Fork : public PipeLineElem
|
| | | PipeLineElem* create_PL_Fork()
|
| | | {
|
| | | public:
|
| | | enum ForkBy
|
| | | return new PL_Fork;
|
| | | }
|
| | |
|
| | | PL_Fork::PL_Fork() : internal(new PL_Fork_Internal), pl(nullptr)
|
| | | {
|
| | | }
|
| | |
|
| | | PL_Fork::~PL_Fork()
|
| | | {
|
| | | delete (PL_Fork_Internal*)internal;
|
| | | internal= nullptr;
|
| | | }
|
| | |
|
| | | bool PL_Fork::init(void* args)
|
| | | {
|
| | | PL_Fork_Internal* in = (PL_Fork_Internal*)internal;
|
| | | in->reset();
|
| | |
|
| | | if (args == nullptr)
|
| | | {
|
| | | FB_NONE,
|
| | | FB_TURNS,
|
| | | FB_RANDOM,
|
| | | FB_PM_TYPE,
|
| | | FB_MB_TYPE,
|
| | | FB_BREAK_LIST
|
| | | };
|
| | | LOG_ERROR << "Config should give" << std::endl;
|
| | | return false;
|
| | | }
|
| | |
|
| | | PL_Fork_Config* config = (PL_Fork_Config*)args;
|
| | | in->config = *config;
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | void PL_Fork::finit()
|
| | | {
|
| | | PL_Fork_Internal* in = (PL_Fork_Internal*)internal;
|
| | |
|
| | | }
|
| | |
|
| | | bool PL_Fork::pay(const PipeMaterial& pm)
|
| | | {
|
| | | PL_Fork_Internal* in = (PL_Fork_Internal*)internal;
|
| | | PL_Fork_Config& config(in->config);
|
| | |
|
| | | in->lastPm = pm;
|
| | |
|
| | | enum ForkSync
|
| | | return false;
|
| | | }
|
| | |
|
| | | bool PL_Fork::gain(PipeMaterial& pm)
|
| | | {
|
| | | PL_Fork_Internal* in = (PL_Fork_Internal*)internal;
|
| | | |
| | | return false;
|
| | | }
|
| | |
|
| | | void PL_Fork::attach_pipe_line(PipeLine* pl)
|
| | | {
|
| | | PL_Fork_Internal* in = (PL_Fork_Internal*)internal;
|
| | | |
| | | if (this->pl != nullptr)
|
| | | {
|
| | | FS_NONE,
|
| | | FS_SEQUENCE,
|
| | | FS_PARALLEL,
|
| | | FS_MAIN_PL_FIRST,
|
| | | FS_MAIN_PL_LAST,
|
| | | };
|
| | |
|
| | | public:
|
| | | PL_Fork();
|
| | | virtual ~PL_Fork();
|
| | |
|
| | | virtual bool init(void* args);
|
| | | virtual void finit();
|
| | |
|
| | | virtual bool pay(const PipeMaterial& pm);
|
| | | virtual bool gain(PipeMaterial& pm);
|
| | | LOG_ERROR << "Has areadly attached pipe line" << std::endl;
|
| | | return;
|
| | | }
|
| | |
|
| | | private:
|
| | | void* internal;
|
| | | };
|
| | |
|
| | | PipeLineElem* create_PL_Paint();
|
| | |
|
| | | #endif
|
| | | 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;
|
| | | }
|