Line data Source code
1 : /**
2 : * @file dummy_commanded_object_.hpp Dummy commanded object
3 : * implementation of the CommandedObject interface
4 : *
5 : * This is part of the DUNE DAQ Application Framework, copyright 2020.
6 : * Licensing/copyright details are in the COPYING file that you should have
7 : * received with this code.
8 : */
9 : #ifndef CMDLIB_TEST_APPS_DUMMYCOMMANDEDOBJECT_HPP_
10 : #define CMDLIB_TEST_APPS_DUMMYCOMMANDEDOBJECT_HPP_
11 :
12 : #include "cmdlib/CommandedObject.hpp"
13 :
14 : #include "logging/Logging.hpp"
15 :
16 : #include <stdexcept>
17 : #include <string>
18 :
19 : class DummyCommandedObject : public dunedaq::cmdlib::CommandedObject
20 : {
21 : public:
22 0 : void execute(const dunedaq::cmdlib::cmdobj_t& command)
23 : {
24 0 : if (command.dump() == "{\"asd\":true}") {
25 0 : TLOG() << command.dump() << " is a REALLY slow command";
26 0 : std::this_thread::sleep_for(std::chrono::seconds(5));
27 0 : throw std::runtime_error("Testing throw.");
28 : } else {
29 0 : TLOG() << "I executed cmd: " << command.dump();
30 : }
31 0 : }
32 : };
33 :
34 : #endif // CMDLIB_TEST_APPS_DUMMYCOMMANDEDOBJECT_HPP_
|