Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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>
26 
27 namespace ola {
28 namespace plugin {
29 namespace 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  std::string ToString() const {
52  return socket_address.ToString() + osc_address;
53  }
54 
60  friend std::ostream& operator<<(std::ostream &out, const OSCTarget &target) {
61  return out << target.ToString();
62  }
63 };
64 } // namespace osc
65 } // namespace plugin
66 } // namespace ola
67 #endif // PLUGINS_OSC_OSCTARGET_H_
Represents Socket Addresses.
Definition: OSCTarget.h:31
friend std::ostream & operator<<(std::ostream &out, const OSCTarget &target)
A helper function to write a OSCTarget to an ostream.
Definition: OSCTarget.h:60
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
An IPv4 SocketAddress.
Definition: SocketAddress.h:78