dandere2x/cpp_rework/plugins/AbstractPlugin.h
2021-03-01 18:19:32 -08:00

75 lines
2.3 KiB
C++

/*
This file is part of the Dandere2x project.
Dandere2x is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Dandere2x is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <https://www.gnu.org/licenses/>.
*/
/*
========= Copyright aka_katto 2018, All rights reserved. ============
Original Author: aka_katto
Date: 4/11/20
Purpose: An abstract class describing inherited d2x_cpp classes.
===================================================================== */
#ifndef CPP_REWORK_ABSTRACTPLUGIN_H
#define CPP_REWORK_ABSTRACTPLUGIN_H
#include <string>
#include <utility>
#include "../frame/Frame.h"
using namespace std;
class AbstractPlugin {
public:
// Note that "current_frame" is not const, and can be updated in the "update_frame" function, once the plugin
// "updates" it.
AbstractPlugin(shared_ptr<Frame> current_frame,
const shared_ptr<Frame>& next_frame,
const shared_ptr<Frame>& next_frame_compressed,
const int block_size){
this->current_frame = move(current_frame);
this->next_frame = next_frame;
this->next_frame_compressed = next_frame_compressed;
this->block_size = block_size;
}
// Every plugin needs to be 'ran' to some extent.
virtual void run() = 0;
// Write the contents of the plugin somewhere.
virtual void write(const string &output_file) = 0;
private:
// Every plugin needs to affect the frame somehow after it's done it's processing on it.
virtual void update_frame() = 0;
// Every plugin *should* utilize some sort of parallel optimization, although it doesn't need t.
virtual void parallel_function_call(int x, int y) = 0;
shared_ptr<Frame> current_frame;
shared_ptr<Frame> next_frame;
shared_ptr<Frame> next_frame_compressed;
int block_size;
};
#endif //CPP_REWORK_ABSTRACTPLUGIN_H