inital PyCallable work; isolate very well behaved usage of PyObject references behind RAII
This commit is contained in:
parent
8739da8463
commit
972768eb26
5 changed files with 89 additions and 10 deletions
26
src/PyCallable.h
Normal file
26
src/PyCallable.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
#include "Common.h"
|
||||
#include "Python.h"
|
||||
|
||||
class PyCallable
|
||||
{
|
||||
private:
|
||||
PyObject* target;
|
||||
protected:
|
||||
PyCallable(PyObject*);
|
||||
~PyCallable();
|
||||
PyObject* call(PyObject*, PyObject*);
|
||||
};
|
||||
|
||||
class PyTimerCallable: public PyCallable
|
||||
{
|
||||
private:
|
||||
int interval;
|
||||
int last_ran;
|
||||
void call(int);
|
||||
public:
|
||||
bool hasElapsed(int);
|
||||
bool test(int);
|
||||
PyTimerCallable(PyObject*, int, int);
|
||||
PyTimerCallable();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue