summaryrefslogtreecommitdiffstats
path: root/ahl-binding/interrupt.hpp
blob: b540d22a0c7498e98eb51a217d289204c8dd704a (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
#pragma once
#include <vector>
#include <string>
#include <tuple>
#include "afb-binding-common.h"
#include "jsonc_utils.hpp"

// Forward declaration
class role_t;

class interrupt_t
{
private:
    std::string type_;
    json_object* args_;
    std::vector<std::tuple<std::string, uint32_t>> applied_on_;

public:
    explicit interrupt_t() = default;
    explicit interrupt_t(const interrupt_t&) = default;
    explicit interrupt_t(interrupt_t&&) = default;
    ~interrupt_t() = default;

    interrupt_t& operator=(const interrupt_t&) = default;
    interrupt_t& operator=(interrupt_t&&) = default;

    explicit interrupt_t(json_object* o);
    interrupt_t& operator<<(json_object* o);

    std::string type() const;
    json_object* args() const;

    void type(std::string v);
    void args(json_object* v);
    int apply(afb_request* req, const role_t& role);
    void clear();
};