]> git.sesse.net Git - casparcg/blob - protocol/osc/client.h
Merge branch 'master' of https://github.com/CasparCG/Server
[casparcg] / protocol / osc / client.h
1 /*
2 * Copyright 2013 Sveriges Television AB http://casparcg.com/
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Robert Nagy, ronag89@gmail.com
20 * Author: Helge Norberg, helge.norberg@svt.se
21 */
22
23 #pragma once
24
25 #include <common/memory/safe_ptr.h>
26
27 #include <core/monitor/monitor.h>
28 #include <boost/asio/ip/udp.hpp>
29 #include <boost/noncopyable.hpp>
30
31 namespace caspar { namespace protocol { namespace osc {
32
33 class client
34 {
35         client(const client&);
36         client& operator=(const client&);
37 public: 
38
39         // Static Members
40
41         // Constructors
42
43         client(std::shared_ptr<boost::asio::io_service> service);
44         
45         client(client&&);
46
47         /**
48          * Get a subscription token that ensures that OSC messages are sent to the
49          * given endpoint as long as the token is alive. It will stop sending when
50          * the token is dropped unless another token to the same endpoint has
51          * previously been checked out.
52          *
53          * @param endpoint The UDP endpoint to send OSC messages to.
54          *
55          * @return The token. It is ok for the token to outlive the client
56          */
57         std::shared_ptr<void> get_subscription_token(
58                         const boost::asio::ip::udp::endpoint& endpoint);
59
60         ~client();
61
62         // Methods
63                 
64         client& operator=(client&&);
65         
66         // Properties
67
68         safe_ptr<core::monitor::sink> sink();
69 private:
70         struct impl;
71         safe_ptr<impl> impl_;
72 };
73
74 }}}