mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-12 16:21:13 +00:00
74 lines
2.6 KiB
C
74 lines
2.6 KiB
C
/********************************************************************************
|
|
* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
|
* *
|
|
* This software is distributed under the terms of the *
|
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
|
* copied verbatim in the file "LICENSE" *
|
|
********************************************************************************/
|
|
|
|
#ifndef FAIR_MQ_TEST_PLUGIN_DUMMY
|
|
#define FAIR_MQ_TEST_PLUGIN_DUMMY
|
|
|
|
#include <fairmq/Plugin.h>
|
|
|
|
#include <string>
|
|
#include <tuple>
|
|
#include <vector>
|
|
|
|
namespace fair
|
|
{
|
|
namespace mq
|
|
{
|
|
namespace test
|
|
{
|
|
|
|
class DummyPlugin : public fair::mq::Plugin
|
|
{
|
|
public:
|
|
|
|
DummyPlugin(
|
|
const std::string name,
|
|
const Version version,
|
|
const std::string maintainer,
|
|
const std::string homepage,
|
|
PluginServices& pluginServices)
|
|
: Plugin(name, version, maintainer, homepage, pluginServices)
|
|
{
|
|
SubscribeToDeviceStateChange(
|
|
[&](DeviceState newState){
|
|
switch (newState)
|
|
{
|
|
case DeviceState::Exiting:
|
|
UnsubscribeFromDeviceStateChange();
|
|
break;
|
|
}
|
|
}
|
|
);
|
|
}
|
|
}; /* class DummyPlugin */
|
|
|
|
auto DummyPluginProgramOptions() -> Plugin::ProgOptions
|
|
{
|
|
auto plugin_options = boost::program_options::options_description{"Dummy Plugin"};
|
|
plugin_options.add_options()
|
|
("custom-dummy-option", boost::program_options::value<std::string>(), "Cool custom option.");
|
|
("custom-dummy-option2", boost::program_options::value<std::string>(), "Another cool custom option.");
|
|
return plugin_options;
|
|
}
|
|
|
|
REGISTER_FAIRMQ_PLUGIN(
|
|
DummyPlugin, // Class name
|
|
test_dummy, // Plugin name (string, lower case chars only)
|
|
(fair::mq::Plugin::Version{@VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_PATCH@}), // Version
|
|
"Mr. Dummy <dummy@test.net>", // Maintainer
|
|
"https://git.test.net/dummy.git", // Homepage
|
|
fair::mq::test::DummyPluginProgramOptions // Free function which declares custom program options for the plugin
|
|
// signature: () -> boost::optional<boost::program_options::options_description>
|
|
)
|
|
|
|
} /* namespace test */
|
|
} /* namespace mq */
|
|
} /* namespace fair */
|
|
|
|
#endif /* FAIR_MQ_TEST_PLUGIN_DUMMY */
|