14#ifndef GENERICASYNCTASK_H
15#define GENERICASYNCTASK_H
26class EXPCL_PANDA_EVENT GenericAsyncTask :
public AsyncTask {
28 typedef DoneStatus TaskFunc(GenericAsyncTask *task,
void *user_data);
29 typedef void BirthFunc(GenericAsyncTask *task,
void *user_data);
30 typedef void DeathFunc(GenericAsyncTask *task,
bool clean_exit,
void *user_data);
32 GenericAsyncTask(
const std::string &name = std::string());
33 GenericAsyncTask(
const std::string &name, TaskFunc *function,
void *user_data);
34 ALLOC_DELETED_CHAIN(GenericAsyncTask);
49 virtual bool is_runnable();
50 virtual DoneStatus do_task();
51 virtual void upon_birth(AsyncTaskManager *manager);
52 virtual void upon_death(AsyncTaskManager *manager,
bool clean_exit);
56 BirthFunc *_upon_birth;
57 DeathFunc *_upon_death;
64 static void init_type() {
65 AsyncTask::init_type();
67 AsyncTask::get_class_type());
70 return get_class_type();
72 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TaskFunc * get_function() const
Returns the function that is called when the task runs.
void * get_user_data() const
Returns the void pointer that is passed to the task function.
DeathFunc * get_upon_death() const
Returns the function that is called when the task ends, or NULL if the function is not defined.
void set_upon_birth(BirthFunc *function)
Replaces the function that is called when the task begins.
void set_user_data(void *user_data)
Replaces the void pointer that is passed to the task function.
BirthFunc * get_upon_birth() const
Returns the function that is called when the task begins, or NULL if the function is not defined.
void set_upon_death(DeathFunc *function)
Replaces the function that is called when the task ends.
void set_function(TaskFunc *function)
Replaces the function that is called when the task runs.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...