Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90953223
test_basic_plugin.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 6, 08:58
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, Nov 8, 08:58 (2 d)
Engine
blob
Format
Raw Data
Handle
22166143
Attached To
rSPECMICP SpecMiCP / ReactMiCP
test_basic_plugin.cpp
View Options
#include "utils/plugins/plugin_interface.h"
#include "utils/plugins/plugin_base.hpp"
#include "utils/plugins/module_base.hpp"
#include "utils/compat.hpp"
#include "test_basic_plugin_mockobject.hpp"
#include <iostream>
class TestObject: public TestBaseObject
{
public:
TestObject():
TestBaseObject() {}
double add(double a, double b) override {
return a + b;
}
};
class TestObject2: public TestBaseObject
{
public:
TestObject2():
TestBaseObject() {}
double add(double a, double b) override {
return a - b;
}
};
class BasicPlugin: public specmicp::plugins::PluginBase
{
public:
BasicPlugin():
PluginBase()
{
set_api_version(0, 1, 0);
}
bool initialize(const specmicp::plugins::PluginManagerServices& services) override
{
auto test_module = specmicp::plugins::ModuleBase::create_module();
auto retcode = services.register_module("test_module", std::move(test_module));
if (not retcode) {
return false;
}
auto factory = []() {return new TestObject();
};
retcode = services.register_object("test_module", "test_add", factory);
if (not retcode) {
return false;
}
auto factory2 = []() {return new TestObject2();
};
retcode = services.register_object("test_module", "test_substract", factory2);
if (not retcode) {
return false;
}
return true;
}
};
SPECMICP_PLUGIN(BasicPlugin);
Event Timeline
Log In to Comment