Panda3D
modelSaveRequest.h
1 // Filename: modelSaveRequest.h
2 // Created by: drose (19Dec12)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MODELSAVEREQUEST
16 #define MODELSAVEREQUEST
17 
18 #include "pandabase.h"
19 
20 #include "asyncTask.h"
21 #include "filename.h"
22 #include "loaderOptions.h"
23 #include "pandaNode.h"
24 #include "pointerTo.h"
25 #include "loader.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : ModelSaveRequest
29 // Description : A class object that manages a single asynchronous
30 // model save request. Create a new ModelSaveRequest,
31 // and add it to the loader via save_async(), to begin
32 // an asynchronous save.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_PGRAPH ModelSaveRequest : public AsyncTask {
35 public:
36  ALLOC_DELETED_CHAIN(ModelSaveRequest);
37 
38 PUBLISHED:
39  ModelSaveRequest(const string &name,
40  const Filename &filename,
41  const LoaderOptions &options,
42  PandaNode *node, Loader *loader);
43 
44  INLINE const Filename &get_filename() const;
45  INLINE const LoaderOptions &get_options() const;
46  INLINE PandaNode *get_node() const;
47  INLINE Loader *get_loader() const;
48 
49  INLINE bool is_ready() const;
50  INLINE bool get_success() const;
51 
52 protected:
53  virtual DoneStatus do_task();
54 
55 private:
56  Filename _filename;
57  LoaderOptions _options;
58  PT(PandaNode) _node;
59  PT(Loader) _loader;
60  bool _is_ready;
61  bool _success;
62 
63 public:
64  static TypeHandle get_class_type() {
65  return _type_handle;
66  }
67  static void init_type() {
68  AsyncTask::init_type();
69  register_type(_type_handle, "ModelSaveRequest",
70  AsyncTask::get_class_type());
71  }
72  virtual TypeHandle get_type() const {
73  return get_class_type();
74  }
75  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
76 
77 private:
78  static TypeHandle _type_handle;
79 };
80 
81 #include "modelSaveRequest.I"
82 
83 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
A class object that manages a single asynchronous model save request.
Specifies parameters that may be passed to the loader.
Definition: loaderOptions.h:26
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
Definition: loader.h:47
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
This class represents a concrete task performed by an AsyncManager.
Definition: asyncTask.h:43
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85