2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG (www.casparcg.com).
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
19 * Author: Helge Norberg, helge.norberg@svt.se
\r
28 #include <common/memory.h>
\r
30 #include <boost/function.hpp>
\r
32 namespace caspar { namespace protocol { namespace CLK {
\r
34 typedef boost::function<void (const std::vector<std::wstring>&)> clk_command_handler;
\r
37 * CLK command processor composed by multiple command handlers.
\r
41 class clk_command_processor
\r
43 std::map<std::wstring, clk_command_handler> handlers_;
\r
46 * Register a handler for a specific command.
\r
48 * @param command_name The command name to use this handler for.
\r
49 * @param handler The handler that will handle all commands with the
\r
52 * @return this command processor for method chaining.
\r
54 clk_command_processor& add_handler(
\r
55 const std::wstring& command_name, const clk_command_handler& handler);
\r
58 * Handle an incoming command.
\r
60 * @param command_name The command name.
\r
61 * @param parameters The raw parameters supplied with the command.
\r
63 * @return true if the command was handled, false if no handler was
\r
64 * registered to handle the command.
\r
67 const std::wstring& command_name,
\r
68 const std::vector<std::wstring>& parameters);
\r