-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathGeneratorInterface.hpp
More file actions
47 lines (36 loc) · 1.17 KB
/
Copy pathGeneratorInterface.hpp
File metadata and controls
47 lines (36 loc) · 1.17 KB
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
#pragma once
#include "PyFrame.hpp"
#include "PyObject.hpp"
namespace py {
template<typename GeneratorType> class GeneratorInterface : public PyBaseObject
{
PyFrame *m_frame{ nullptr };
std::unique_ptr<StackFrame> m_stack_frame;
bool m_is_running{ false };
PyObject *m_code{ nullptr };
PyString *m_name{ nullptr };
PyString *m_qualname{ nullptr };
PyObject *m_last_sent_value{ nullptr };
std::unique_ptr<std::vector<PyFrame::ExceptionStackItem>> m_exception_stack;
bool m_invalid_return{ false };
protected:
GeneratorInterface(PyType *type);
GeneratorInterface(TypePrototype &type,
PyFrame *frame,
std::unique_ptr<StackFrame> &&,
bool is_running,
PyObject *code,
PyString *name,
PyString *qualname);
public:
void set_invalid_return(bool invalid_return) { m_invalid_return = invalid_return; }
std::string to_string() const override;
PyResult<PyObject *> __repr__() const;
PyResult<PyObject *> __iter__() const;
PyResult<PyObject *> __next__();
PyResult<PyObject *> send(PyObject *value);
PyResult<PyObject *> close();
void visit_graph(Visitor &visitor) override;
PyObject *last_sent_value() const { return m_last_sent_value; }
};
}// namespace py