summaryrefslogtreecommitdiffstats
path: root/Src/devices/discoveryMonitor.h
blob: 7b838c151a9199c17124f49d0e19ea44f547fe16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _NULLSOFT_WINAMP_DEVICES_DISCOVERY_MONITOR_HEADER
#define _NULLSOFT_WINAMP_DEVICES_DISCOVERY_MONITOR_HEADER

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include "ifc_deviceprovider.h"
#include <vector>

class DiscoveryMonitor
{
public:
	DiscoveryMonitor();
	~DiscoveryMonitor();

public:
	BOOL Register(ifc_deviceprovider *provider);
	BOOL Unregister(ifc_deviceprovider *provider);
	BOOL IsActive();
	BOOL Reset();

protected:
	void Lock();
	void Unlock();

private:
	typedef struct ActiveDiscovery
	{
		intptr_t providerId;
		size_t ref;
	} ActiveDiscovery;

	typedef std::vector<ActiveDiscovery> ActivityList;

private:
	CRITICAL_SECTION lock;
	ActivityList activityList;
};



#endif // _NULLSOFT_WINAMP_DEVICES_DISCOVERY_MONITOR_HEADER