20 #ifndef LUNCHBOX_SERVUS_H
21 #define LUNCHBOX_SERVUS_H
24 #include <lunchbox/result.h>
26 #include <boost/noncopyable.hpp>
31 namespace detail {
class Servus; }
44 class Servus :
public boost::noncopyable
65 LUNCHBOX_API std::string
getString()
const override;
79 LUNCHBOX_API
explicit Servus(
const std::string& name );
96 LUNCHBOX_API
void set(
const std::string& key,
const std::string& value );
102 LUNCHBOX_API
const std::string&
get(
const std::string& key )
const;
113 const std::string& instance );
131 const unsigned browseTime );
137 LUNCHBOX_API
Strings getKeys(
const std::string& instance )
const;
140 LUNCHBOX_API
bool containsKey(
const std::string& instance,
141 const std::string& key )
const;
144 LUNCHBOX_API
const std::string&
get(
const std::string& instance,
145 const std::string& key )
const;
148 typedef std::map< std::string, std::map< std::string, std::string > > Data;
151 LUNCHBOX_API
void getData( Data& data );
154 detail::Servus*
const impl_;
161 #endif // LUNCHBOX_SERVUS_H
LUNCHBOX_API Result announce(const unsigned short port, const std::string &instance)
Start announcing the registered key/value pairs.
Defines export visibility macros for Lunchbox.
Basic type definitions not provided by the operating system.
virtual LUNCHBOX_API ~Servus()
Destruct this service.
LUNCHBOX_API void withdraw()
Stop announcing the registered key/value pairs.
LUNCHBOX_API Strings discover(const Interface addr, const unsigned browseTime)
Discover all announced key/value pairs.
std::vector< std::string > Strings
A vector of std::strings.
LUNCHBOX_API Strings getKeys() const
LUNCHBOX_API bool isAnnounced() const
A result returns an error code and behaves like a boolean.
virtual ~Result()
Destruct the result.
LUNCHBOX_API Servus(const std::string &name)
Create a new service handle.
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.
The ZeroConf operation result code.
LUNCHBOX_API std::string getString() const override
LUNCHBOX_API bool containsKey(const std::string &instance, const std::string &key) const
LUNCHBOX_API Strings getInstances() const
Simple wrapper for ZeroConf key/value pairs.
LUNCHBOX_API void set(const std::string &key, const std::string &value)
Set a key/value pair to be announced.