Panda3D
|
00001 // Filename: loaderFileTypeRegistry.h 00002 // Created by: drose (20Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef LOADERFILETYPEREGISTRY_H 00016 #define LOADERFILETYPEREGISTRY_H 00017 00018 #include "pandabase.h" 00019 00020 #include "pvector.h" 00021 #include "pmap.h" 00022 00023 class LoaderFileType; 00024 class Filename; 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : LoaderFileTypeRegistry 00028 // Description : This class maintains the set of all known 00029 // LoaderFileTypes in the universe. 00030 //////////////////////////////////////////////////////////////////// 00031 class EXPCL_PANDA_PGRAPH LoaderFileTypeRegistry { 00032 protected: 00033 LoaderFileTypeRegistry(); 00034 00035 public: 00036 ~LoaderFileTypeRegistry(); 00037 00038 void register_type(LoaderFileType *type); 00039 void register_deferred_type(const string &extension, const string &library); 00040 00041 PUBLISHED: 00042 int get_num_types() const; 00043 LoaderFileType *get_type(int n) const; 00044 MAKE_SEQ(get_types, get_num_types, get_type); 00045 LoaderFileType *get_type_from_extension(const string &extension); 00046 00047 void write(ostream &out, int indent_level = 0) const; 00048 00049 static LoaderFileTypeRegistry *get_global_ptr(); 00050 00051 private: 00052 void record_extension(const string &extension, LoaderFileType *type); 00053 00054 private: 00055 typedef pvector<LoaderFileType *> Types; 00056 Types _types; 00057 00058 typedef pmap<string, LoaderFileType *> Extensions; 00059 Extensions _extensions; 00060 00061 typedef pmap<string, string> DeferredTypes; 00062 DeferredTypes _deferred_types; 00063 00064 static LoaderFileTypeRegistry *_global_ptr; 00065 }; 00066 00067 #endif 00068