genericAsyncTask.I 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file genericAsyncTask.I
  10. * @author drose
  11. * @date 2008-10-03
  12. */
  13. /**
  14. * Replaces the function that is called when the task runs.
  15. */
  16. INLINE void GenericAsyncTask::
  17. set_function(GenericAsyncTask::TaskFunc *function) {
  18. _function = function;
  19. }
  20. /**
  21. * Returns the function that is called when the task runs.
  22. */
  23. INLINE GenericAsyncTask::TaskFunc *GenericAsyncTask::
  24. get_function() const {
  25. return _function;
  26. }
  27. /**
  28. * Replaces the function that is called when the task begins. This is an
  29. * optional function.
  30. */
  31. INLINE void GenericAsyncTask::
  32. set_upon_birth(GenericAsyncTask::BirthFunc *upon_birth) {
  33. _upon_birth = upon_birth;
  34. }
  35. /**
  36. * Returns the function that is called when the task begins, or NULL if the
  37. * function is not defined.
  38. */
  39. INLINE GenericAsyncTask::BirthFunc *GenericAsyncTask::
  40. get_upon_birth() const {
  41. return _upon_birth;
  42. }
  43. /**
  44. * Replaces the function that is called when the task ends. This is an
  45. * optional function.
  46. */
  47. INLINE void GenericAsyncTask::
  48. set_upon_death(GenericAsyncTask::DeathFunc *upon_death) {
  49. _upon_death = upon_death;
  50. }
  51. /**
  52. * Returns the function that is called when the task ends, or NULL if the
  53. * function is not defined.
  54. */
  55. INLINE GenericAsyncTask::DeathFunc *GenericAsyncTask::
  56. get_upon_death() const {
  57. return _upon_death;
  58. }
  59. /**
  60. * Replaces the void pointer that is passed to the task function. This is any
  61. * arbitrary pointer; the task object does no processing on it.
  62. */
  63. INLINE void GenericAsyncTask::
  64. set_user_data(void *user_data) {
  65. _user_data = user_data;
  66. }
  67. /**
  68. * Returns the void pointer that is passed to the task function.
  69. */
  70. INLINE void *GenericAsyncTask::
  71. get_user_data() const {
  72. return _user_data;
  73. }