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; }
 
   43 class Servus : 
public boost::noncopyable
 
   64         LUNCHBOX_API std::string 
getString() 
const override;
 
   83     LUNCHBOX_API 
explicit Servus( 
const std::string& name );
 
  100     LUNCHBOX_API 
void set( 
const std::string& key, 
const std::string& value );
 
  106     LUNCHBOX_API 
const std::string& 
get( 
const std::string& key ) 
const;
 
  117                                   const std::string& instance );
 
  136                                    const unsigned browseTime );
 
  166     LUNCHBOX_API 
Strings getKeys( 
const std::string& instance ) 
const;
 
  169     LUNCHBOX_API 
bool containsKey( 
const std::string& instance,
 
  170                                    const std::string& key ) 
const;
 
  173     LUNCHBOX_API 
const std::string& 
get( 
const std::string& instance,
 
  174                                          const std::string& key ) 
const;
 
  177     typedef std::map< std::string, std::map< std::string, std::string > > Data;
 
  180     LUNCHBOX_API 
void getData( Data& data );
 
  183     detail::Servus* 
const _impl;
 
  184     friend LUNCHBOX_API std::ostream& 
operator << ( std::ostream&,
 
  195 #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. 
 
LUNCHBOX_API void endBrowsing()
Stop a discovery process and return all results. 
 
std::vector< std::string > Strings
A vector of std::strings. 
 
LUNCHBOX_API Strings getKeys() const 
 
friend LUNCHBOX_API std::ostream & operator<<(std::ostream &, const Servus &)
Output the servus instance in human-readable format. 
 
LUNCHBOX_API bool isAnnounced() const 
 
LUNCHBOX_API bool isBrowsing() const 
 
LUNCHBOX_API Result browse(int32_t timeout=-1)
Browse and process discovered key/value pairs. 
 
A result returns an error code and behaves like a boolean. 
 
virtual ~Result()
Destruct the result. 
 
static const int32_t POLL_ERROR
Error during polling for event. 
 
static LUNCHBOX_API bool isAvailable()
 
LUNCHBOX_API Result beginBrowsing(const lunchbox::Servus::Interface addr)
Begin the discovery of announced key/value pairs. 
 
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.