18 #include "pandabase.h" 20 #include "asyncTask.h" 32 PythonTask(PyObject *
function = Py_None,
const string &name =
string());
33 virtual ~PythonTask();
34 ALLOC_DELETED_CHAIN(PythonTask);
36 void set_function(PyObject *
function);
37 PyObject *get_function();
39 void set_args(PyObject *args,
bool append_task);
42 void set_upon_death(PyObject *upon_death);
43 PyObject *get_upon_death();
45 void set_owner(PyObject *owner);
46 PyObject *get_owner();
48 int __setattr__(PyObject *
self, PyObject *attr, PyObject *v);
49 int __delattr__(PyObject *
self, PyObject *attr);
50 PyObject *__getattr__(PyObject *attr)
const;
52 int __traverse__(visitproc visit,
void *arg);
60 MAKE_PROPERTY(name, get_name, set_name);
64 MAKE_PROPERTY(time, get_elapsed_time);
73 MAKE_PROPERTY(wake_time, get_wake_time);
76 MAKE_PROPERTY(delay_time, get_delay, set_delay);
80 MAKE_PROPERTY(frame, get_elapsed_frames);
84 MAKE_PROPERTY(
id, get_task_id);
91 virtual bool is_runnable();
92 virtual DoneStatus do_task();
93 DoneStatus do_python_task();
98 void register_to_owner();
99 void unregister_from_owner();
100 void call_owner_method(
const char *method_name);
101 void call_function(PyObject *
function);
107 PyObject *_upon_death;
109 bool _registered_to_owner;
111 PyObject *_generator;
117 static void init_type() {
118 AsyncTask::init_type();
119 register_type(_type_handle,
"PythonTask",
120 AsyncTask::get_class_type());
123 return get_class_type();
125 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
131 #include "pythonTask.I" 133 #endif // HAVE_PYTHON A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
This class represents a concrete task performed by an AsyncManager.
void set_delay(double delay)
Specifies the amount of time, in seconds, by which this task will be delayed after it has been added ...
TypeHandle is the identifier used to differentiate C++ class types.
double get_delay() const
Returns the delay value that has been set via set_delay, if any.