Panda3D
loaderFileType.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 loaderFileType.h
10  * @author drose
11  * @date 2000-06-20
12  */
13 
14 #ifndef LOADERFILETYPE_H
15 #define LOADERFILETYPE_H
16 
17 #include "pandabase.h"
18 
19 #include "typedObject.h"
20 #include "filename.h"
21 #include "pandaNode.h"
22 #include "pointerTo.h"
23 #include "dSearchPath.h"
24 
25 class LoaderOptions;
26 class BamCacheRecord;
27 
28 /**
29  * This is the base class for a family of scene-graph file types that the
30  * Loader supports. Each kind of loader that's available should define a
31  * corresponding LoaderFileType object and register itself.
32  */
33 class EXPCL_PANDA_PGRAPH LoaderFileType : public TypedObject {
34 protected:
36 
37 public:
38  virtual ~LoaderFileType();
39 
40 PUBLISHED:
41  virtual std::string get_name() const=0;
42  virtual std::string get_extension() const=0;
43  virtual std::string get_additional_extensions() const;
44  virtual bool supports_compressed() const;
45 
46  virtual bool get_allow_disk_cache(const LoaderOptions &options) const;
47  virtual bool get_allow_ram_cache(const LoaderOptions &options) const;
48 
49  virtual bool supports_load() const;
50  virtual bool supports_save() const;
51 
52 public:
53  virtual PT(PandaNode) load_file(const Filename &path, const LoaderOptions &options,
54  BamCacheRecord *record) const;
55  virtual bool save_file(const Filename &path, const LoaderOptions &options,
56  PandaNode *node) const;
57 
58 protected:
59  int _no_cache_flags;
60 
61 public:
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
67  register_type(_type_handle, "LoaderFileType",
68  TypedObject::get_class_type());
69  }
70  virtual TypeHandle get_type() const {
71  return get_class_type();
72  }
73  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
74 
75 private:
76  static TypeHandle _type_handle;
77 };
78 
79 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:44
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.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:88
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
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for a family of scene-graph file types that the Loader supports.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81