1 // Copyright (c) Benjamin Kietzman (github.com/bkietz)
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef DBUS_ENDPOINT_HPP
7 #define DBUS_ENDPOINT_HPP
8 
9 #include <dbus/dbus.h>
10 #include <dbus/element.hpp>
11 #include <dbus/message.hpp>
12 
13 namespace dbus {
14 
15 class endpoint {
16   string process_name_;
17   string path_;
18   string interface_;
19   string member_;
20 
21  public:
endpoint(const string & process_name,const string & path,const string & interface)22   endpoint(const string& process_name, const string& path,
23            const string& interface)
24       : process_name_(process_name), path_(path), interface_(interface) {}
25 
endpoint(const string & process_name,const string & path,const string & interface,const string & member)26   endpoint(const string& process_name, const string& path,
27            const string& interface, const string& member)
28       : process_name_(process_name),
29         path_(path),
30         interface_(interface),
31         member_(member) {}
32 
get_path() const33   const string& get_path() const { return path_; }
34 
get_interface() const35   const string& get_interface() const { return interface_; }
36 
get_process_name() const37   const string& get_process_name() const { return process_name_; }
38 
get_member() const39   const string& get_member() const { return member_; }
40 
operator ==(const endpoint & other) const41   const bool operator==(const endpoint& other) const {
42     return (process_name_ == other.process_name_ && path_ == other.path_ &&
43             interface_ == other.interface_ && member_ == other.member_);
44   }
45 };
46 
operator <<(std::ostream & os,const dbus::endpoint & e)47 inline std::ostream& operator<<(std::ostream& os, const dbus::endpoint& e) {
48   os << "path=\"" << e.get_path() << "\" interface=\"" << e.get_interface()
49      << "\" process_name=\"" << e.get_process_name() << "\"";
50   return os;
51 }
52 
53 }  // namespace dbus
54 
55 #endif  // DBUS_ENDPOINT_HPP
56