Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/express/register_type.I

Go to the documentation of this file.
00001 // Filename: register_type.I
00002 // Created by:  drose (06Aug01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: register_type
00022 //  Description: This inline function is just a convenient way to call
00023 //               TypeRegistry::register_type(), along with zero to four
00024 //               record_derivation()s.  If for some reason you have a
00025 //               class that has more than four base classes (you're
00026 //               insane!), then you will need to call Register() and
00027 //               record_derivation() yourself.
00028 ////////////////////////////////////////////////////////////////////
00029 INLINE void
00030 register_type(TypeHandle &type_handle, const string &name) {
00031   TypeRegistry::ptr()->register_type(type_handle, name);
00032 }
00033 INLINE void
00034 register_type(TypeHandle &type_handle, const string &name,
00035               TypeHandle parent1) {
00036   if (TypeRegistry::ptr()->register_type(type_handle, name)) {
00037     TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00038   }
00039 }
00040 INLINE void
00041 register_type(TypeHandle &type_handle, const string &name,
00042               TypeHandle parent1, TypeHandle parent2) {
00043   if (TypeRegistry::ptr()->register_type(type_handle, name)) {
00044     TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00045     TypeRegistry::ptr()->record_derivation(type_handle, parent2);
00046   }
00047 }
00048 INLINE void
00049 register_type(TypeHandle &type_handle, const string &name,
00050               TypeHandle parent1, TypeHandle parent2,
00051               TypeHandle parent3) {
00052   if (TypeRegistry::ptr()->register_type(type_handle, name)) {
00053     TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00054     TypeRegistry::ptr()->record_derivation(type_handle, parent2);
00055     TypeRegistry::ptr()->record_derivation(type_handle, parent3);
00056   }
00057 }
00058 INLINE void
00059 register_type(TypeHandle &type_handle, const string &name,
00060               TypeHandle parent1, TypeHandle parent2,
00061               TypeHandle parent3, TypeHandle parent4) {
00062   if (TypeRegistry::ptr()->register_type(type_handle, name)) {
00063     TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00064     TypeRegistry::ptr()->record_derivation(type_handle, parent2);
00065     TypeRegistry::ptr()->record_derivation(type_handle, parent3);
00066     TypeRegistry::ptr()->record_derivation(type_handle, parent4);
00067   }
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //     Function: register_dynamic_type
00072 //  Description: This is essentially similar to register_type(),
00073 //               except that it doesn't store a reference to any
00074 //               TypeHandle passed in and it therefore doesn't
00075 //               complain if the type is registered more than once to
00076 //               different TypeHandle reference.
00077 ////////////////////////////////////////////////////////////////////
00078 INLINE TypeHandle
00079 register_dynamic_type(const string &name) {
00080   return TypeRegistry::ptr()->register_dynamic_type(name);
00081 }
00082 INLINE TypeHandle
00083 register_dynamic_type(const string &name, TypeHandle parent1) {
00084   TypeHandle type_handle =
00085     TypeRegistry::ptr()->register_dynamic_type(name);
00086   TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00087   return type_handle;
00088 }
00089 INLINE TypeHandle
00090 register_dynamic_type(const string &name,
00091                       TypeHandle parent1, TypeHandle parent2) {
00092   TypeHandle type_handle =
00093     TypeRegistry::ptr()->register_dynamic_type(name);
00094   TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00095   TypeRegistry::ptr()->record_derivation(type_handle, parent2);
00096   return type_handle;
00097 }
00098 INLINE TypeHandle
00099 register_dynamic_type(const string &name,
00100                       TypeHandle parent1, TypeHandle parent2,
00101                       TypeHandle parent3) {
00102   TypeHandle type_handle =
00103     TypeRegistry::ptr()->register_dynamic_type(name);
00104   TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00105   TypeRegistry::ptr()->record_derivation(type_handle, parent2);
00106   TypeRegistry::ptr()->record_derivation(type_handle, parent3);
00107   return type_handle;
00108 }
00109 INLINE TypeHandle
00110 register_dynamic_type(const string &name,
00111                       TypeHandle parent1, TypeHandle parent2,
00112                       TypeHandle parent3, TypeHandle parent4) {
00113   TypeHandle type_handle =
00114     TypeRegistry::ptr()->register_dynamic_type(name);
00115   TypeRegistry::ptr()->record_derivation(type_handle, parent1);
00116   TypeRegistry::ptr()->record_derivation(type_handle, parent2);
00117   TypeRegistry::ptr()->record_derivation(type_handle, parent3);
00118   TypeRegistry::ptr()->record_derivation(type_handle, parent4);
00119   return type_handle;
00120 }

Generated on Fri May 2 00:38:34 2003 for Panda by doxygen1.3