Music Hub  ..
A session-wide music playback service
client_death_observer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voß <thomas.voss@canonical.com>
17  */
18 
19 #ifndef CORE_UBUNTU_MEDIA_CLIENT_DEATH_OBSERVER_H_
20 #define CORE_UBUNTU_MEDIA_CLIENT_DEATH_OBSERVER_H_
21 
22 #include <core/media/player.h>
23 
24 #include <core/signal.h>
25 
26 #include <memory>
27 
28 namespace core
29 {
30 namespace ubuntu
31 {
32 namespace media
33 {
34 // Models functionality to be notified whenever a client
35 // of the service goes away, and thus allows us to clean
36 // up in that case.
38 {
39  // To save us some typing.
40  typedef std::shared_ptr<ClientDeathObserver> Ptr;
41 
42  ClientDeathObserver() = default;
44  virtual ~ClientDeathObserver() = default;
45 
47 
48  // Registers the client with the given key for death notifications.
50 
51  // Emitted whenever a client dies, reporting the key under which the
52  // respective client was known.
53  virtual const core::Signal<Player::PlayerKey>& on_client_with_key_died() const = 0;
54 };
55 
56 // Accesses the default client death observer implementation for the platform.
58 }
59 }
60 }
61 
62 #endif // CORE_UBUNTU_MEDIA_CLIENT_DEATH_OBSERVER_H_
Definition: player.h:32
ClientDeathObserver & operator=(const ClientDeathObserver &)=delete
std::shared_ptr< ClientDeathObserver > Ptr
virtual const core::Signal< Player::PlayerKey > & on_client_with_key_died() const =0
virtual void register_for_death_notifications_with_key(const Player::PlayerKey &)=0
ClientDeathObserver::Ptr platform_default_client_death_observer()