]> git.sesse.net Git - casparcg/blob - protocol/osc/client.h
Changed copyright header in all files, and added it in some files where it was missing.
[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(
44                         boost::asio::io_service& service,
45                         Concurrency::ISource<core::monitor::message>& source);
46         
47         client(client&&);
48
49         /**
50          * Get a subscription token that ensures that OSC messages are sent to the
51          * given endpoint as long as the token is alive. It will stop sending when
52          * the token is dropped unless another token to the same endpoint has
53          * previously been checked out.
54          *
55          * @param endpoint The UDP endpoint to send OSC messages to.
56          *
57          * @return The token. It is ok for the token to outlive the client
58          */
59         std::shared_ptr<void> get_subscription_token(
60                         const boost::asio::ip::udp::endpoint& endpoint);
61
62         ~client();
63
64         // Methods
65                 
66         client& operator=(client&&);
67         
68         // Properties
69
70 private:
71         struct impl;
72         std::shared_ptr<impl> impl_;
73 };
74
75 }}}