Line data Source code
1 : /**
2 : * @file dummy_module_example.cxx
3 : *
4 : * This is part of the DUNE DAQ Application Framework, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "appfwk/DAQModule.hpp"
10 :
11 : #include "logging/Logging.hpp" // NOLINT
12 :
13 : #include <iostream>
14 : #include <map>
15 : #include <memory>
16 : #include <string>
17 :
18 : using namespace dunedaq::appfwk;
19 :
20 : int
21 0 : main()
22 : {
23 0 : TLOG() << "Creating Module instances...";
24 0 : std::shared_ptr<DAQModule> dummy_module = make_module("DummyModule", "dummy");
25 :
26 : // Init
27 0 : TLOG() << "Calling init on modules...";
28 0 : dummy_module->init(nullptr);
29 :
30 0 : TLOG() << "Calling stuff on module...";
31 0 : dummy_module->execute_command("stuff");
32 :
33 0 : TLOG() << "Calling bad_stuff on module...";
34 0 : try {
35 0 : dummy_module->execute_command("bad_stuff");
36 0 : TLOG() << "Should have thrown exception";
37 0 : } catch (GeneralDAQModuleIssue&) {
38 0 : TLOG() << "Exception thrown as expected";
39 0 : }
40 :
41 0 : TLOG() << "Test complete";
42 0 : }
|