sdbus-c++ 2.4.0
High-level C++ D-Bus library based on systemd D-Bus implementation
Loading...
Searching...
No Matches
Track.h
Go to the documentation of this file.
1
26
27#ifndef SDBUS_CXX_TRACK_H_
28#define SDBUS_CXX_TRACK_H_
29
30#include <cstddef>
31#include <vector>
32
33// Forward declarations
34namespace sdbus {
35 class BusName;
36 class Message;
37 struct adopt_track_t;
38 namespace internal {
39 class ISdBus;
40 class Connection;
41 } // namespace internal
42} // namespace sdbus
43
44namespace sdbus {
45
46 /********************************************/
66 class [[nodiscard]] Track
67 {
68 public:
69 Track(const Track&) noexcept;
70 Track& operator=(const Track&) noexcept;
71 Track(Track&& other) noexcept;
72 Track& operator=(Track&& other) noexcept;
73 ~Track();
74
87 void addName(const BusName& name);
88
101 void addSender(const Message& message);
102
116 void removeName(const BusName& name);
117
127 void removeSender(const Message& message);
128
137 [[nodiscard]] bool contains(const BusName& name) const;
138
146 [[nodiscard]] std::size_t count() const;
147
155 [[nodiscard]] std::vector<BusName> getNames() const;
156
171 void setRecursive(bool recursive);
172
180 [[nodiscard]] bool isRecursive() const;
181
182 private:
183 friend internal::Connection;
184
185 Track(void *track, internal::ISdBus* sdbus) noexcept;
186 Track(void *track, internal::ISdBus* sdbus, adopt_track_t) noexcept;
187
188 void* track_{};
189 internal::ISdBus* sdbus_{};
190 };
191
192} // namespace sdbus
193
194#endif /* SDBUS_CXX_TRACK_H_ */
Definition Types.h:228
Definition Message.h:82
void addSender(const Message &message)
Adds the sender of a D-Bus message to the track.
void removeName(const BusName &name)
Removes a bus name from the track.
std::size_t count() const
Returns the number of tracked bus names.
void setRecursive(bool recursive)
Enables or disables recursive mode of the track.
std::vector< BusName > getNames() const
Returns all tracked bus names.
bool isRecursive() const
Checks whether the track is in recursive mode.
void removeSender(const Message &message)
Removes the sender of a D-Bus message from the track.
void addName(const BusName &name)
Adds a bus name to the track.
bool contains(const BusName &name) const
Checks whether a bus name is tracked.
Definition TypeTraits.h:102