inital PyCallable work; isolate very well behaved usage of PyObject references behind RAII

This commit is contained in:
John McCardle 2024-03-12 21:02:48 -04:00
commit 972768eb26
5 changed files with 89 additions and 10 deletions

26
src/PyCallable.h Normal file
View 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();
};