modelSaveRequest.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 modelSaveRequest.h
  10. * @author drose
  11. * @date 2012-12-19
  12. */
  13. #ifndef MODELSAVEREQUEST_H
  14. #define MODELSAVEREQUEST_H
  15. #include "pandabase.h"
  16. #include "asyncTask.h"
  17. #include "filename.h"
  18. #include "loaderOptions.h"
  19. #include "pandaNode.h"
  20. #include "pointerTo.h"
  21. #include "loader.h"
  22. /**
  23. * A class object that manages a single asynchronous model save request.
  24. * Create a new ModelSaveRequest, and add it to the loader via save_async(),
  25. * to begin an asynchronous save.
  26. */
  27. class EXPCL_PANDA_PGRAPH ModelSaveRequest : public AsyncTask {
  28. public:
  29. ALLOC_DELETED_CHAIN(ModelSaveRequest);
  30. PUBLISHED:
  31. explicit ModelSaveRequest(const std::string &name,
  32. const Filename &filename,
  33. const LoaderOptions &options,
  34. PandaNode *node, Loader *loader);
  35. INLINE const Filename &get_filename() const;
  36. INLINE const LoaderOptions &get_options() const;
  37. INLINE PandaNode *get_node() const;
  38. INLINE Loader *get_loader() const;
  39. INLINE bool is_ready() const;
  40. INLINE bool get_success() const;
  41. MAKE_PROPERTY(filename, get_filename);
  42. MAKE_PROPERTY(options, get_options);
  43. MAKE_PROPERTY(node, get_node);
  44. MAKE_PROPERTY(loader, get_loader);
  45. protected:
  46. virtual DoneStatus do_task();
  47. private:
  48. Filename _filename;
  49. LoaderOptions _options;
  50. PT(PandaNode) _node;
  51. PT(Loader) _loader;
  52. bool _success;
  53. public:
  54. static TypeHandle get_class_type() {
  55. return _type_handle;
  56. }
  57. static void init_type() {
  58. AsyncTask::init_type();
  59. register_type(_type_handle, "ModelSaveRequest",
  60. AsyncTask::get_class_type());
  61. }
  62. virtual TypeHandle get_type() const {
  63. return get_class_type();
  64. }
  65. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  66. private:
  67. static TypeHandle _type_handle;
  68. };
  69. #include "modelSaveRequest.I"
  70. #endif