Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 
27 namespace ola {
28 namespace plugin {
29 namespace osc {
30 
32 
33 struct OSCTarget {
34  IPV4SocketAddress socket_address;
35  string osc_address;
36 
37  // The default constructor.
38  OSCTarget() {}
39 
40  // The copy constructor
41  OSCTarget(const OSCTarget &target)
42  : socket_address(target.socket_address),
43  osc_address(target.osc_address) {
44  }
45 
46  // A constuctor that initializes the member variables as well.
47  OSCTarget(const IPV4SocketAddress &socket_address, const string &osc_address)
48  : socket_address(socket_address),
49  osc_address(osc_address) {
50  }
51 
52  string ToString() const {
53  return socket_address.ToString() + osc_address;
54  }
55 
61  friend ostream& operator<<(ostream &out, const OSCTarget &target) {
62  return out << target.ToString();
63  }
64 };
65 } // namespace osc
66 } // namespace plugin
67 } // namespace ola
68 #endif // PLUGINS_OSC_OSCTARGET_H_