Open Lighting Architecture: plugins/osc/OSCTarget.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
OSCTarget.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * OSCTarget.h
17 * Represents a IP:Port & OSC Address pair used to direct OSC messages.
18 * Copyright (C) 2012 Simon Newton
19 */
20
21#ifndef PLUGINS_OSC_OSCTARGET_H_
22#define PLUGINS_OSC_OSCTARGET_H_
23
24#include <string>
25#include "ola/network/SocketAddress.h"
26
27namespace ola {
28namespace plugin {
29namespace osc {
30
31 struct OSCTarget {
32 ola::network::IPV4SocketAddress socket_address;
33 std::string osc_address;
34
35 // The default constructor.
36 OSCTarget() {}
37
38 // The copy constructor
39 OSCTarget(const OSCTarget &target)
40 : socket_address(target.socket_address),
41 osc_address(target.osc_address) {
42 }
43
44 // A constructor that initializes the member variables as well.
45 OSCTarget(const ola::network::IPV4SocketAddress &socket_address,
46 const std::string &osc_address)
47 : socket_address(socket_address),
48 osc_address(osc_address) {
49 }
50
51 void operator=(const OSCTarget &other) {
52 socket_address = other.socket_address;
53 osc_address = other.osc_address;
54 }
55
56 std::string ToString() const {
57 return socket_address.ToString() + osc_address;
58 }
59
65 friend std::ostream& operator<<(std::ostream &out, const OSCTarget &target) {
66 return out << target.ToString();
67 }
68};
69} // namespace osc
70} // namespace plugin
71} // namespace ola
72#endif // PLUGINS_OSC_OSCTARGET_H_
SocketAddress.h
Represents Socket Addresses.
ola::network::IPV4SocketAddress
An IPv4 SocketAddress.
Definition SocketAddress.h:78
ola::plugin::osc
Code for the OSC protocol.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::plugin::osc::OSCTarget::operator<<
friend std::ostream & operator<<(std::ostream &out, const OSCTarget &target)
A helper function to write a OSCTarget to an ostream.
Definition OSCTarget.h:65