mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
FairMQ: remove runSimpleMQStateMachine (now via control plugin).
This commit is contained in:
parent
d175a732a6
commit
e3cb1dd9e5
|
@ -105,7 +105,6 @@ set(FAIRMQ_HEADER_FILES
|
|||
shmem/FairMQShmCommon.h
|
||||
tools/CppSTL.h
|
||||
tools/Network.h
|
||||
tools/runSimpleMQStateMachine.h
|
||||
tools/Strings.h
|
||||
tools/Version.h
|
||||
zeromq/FairMQMessageZMQ.h
|
||||
|
|
|
@ -11,25 +11,6 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
template <typename R>
|
||||
class GenericFairMQDevice : public FairMQDevice
|
||||
{
|
||||
public:
|
||||
GenericFairMQDevice(R func) : r(func) {}
|
||||
|
||||
protected:
|
||||
virtual bool ConditionalRun() { return r(*static_cast<FairMQDevice*>(this)); }
|
||||
|
||||
private:
|
||||
R r;
|
||||
};
|
||||
|
||||
template <typename R>
|
||||
FairMQDevice* makeDeviceWithConditionalRun(R r)
|
||||
{
|
||||
return new GenericFairMQDevice<R>(r);
|
||||
}
|
||||
|
||||
using FairMQDevicePtr = FairMQDevice*;
|
||||
|
||||
// to be implemented by the user to return a child class of FairMQDevice
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* File: runSimpleMQStateMachine.h
|
||||
* Author: winckler
|
||||
*
|
||||
* Created on July 2, 2015, 2:07 PM
|
||||
*/
|
||||
|
||||
#ifndef RUNSIMPLEMQSTATEMACHINE_H
|
||||
#define RUNSIMPLEMQSTATEMACHINE_H
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "options/FairMQParser.h"
|
||||
#include "options/FairMQProgOptions.h"
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/PluginManager.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <dlfcn.h>
|
||||
|
||||
// template function that takes any device
|
||||
// and runs a simple MQ state machine configured from a JSON file and/or a plugin.
|
||||
template<typename TMQDevice>
|
||||
int runStateMachine(TMQDevice& device, FairMQProgOptions& cfg)
|
||||
{
|
||||
std::string config = cfg.GetValue<std::string>("config");
|
||||
std::string control = cfg.GetValue<std::string>("control");
|
||||
|
||||
device.ChangeState(TMQDevice::INIT_DEVICE);
|
||||
device.WaitForEndOfState(TMQDevice::INIT_DEVICE);
|
||||
|
||||
device.ChangeState(TMQDevice::INIT_TASK);
|
||||
device.WaitForEndOfState(TMQDevice::INIT_TASK);
|
||||
|
||||
device.ChangeState(TMQDevice::RUN);
|
||||
|
||||
if (control == "interactive")
|
||||
{
|
||||
LOG(ERROR) << "interactive control moved to plugin";
|
||||
return 1;
|
||||
// device.InteractiveStateLoop();
|
||||
}
|
||||
else if (control == "static")
|
||||
{
|
||||
device.WaitForEndOfState(TMQDevice::RUN);
|
||||
|
||||
if (!device.CheckCurrentState(TMQDevice::EXITING))
|
||||
{
|
||||
device.ChangeState(TMQDevice::RESET_TASK);
|
||||
device.WaitForEndOfState(TMQDevice::RESET_TASK);
|
||||
|
||||
device.ChangeState(TMQDevice::RESET_DEVICE);
|
||||
device.WaitForEndOfState(TMQDevice::RESET_DEVICE);
|
||||
|
||||
device.ChangeState(TMQDevice::END);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* RUNSIMPLEMQSTATEMACHINE_H */
|
Loading…
Reference in New Issue
Block a user