aboutsummaryrefslogtreecommitdiffstats
path: root/al/eax_fx_slot_index.h
blob: e1e5475a98f71aea967defc8733e084e858297d9 (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
#ifndef EAX_FX_SLOT_INDEX_INCLUDED
#define EAX_FX_SLOT_INDEX_INCLUDED


#include <cstddef>

#include "aloptional.h"
#include "eax_api.h"


using EaxFxSlotIndexValue = std::size_t;

class EaxFxSlotIndex : public al::optional<EaxFxSlotIndexValue>
{
public:
    using al::optional<EaxFxSlotIndexValue>::optional;

    EaxFxSlotIndex& operator=(const EaxFxSlotIndexValue &value) { set(value); return *this; }
    EaxFxSlotIndex& operator=(const GUID &guid) { set(guid); return *this; }

    void set(EaxFxSlotIndexValue index);
    void set(const GUID& guid);

private:
    [[noreturn]]
    static void fail(const char *message);
}; // EaxFxSlotIndex

inline bool operator==(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
{
    if(lhs.has_value() != rhs.has_value())
        return false;
    if(lhs.has_value())
        return *lhs == *rhs;
    return true;
}

inline bool operator!=(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
{ return !(lhs == rhs); }

#endif // !EAX_FX_SLOT_INDEX_INCLUDED