summaryrefslogtreecommitdiff
path: root/portaudio/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx
blob: ffa195d2872b4d913d7911e8fe2b5b1833bccb91 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
#define INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX

// ---------------------------------------------------------------------------------------

#include <iterator>
#include <cstddef>

#include "portaudiocpp/System.hxx"

// ---------------------------------------------------------------------------------------

// Forward declaration(s):
namespace portaudio
{
	class Device;
	class HostApi;
}

// ---------------------------------------------------------------------------------------

// Declaration(s):
namespace portaudio
{

	
	//////
	/// @brief Iterator class for iterating through all Devices in a System.
	///
	/// Devices will be iterated by iterating all Devices in each 
	/// HostApi in the System. Compliant with the STL bidirectional 
	/// iterator concept.
	//////
	class System::DeviceIterator
	{
	public:
		typedef std::bidirectional_iterator_tag iterator_category;
		typedef Device value_type;
		typedef ptrdiff_t difference_type;
		typedef Device * pointer;
		typedef Device & reference;

		Device &operator*() const;
		Device *operator->() const;

		DeviceIterator &operator++();
		DeviceIterator operator++(int);
		DeviceIterator &operator--();
		DeviceIterator operator--(int);

		bool operator==(const DeviceIterator &rhs) const;
		bool operator!=(const DeviceIterator &rhs) const;

	private:
		friend class System;
		friend class HostApi;
		Device **ptr_;
	};


} // namespace portaudio

// ---------------------------------------------------------------------------------------

#endif // INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX