Use virtual functions for the decoder
[openal-soft.git] / al / eax_fx_slot_index.h
blobe1e5475a98f71aea967defc8733e084e858297d9
1 #ifndef EAX_FX_SLOT_INDEX_INCLUDED
2 #define EAX_FX_SLOT_INDEX_INCLUDED
5 #include <cstddef>
7 #include "aloptional.h"
8 #include "eax_api.h"
11 using EaxFxSlotIndexValue = std::size_t;
13 class EaxFxSlotIndex : public al::optional<EaxFxSlotIndexValue>
15 public:
16 using al::optional<EaxFxSlotIndexValue>::optional;
18 EaxFxSlotIndex& operator=(const EaxFxSlotIndexValue &value) { set(value); return *this; }
19 EaxFxSlotIndex& operator=(const GUID &guid) { set(guid); return *this; }
21 void set(EaxFxSlotIndexValue index);
22 void set(const GUID& guid);
24 private:
25 [[noreturn]]
26 static void fail(const char *message);
27 }; // EaxFxSlotIndex
29 inline bool operator==(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
31 if(lhs.has_value() != rhs.has_value())
32 return false;
33 if(lhs.has_value())
34 return *lhs == *rhs;
35 return true;
38 inline bool operator!=(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
39 { return !(lhs == rhs); }
41 #endif // !EAX_FX_SLOT_INDEX_INCLUDED