00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ASYNCTASKSEQUENCE_H
00016 #define ASYNCTASKSEQUENCE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "asyncTask.h"
00021 #include "asyncTaskCollection.h"
00022
00023 class AsyncTaskManager;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class EXPCL_PANDA_EVENT AsyncTaskSequence : public AsyncTask, public AsyncTaskCollection {
00038 PUBLISHED:
00039 AsyncTaskSequence(const string &name);
00040 virtual ~AsyncTaskSequence();
00041 ALLOC_DELETED_CHAIN(AsyncTaskSequence);
00042
00043 INLINE void set_repeat_count(int repeat_count);
00044 INLINE int get_repeat_count() const;
00045
00046 INLINE int get_current_task_index() const;
00047
00048 protected:
00049 virtual bool is_runnable();
00050 virtual DoneStatus do_task();
00051 virtual void upon_birth(AsyncTaskManager *manager);
00052 virtual void upon_death(AsyncTaskManager *manager, bool clean_exit);
00053
00054 private:
00055 void set_current_task(AsyncTask *task, bool clean_exit);
00056
00057 int _repeat_count;
00058 int _task_index;
00059 PT(AsyncTask) _current_task;
00060
00061 public:
00062 static TypeHandle get_class_type() {
00063 return _type_handle;
00064 }
00065 static void init_type() {
00066 AsyncTask::init_type();
00067 register_type(_type_handle, "AsyncTaskSequence",
00068 AsyncTask::get_class_type());
00069 }
00070 virtual TypeHandle get_type() const {
00071 return get_class_type();
00072 }
00073 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00074
00075 private:
00076 static TypeHandle _type_handle;
00077 };
00078
00079 #include "asyncTaskSequence.I"
00080
00081 #endif
00082