signalbase.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later OR BSD-3-Clause
2 /***************************************************************************
3  * Copyright (C) 2009,2010 by Rick L. Vinyard, Jr. *
4  * rvinyard@cs.nmsu.edu *
5  * *
6  * This file is part of the dbus-cxx library. *
7  ***************************************************************************/
8 #include <dbus-cxx/path.h>
10 #include <stddef.h>
11 #include <memory>
12 #include <string>
13 
14 #ifndef DBUSCXX_SIGNALBASE_H
15 #define DBUSCXX_SIGNALBASE_H
16 
17 namespace DBus {
18 class Connection;
19 class Message;
20 
35 class SignalBase {
36 protected:
37 
38  SignalBase( const std::string& path, const std::string& interface_name, const std::string& name );
39 
40  SignalBase( const std::string& interface_name, const std::string& name );
41 
42  SignalBase( std::weak_ptr<Connection> connection, const std::string& path, const std::string& interface_name, const std::string& name );
43 
44  SignalBase( std::weak_ptr<Connection> connection, const std::string& interface_name, const std::string& name );
45 
46 public:
47  virtual ~SignalBase();
48 
49  std::shared_ptr<Connection> connection();
50 
51  void set_connection( std::weak_ptr<Connection> connection );
52 
53  const std::string& sender() const;
54 
55  void set_sender( const std::string& s );
56 
57  const std::string& interface_name() const;
58 
59  void set_interface( const std::string& i );
60 
61  const std::string& name() const;
62 
63  void set_name( const std::string& n );
64 
65  const Path& path() const;
66 
67  void set_path( const std::string& s );
68 
69  const std::string& destination() const;
70 
71  void set_destination( const std::string& s );
72 
77  // virtual std::shared_ptr<signal_base> clone() = 0;
78 
80  virtual std::string introspect( int space_depth = 0 ) const { return std::string(); }
81 
82  virtual std::string arg_name( size_t i ) { return std::string(); }
83 
84  virtual void set_arg_name( size_t i, const std::string& name ) { }
85 
86 protected:
87  bool handle_dbus_outgoing( std::shared_ptr<const Message> );
88 
89 private:
90  class priv_data;
91 
92  DBUS_CXX_PROPAGATE_CONST( std::unique_ptr<priv_data> ) m_priv;
93 };
94 
95 }
96 
97 #endif
Represents a DBus Path.
Definition: path.h:21
Base class of all signals(proxy and adapter).
Definition: signalbase.h:35
void set_path(const std::string &s)
Definition: signalbase.cpp:95
const std::string & interface_name() const
Definition: signalbase.cpp:75
virtual void set_arg_name(size_t i, const std::string &name)
Definition: signalbase.h:84
const std::string & sender() const
Definition: signalbase.cpp:67
const std::string & name() const
Definition: signalbase.cpp:83
void set_interface(const std::string &i)
Definition: signalbase.cpp:79
void set_connection(std::weak_ptr< Connection > connection)
Definition: signalbase.cpp:63
virtual std::string arg_name(size_t i)
Definition: signalbase.h:82
virtual std::string introspect(int space_depth=0) const
This method is needed to be able to create a duplicate of a child capable of parsing their specific t...
Definition: signalbase.h:80
const Path & path() const
Definition: signalbase.cpp:91
void set_name(const std::string &n)
Definition: signalbase.cpp:87
const std::string & destination() const
Definition: signalbase.cpp:99
virtual ~SignalBase()
Definition: signalbase.cpp:56
bool handle_dbus_outgoing(std::shared_ptr< const Message >)
Definition: signalbase.cpp:107
std::shared_ptr< Connection > connection()
Definition: signalbase.cpp:59
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
void set_destination(const std::string &s)
Definition: signalbase.cpp:103
SignalBase(const std::string &path, const std::string &interface_name, const std::string &name)
Definition: signalbase.cpp:28
void set_sender(const std::string &s)
Definition: signalbase.cpp:71
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18