Commit 855be949 authored by Robert Manzke's avatar Robert Manzke

two different plugins

parent efdb0cf5
......@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CTest)
enable_testing()
add_executable(CTAG-Plug main.cpp ctagAudioPluginAM.cpp)
add_executable(CTAG-Plug main.cpp ctagAudioPluginAM.cpp ctagAudioPluginFM.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
......
......@@ -2,4 +2,12 @@
void ctagAudioPluginAM::Process () const {
std::cout << "ctag AM\n";
}
ctagAudioPluginAM::ctagAudioPluginAM(){
std::cout << "Constructor called\n";
}
ctagAudioPluginAM::~ctagAudioPluginAM(){
std::cout << "Destructor called\n";
}
\ No newline at end of file
......@@ -5,4 +5,6 @@ class ctagAudioPluginAM : public ctagAudioPlugin{
REGISTER("ctagAudioPluginAM", ctagAudioPlugin);
public:
void Process() const override;
ctagAudioPluginAM();
~ctagAudioPluginAM();
};
\ No newline at end of file
#include "ctagAudioPluginFM.hpp"
void ctagAudioPluginFM::Process () const {
std::cout << "ctag FM\n";
}
ctagAudioPluginFM::ctagAudioPluginFM(){
std::cout << "Constructor called\n";
}
ctagAudioPluginFM::~ctagAudioPluginFM(){
std::cout << "Destructor called\n";
}
\ No newline at end of file
#include "ctagAudioPlugin.hpp"
#include <iostream>
class ctagAudioPluginFM : public ctagAudioPlugin{
REGISTER("ctagAudioPluginFM", ctagAudioPlugin);
public:
void Process() const override;
ctagAudioPluginFM();
~ctagAudioPluginFM();
};
\ No newline at end of file
......@@ -4,8 +4,11 @@
using factory::Registry;
int main(int, char**) {
std::unique_ptr<ctagAudioPlugin> shape = Registry<ctagAudioPlugin>::New("ctagAudioPluginAM");
assert(shape);
shape->Process(); // will draw a rectangle!
int main(int argc, char** argv) {
std::unique_ptr<ctagAudioPlugin> plugin = Registry<ctagAudioPlugin>::New(argv[1]);
assert(plugin);
plugin->Process(); // will draw a rectangle!
plugin = Registry<ctagAudioPlugin>::New(argv[2]);
plugin->Process();
plugin = nullptr;
}
// Author / Source https://github.com/Xadeck/Registerer
// Framework for performing registration of object factories.
//
// The major points of the framework are:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment