/src/WasmEdge/include/runtime/instance/exception.h
Line | Count | Source |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: Copyright The WasmEdge Authors |
3 | | |
4 | | //===-- wasmedge/runtime/instance/exception.h - Exception Instance --------===// |
5 | | // |
6 | | // Part of the WasmEdge Project. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | /// |
10 | | /// \file |
11 | | /// This file contains the exception instance definition in store manager. |
12 | | /// |
13 | | //===----------------------------------------------------------------------===// |
14 | | #pragma once |
15 | | |
16 | | #include "common/errcode.h" |
17 | | #include "common/types.h" |
18 | | #include "runtime/instance/tag.h" |
19 | | |
20 | | #include <vector> |
21 | | |
22 | | namespace WasmEdge { |
23 | | namespace Runtime { |
24 | | namespace Instance { |
25 | | |
26 | | class ExceptionInstance { |
27 | | public: |
28 | | ExceptionInstance() = delete; |
29 | | ExceptionInstance(TagInstance *Tag, |
30 | | std::vector<ValVariant> &&Payload) noexcept |
31 | 0 | : TgInst(Tag), Data(std::move(Payload)) { |
32 | 0 | assuming(TgInst); |
33 | 0 | } |
34 | | |
35 | | /// Getter for the referenced tag instance. |
36 | 0 | TagInstance *getTag() const noexcept { return TgInst; } |
37 | | |
38 | | /// Getter for the captured argument values. |
39 | 0 | const std::vector<ValVariant> &getPayload() const noexcept { return Data; } |
40 | | |
41 | | private: |
42 | | /// \name Data of exception instance. |
43 | | /// @{ |
44 | | TagInstance *TgInst; |
45 | | std::vector<ValVariant> Data; |
46 | | /// @} |
47 | | }; |
48 | | |
49 | | } // namespace Instance |
50 | | } // namespace Runtime |
51 | | } // namespace WasmEdge |