20 #ifndef LUNCHBOX_SERVUS_H
21 #define LUNCHBOX_SERVUS_H
24 #include <lunchbox/result.h>
26 #include <boost/shared_ptr.hpp>
31 namespace detail {
class Servus; }
64 LUNCHBOX_API std::string
getString()
const override;
83 LUNCHBOX_API
explicit Servus(
const std::string& name );
111 LUNCHBOX_API
void set(
const std::string& key,
const std::string& value );
117 LUNCHBOX_API
const std::string&
get(
const std::string& key )
const;
128 const std::string& instance );
147 const unsigned browseTime );
177 LUNCHBOX_API
Strings getKeys(
const std::string& instance )
const;
180 LUNCHBOX_API
bool containsKey(
const std::string& instance,
181 const std::string& key )
const;
184 LUNCHBOX_API
const std::string&
get(
const std::string& instance,
185 const std::string& key )
const;
188 typedef std::map< std::string, std::map< std::string, std::string > > Data;
191 LUNCHBOX_API
void getData( Data& data );
194 boost::shared_ptr< detail::Servus > _impl;
195 friend LUNCHBOX_API std::ostream&
operator << ( std::ostream&,
206 #endif // LUNCHBOX_SERVUS_H
bool containsKey(const std::string &instance, const std::string &key) const
Defines export visibility macros for Lunchbox.
Basic type definitions not provided by the operating system.
Result browse(int32_t timeout=-1)
Browse and process discovered key/value pairs.
Result beginBrowsing(const lunchbox::Servus::Interface addr)
Begin the discovery of announced key/value pairs.
std::vector< std::string > Strings
A vector of std::strings.
Strings discover(const Interface addr, const unsigned browseTime)
Discover all announced key/value pairs.
Servus(const std::string &name)
Create a new service handle.
static bool isAvailable()
A result returns an error code and behaves like a boolean.
Servus & operator=(const Servus &rhs)
Share the ZeroConf service with the rhs argument.
virtual ~Result()
Destruct the result.
static const int32_t POLL_ERROR
Error during polling for event.
std::string getString() const override
Strings getInstances() const
void endBrowsing()
Stop a discovery process and return all results.
void set(const std::string &key, const std::string &value)
Set a key/value pair to be announced.
Abstraction layer and common utilities for multi-threaded programming.
static const int32_t PENDING
operation did not complete.
std::ostream & operator<<(std::ostream &os, const Array< T > &array)
Pretty-print all members of the array.
static const int32_t NOT_SUPPORTED
Lunchbox compiled without ZeroConf support.
Result announce(const unsigned short port, const std::string &instance)
Start announcing the registered key/value pairs.
void withdraw()
Stop announcing the registered key/value pairs.
The ZeroConf operation result code.
virtual ~Servus()
Destruct this service.
Simple wrapper for ZeroConf key/value pairs.
friend std::ostream & operator<<(std::ostream &, const Servus &)
Output the servus instance in human-readable format.