Fawkes API Fawkes Development Version
plugin.h
1
2/***************************************************************************
3 * Protoboard plugin template
4 * - Main plugin template: Instantiate this with the appropriate interface
5 * handler mappings to create a domain-specific plugin.
6 *
7 * Copyright 2019 Victor Mataré
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef PROTOBOARD_PLUGIN_H
24#define PROTOBOARD_PLUGIN_H
25
26#include "blackboard_manager.h"
27#include "protobuf_thread.h"
28
29#include <core/plugin.h>
30
31/**
32 * The main class template that generates a domain-specific plugin
33 * @tparam IfaceManagerTs A list of @a bb_iface_manager instantiations that specify
34 * what message types should be handled on a given interface type.
35 */
36template <class... IfaceManagerTs>
38{
39public:
40 /**
41 * Initializes all threads required for the plugin.
42 * @param cfg The fawkes config
43 */
45 {
49 protobuf_thread->set_bb_manager(bb_mgr);
50 thread_list.push_back(bb_mgr);
51 thread_list.push_back(protobuf_thread);
52 }
53};
54
55#endif // PROTOBOARD_PLUGIN_H
Plugin representation for JSON transfer.
Definition: Plugin.h:28
The main class template that generates a domain-specific plugin.
Definition: plugin.h:38
ProtoboardPlugin(fawkes::Configuration *cfg)
Initializes all threads required for the plugin.
Definition: plugin.h:44
Interface for configuration handling.
Definition: config.h:68
Plugin interface class.
Definition: plugin.h:34
ThreadList thread_list
Thread list member.
Definition: plugin.h:53
void push_back(Thread *thread)
Add thread to the end.
The main thread that is woken each time a message arrives on any of the interfaces watched by a bb_if...
void set_protobuf_sender(AbstractProtobufSender *sender)
The ProtoBuf sender must be initialized after construction to beak a dependency loop.
Sends out ProtoBuf messages for all given interface managers.
Receive incoming ProtoBuf messages and pass them on to the BlackboardManager for publication to the a...
void set_bb_manager(BlackboardManager *bb_manager)
Deferred initialization of the pointer to the BlackboardManager.