SPAOP
|
A wrapper for Liblo's lo_address. More...
#include <Address.h>
Public Member Functions | |
Address (const std::string &host, const std::string &port, int proto=LO_UDP) | |
Constructor. More... | |
Address (lo_address addr, bool isOwner=true) | |
Constructor. More... | |
virtual | ~Address () |
Destructor. More... | |
Address (const Address &other) | |
Copy constructor. More... | |
bool | setAddress (const std::string &newHost, const std::string &newPort) |
Updates this Address to send to a new destination. More... | |
int | getTtl () const |
Returns the time-to-live value for this Address. More... | |
void | setTtl (uint8_t ttl) |
Sets the time-to-live value for this Address. More... | |
std::string | getIface () const |
Returns the name of the network interface that will be used for sending to this address. More... | |
void | setIfaceByIp (const std::string &ip) |
Sets the network interface to use for sending to this address. More... | |
std::string | url () const |
An URL describing this address. More... | |
std::string | hostname () const |
The hostname of this adress. More... | |
std::string | port () const |
The port/service name of this adress. More... | |
int | send (const std::string &path, const std::string types,...) const |
Sends a OSC formatted message to this address. More... | |
int | send (const std::string &path, const Message &msg) const |
Sends a OSC formatted message to this address. More... | |
int | send (const std::string &path, const lo_message msg) const |
Sends a Liblo lo_message to this address. More... | |
int | sendVAList (const std::string &path, const std::string &types, va_list args) const |
Sends a OSC formatted message to this address. More... | |
int | sendFrom (const ServerThread &from, const std::string &path, const std::string types,...) const |
Sends a OSC formatted message to this address, from the same socket as the specified server. More... | |
int | sendFrom (const ServerThread &from, const std::string &path, const Message &msg) const |
Sends a OSC formatted message to this address, from the same socket as the specified server. More... | |
int | sendFrom (const ServerThread &from, const std::string &path, const lo_message msg) const |
Sends a Liblo lo_message to this address, from the same socket that a specified ServerThread is listening on. More... | |
int | sendVAListFrom (const ServerThread &from, const std::string &path, const std::string &types, va_list args) const |
Sends a OSC formatted message to this address, from the same socket that a specified ServerThread is listening on. More... | |
A wrapper for Liblo's lo_address.
lowrappers::Address::Address | ( | const std::string & | host, |
const std::string & | port, | ||
int | proto = LO_UDP |
||
) |
Constructor.
host | A valid hostname or IP string (see the Liblo documentation for what exactly is supported). |
port | A valid port number or service name (see the Liblo documentation for what exactly is supported). |
proto | The protocol to use (LO_UDP, LO_TCP or LO_UNIX). See the Liblo documentation for details. |
std::bad_alloc | in case memory allocation for the internal lo_address fails. |
lowrappers::Address::Address | ( | lo_address | addr, |
bool | isOwner = true |
||
) |
Constructor.
addr | The address to sent to. |
isOwner | Specifies who is responsible for freeing the lo_address addr (by calling lo_address_free). If set to true, this Address object will call lo_address_free on addr when it is destroyed or when a new Address is set. If set to false, the responsibility to call lo_address_free remains with the caller of this constructor. |
|
virtual |
Destructor.
Will call lo_address_delete on the lo_address stored internally if this Address object is the owner of the lo_address.
lowrappers::Address::Address | ( | const Address & | other | ) |
Copy constructor.
Will create a new copy of the lo_address stored within other, so the new Address will be owner of its lo_address while other's ownership status will remain unchanged.
other | The Adress to be copied. |
std::string lowrappers::Address::getIface | ( | ) | const |
Returns the name of the network interface that will be used for sending to this address.
This is relevant for sending multicast messages.
int lowrappers::Address::getTtl | ( | ) | const |
std::string lowrappers::Address::hostname | ( | ) | const |
The hostname of this adress.
std::string lowrappers::Address::port | ( | ) | const |
The port/service name of this adress.
int lowrappers::Address::send | ( | const std::string & | path, |
const std::string | types, | ||
... | |||
) | const |
Sends a OSC formatted message to this address.
path | The OSC path of the message. |
types | The types of the data items in the message. |
... | The data values to be transmitted. The types of the arguments passed here must agree with the types specified in the type parameter. |
return -1 on failure.
int lowrappers::Address::send | ( | const std::string & | path, |
const Message & | msg | ||
) | const |
Sends a OSC formatted message to this address.
path | The OSC path of the message. |
msg | The Message to be sent. |
int lowrappers::Address::send | ( | const std::string & | path, |
const lo_message | msg | ||
) | const |
Sends a Liblo lo_message to this address.
path | The OSC path of the message. |
msg | The Message to be sent. |
int lowrappers::Address::sendFrom | ( | const ServerThread & | from, |
const std::string & | path, | ||
const std::string | types, | ||
... | |||
) | const |
Sends a OSC formatted message to this address, from the same socket as the specified server.
from | The server to send the message from. |
path | The OSC path of the message. |
types | The types of the data items in the message. |
... | The data values to be transmitted. The types of the arguments passed here must agree with the types specified in the type parameter. |
int lowrappers::Address::sendFrom | ( | const ServerThread & | from, |
const std::string & | path, | ||
const Message & | msg | ||
) | const |
Sends a OSC formatted message to this address, from the same socket as the specified server.
from | The server to send the message from. |
path | The OSC path of the message. |
msg | The Message to be sent. |
int lowrappers::Address::sendFrom | ( | const ServerThread & | from, |
const std::string & | path, | ||
const lo_message | msg | ||
) | const |
Sends a Liblo lo_message to this address, from the same socket that a specified ServerThread is listening on.
from | The server to send the message from. |
path | The OSC path of the message. |
msg | The Message to be sent. |
int lowrappers::Address::sendVAList | ( | const std::string & | path, |
const std::string & | types, | ||
va_list | args | ||
) | const |
Sends a OSC formatted message to this address.
Parameters are passed as a va_list. This allows other varargs methods to pass on their arguments.
path | The OSC path of the message. |
types | The types of the data items in the message. |
args | The data values to be transmitted. The types of the arguments passed here (and their length) must agree with the types specified in the type parameter. |
int lowrappers::Address::sendVAListFrom | ( | const ServerThread & | from, |
const std::string & | path, | ||
const std::string & | types, | ||
va_list | args | ||
) | const |
Sends a OSC formatted message to this address, from the same socket that a specified ServerThread is listening on.
Parameters are passed as a va_list. This allows other varargs methods to pass on their arguments.
from | The server to send the message from. |
path | The OSC path of the message. |
types | The types of the data items in the message. |
args | The data values to be transmitted. The types of the arguments passed here (and their length) must agree with the types specified in the type parameter. |
bool lowrappers::Address::setAddress | ( | const std::string & | newHost, |
const std::string & | newPort | ||
) |
Updates this Address to send to a new destination.
(Internally, a new lo_adress is created, replacing the old one.)
newHost | A valid hostname or IP string (see the Liblo documentation for what exactly is supported). |
newPort | A valid port number or service name (see the Liblo documentation for what exactly is supported). |
void lowrappers::Address::setIfaceByIp | ( | const std::string & | ip | ) |
Sets the network interface to use for sending to this address.
ip | The IP of the local interface where the messages shall be sent from. |
void lowrappers::Address::setTtl | ( | uint8_t | ttl | ) |
std::string lowrappers::Address::url | ( | ) | const |
An URL describing this address.