Panda3D
modelSaveRequest.h
Go to the documentation of this file.
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 
14 #ifndef MODELSAVEREQUEST_H
15 #define MODELSAVEREQUEST_H
16 
17 #include "pandabase.h"
18 
19 #include "asyncTask.h"
20 #include "filename.h"
21 #include "loaderOptions.h"
22 #include "pandaNode.h"
23 #include "pointerTo.h"
24 #include "loader.h"
25 
26 /**
27  * A class object that manages a single asynchronous model save request.
28  * Create a new ModelSaveRequest, and add it to the loader via save_async(),
29  * to begin an asynchronous save.
30  */
31 class EXPCL_PANDA_PGRAPH ModelSaveRequest : public AsyncTask {
32 public:
33  ALLOC_DELETED_CHAIN(ModelSaveRequest);
34 
35 PUBLISHED:
36  explicit ModelSaveRequest(const std::string &name,
37  const Filename &filename,
38  const LoaderOptions &options,
39  PandaNode *node, Loader *loader);
40 
41  INLINE const Filename &get_filename() const;
42  INLINE const LoaderOptions &get_options() const;
43  INLINE PandaNode *get_node() const;
44  INLINE Loader *get_loader() const;
45 
46  INLINE bool is_ready() const;
47  INLINE bool get_success() const;
48 
49  MAKE_PROPERTY(filename, get_filename);
50  MAKE_PROPERTY(options, get_options);
51  MAKE_PROPERTY(node, get_node);
52  MAKE_PROPERTY(loader, get_loader);
53 
54 protected:
55  virtual DoneStatus do_task();
56 
57 private:
58  Filename _filename;
59  LoaderOptions _options;
60  PT(PandaNode) _node;
61  PT(Loader) _loader;
62  bool _success;
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  AsyncTask::init_type();
70  register_type(_type_handle, "ModelSaveRequest",
71  AsyncTask::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
82 #include "modelSaveRequest.I"
83 
84 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
A class object that manages a single asynchronous model save request.
Specifies parameters that may be passed to the loader.
Definition: loaderOptions.h:23
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
Definition: loader.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class represents a concrete task performed by an AsyncManager.
Definition: asyncTask.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81