ZeroEQ  0.6.0
ZeroEQ - Zero Event Queue
uri.h
1 
2 /* Copyright (c) 2015, Human Brain Project
3  * Daniel.Nachbaur@epfl.ch
4  */
5 
6 #ifndef ZEROEQ_URI_H
7 #define ZEROEQ_URI_H
8 
9 #include <zeroeq/api.h>
10 
11 #include <servus/uri.h> // base class
12 
13 namespace zeroeq
14 {
15 
20 class URI : private servus::URI
21 {
22 public:
24  ZEROEQ_API URI();
25 
26  ZEROEQ_API ~URI();
27 
28  ZEROEQ_API URI( const URI& from );
29 
31  ZEROEQ_API explicit URI( const std::string& uri );
32 
34  ZEROEQ_API explicit URI( const char* uri );
35 
37  ZEROEQ_API explicit URI( const servus::URI& from );
38 
39  ZEROEQ_API URI& operator = ( const URI& rhs );
40 
41  /* Convert from servus::URI, set schema to "tcp" if empty */
42  ZEROEQ_API URI& operator = ( const servus::URI& rhs );
43 
44  ZEROEQ_API bool operator == ( const URI& rhs ) const;
45 
46  ZEROEQ_API bool operator == ( const servus::URI& rhs ) const;
47 
48  ZEROEQ_API bool operator != ( const URI& rhs ) const;
49 
50  ZEROEQ_API bool operator != ( const servus::URI& rhs ) const;
51 
53  const servus::URI& toServusURI() const { return *this; }
54 
57  using servus::URI::getScheme;
58  using servus::URI::getHost;
59  using servus::URI::getPort;
60  using servus::URI::getPath;
61  using servus::URI::setHost;
62  using servus::URI::setPort;
64 };
65 
66 inline std::ostream& operator << ( std::ostream& os, const URI& uri )
67 {
68  return os << uri.toServusURI();
69 }
70 
71 } // namespace zeroeq
72 
73 namespace std
74 {
75 inline std::string to_string( const zeroeq::URI& uri )
76 {
77  return to_string( uri.toServusURI( ));
78 }
79 }
80 
81 #endif
Enhances servus::URI to guarantee the existance of a schema and to allow construction of [host][:port...
Definition: uri.h:20
Defines export visibility macros for library ZeroEQ.
STL namespace.
const servus::URI & toServusURI() const
Convert this URI to a servus::URI.
Definition: uri.h:53
URI()
Create a default URI in the form "tcp://".
Publish-subscribe classes for typed events.
Definition: broker.h:12