ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
player_registry.h
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// License. See the LICENSE file in the project root for full license details.
7//
12
13#ifndef STREAMS_PLAYER_REGISTRY_H
14#define STREAMS_PLAYER_REGISTRY_H
15
16#include <QMutex>
17#include <QMutexLocker>
18#include <QSet>
19#include <functional>
20
21class SapPlayer;
22
29class PlayerRegistry
30{
31public:
33 static PlayerRegistry &instance();
34
36 void registerPlayer(SapPlayer *player);
37
39 void deregisterPlayer(SapPlayer *player);
40
43 void forEachPlayer(const std::function<void(SapPlayer *)> &callback);
44
46 int count();
47
48private:
49 PlayerRegistry() = default;
50 ~PlayerRegistry() = default;
51 PlayerRegistry(const PlayerRegistry &) = delete;
52 PlayerRegistry &operator=(const PlayerRegistry &) = delete;
53
54 QMutex m_mutex;
55 QSet<SapPlayer *> m_players;
56};
57
58#endif // STREAMS_PLAYER_REGISTRY_H
void registerPlayer(SapPlayer *player)
Register a player (called from SapPlayer::play).
Definition player_registry.cpp:21
static PlayerRegistry & instance()
Get the singleton instance.
Definition player_registry.cpp:15
void forEachPlayer(const std::function< void(SapPlayer *)> &callback)
Thread-safe iteration over all registered players.
Definition player_registry.cpp:33
int count()
Return the current number of registered players.
Definition player_registry.cpp:41
void deregisterPlayer(SapPlayer *player)
Deregister a player (called from SapPlayer destructor).
Definition player_registry.cpp:27
Definition sap_player.h:46