diff --git a/src/sink.h b/src/sink.h --- a/src/sink.h +++ b/src/sink.h @@ -34,6 +34,8 @@ public: /// Disconnects a follower. Disconnecting an unconnected sink is /// an error. void disconnectFollower(Sink* sink); + /// Returns the connected source. `NULL` if it's not connected. + const Source* connectedSource() const; protected: /// Entry point for incoming data. Re-implementations should @@ -46,11 +48,18 @@ protected: virtual bool hasX() const = 0; /// Returns number of channels virtual unsigned numChannels() const = 0; + /// Set by the connected source when its connected. When + /// disconnecting it's set to `NULL`. + /// + /// @important Trying to connect a source while its already + /// connected is an error. + void setSource(const Source* s); friend Source; private: QList followers; + const Source* source = NULL; ///< source that this sink is connected to }; #endif // SINK_H