|
SPAOP
|
A server thread with Liblo-style callback capabilities. More...
#include <ServerThread.h>


Classes | |
| class | Listener |
| A listener interface for listeners to be called by the ServerThread when incoming OSC messages are received. More... | |
Public Member Functions | |
| ServerThread (lo_err_handler err_h) | |
| Constructor. More... | |
| ServerThread (const std::string &port, lo_err_handler err_h) | |
| Constructor. More... | |
| ServerThread (const std::string &group, const std::string &port, lo_err_handler err_h) | |
| Constructor. More... | |
| ServerThread (const std::string &group, const std::string &port, const std::string &ifaceIp, lo_err_handler err_h) | |
| Constructor. More... | |
| virtual | ~ServerThread () |
| Destructor. More... | |
| bool | isValid () const |
| Checks if initialization was successfull. More... | |
| std::string | url () const |
| An URL describing the address of the server thread. More... | |
| int | port () const |
| The port number that the server thread has bound to. More... | |
| bool | addMethod (const char *path, const char *typespec, lo_method_handler h, void *user_data) |
| Adds a lo_method_handler to this server thread. More... | |
| bool | addListener (const char *path, const char *typespec, Listener *listener) |
| Adds a Listener to this server thread. More... | |
| void | delMethod (const char *path, const char *typespec) |
| Delete a method from this server thread. More... | |
Public Member Functions inherited from thread::Thread | |
| Thread () | |
| Constructor. More... | |
| virtual | ~Thread () |
| Destructor. More... | |
| void | start () |
| Starts the Thread. More... | |
| void | stop () |
| Sets the internal flag stopped_ to true. More... | |
| void | join () |
| Joins the thread. More... | |
Friends | |
| class | Address |
| Address is friend class so it can access the internal lo_server for sending messages from its port. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from thread::Thread | |
| bool | isStopped () const |
| Returns true if the thread was stopped. More... | |
A server thread with Liblo-style callback capabilities.
This is NOT a wrapper for Liblo's lo_server_thread because the lo_server_thread relies on the pthread library. For better compability with Windows, this class uses the thread::Thread that relies on std::thread (the tradeoff for this is: C++11 is now required).
| lowrappers::ServerThread::ServerThread | ( | lo_err_handler | err_h | ) |
Constructor.
An unused port will be chosen by the system, its number may be retrieved with ServerThread::port so it can be passed to clients.
| err_h | A function that will be called in the event of an error being raised. The function prototype is defined in lo_types.h |
| lowrappers::ServerThread::ServerThread | ( | const std::string & | port, |
| lo_err_handler | err_h | ||
| ) |
Constructor.
| port | A decimal port number, service name or UNIX domain socket path may be passed. |
| err_h | A function that will be called in the event of an error being raised. The function prototype is defined in lo_types.h |
| lowrappers::ServerThread::ServerThread | ( | const std::string & | group, |
| const std::string & | port, | ||
| lo_err_handler | err_h | ||
| ) |
Constructor.
Creates a ServerThread that joins a specified multicast group.
| group | The multicast group to join. |
| port | A decimal port number, service name or UNIX domain socket path may be passed. |
| err_h | A function that will be called in the event of an error being raised. The function prototype is defined in lo_types.h |
| lowrappers::ServerThread::ServerThread | ( | const std::string & | group, |
| const std::string & | port, | ||
| const std::string & | ifaceIp, | ||
| lo_err_handler | err_h | ||
| ) |
Constructor.
Creates a ServerThread that joins a specified multicast group, listening on a specified interface.
| group | The multicast group to join. |
| port | A decimal port number, service name or UNIX domain socket path may be passed. Note that differently from lo_server_tread_new, passing NULL is not allowed. |
| ifaceIp | A string specifying the network interface to use by its IP. |
| err_h | A function that will be called in the event of an error being raised. The function prototype is defined in lo_types.h |
|
virtual |
Destructor.
| bool lowrappers::ServerThread::addListener | ( | const char * | path, |
| const char * | typespec, | ||
| Listener * | listener | ||
| ) |
Adds a Listener to this server thread.
(Note that there is a functor class GenericServerThreadListener so any object's method that matches the signature of ServerThread::Listener::callback can be passed.)
| path | The OSC path to register the method to. If NULL is passed the method will match all paths. |
| typespec | The typespec the method accepts. Incoming messages with similar typespecs (e.g. ones with numerical types in the same position) will be coerced to the typespec given here. |
| listener | The Listener whose callback() method will be called if a matching message is received. |
| bool lowrappers::ServerThread::addMethod | ( | const char * | path, |
| const char * | typespec, | ||
| lo_method_handler | h, | ||
| void * | user_data | ||
| ) |
Adds a lo_method_handler to this server thread.
See the Liblo documentation for details about lo_method_handlers. For an object-oriented alternative, see addListener.
| path | The OSC path to register the method to. If NULL is passed the method will match all paths. |
| typespec | The typespec the method accepts. Incoming messages with similar typespecs (e.g. ones with numerical types in the same position) will be coerced to the typespec given here. |
| h | The lo_method_handler callback function that will be called if a matching message is received. |
| user_data | A value that will be passed to the callback function, h, when its invoked matching from this method. |
| void lowrappers::ServerThread::delMethod | ( | const char * | path, |
| const char * | typespec | ||
| ) |
Delete a method from this server thread.
This may aso be used to delete Listener callback methods.
| path | The OSC path of the method to delete. |
| typespec | The typespec the method accepts. |
| bool lowrappers::ServerThread::isValid | ( | ) | const |
Checks if initialization was successfull.
| int lowrappers::ServerThread::port | ( | ) | const |
The port number that the server thread has bound to.
| std::string lowrappers::ServerThread::url | ( | ) | const |
An URL describing the address of the server thread.
1.8.6