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

panda/src/putil/factoryBase.I

Go to the documentation of this file.
00001 // Filename: factoryBase.I
00002 // Created by:  drose (08May00)
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: FactoryBase::make_instance
00022 //       Access: Public
00023 //  Description: Attempts to create a new instance of some class of
00024 //               the indicated type, or some derivative if necessary.
00025 //               If an instance of the exact type cannot be created,
00026 //               the specified priorities will specify which derived
00027 //               class will be preferred.
00028 //
00029 //               This flavor of make_instance() accepts a string name
00030 //               that indicates the desired type.  It must be the name
00031 //               of some already-registered type.
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE TypedObject *FactoryBase::
00034 make_instance(const string &type_name, const FactoryParams &params) {
00035   TypeHandle handle = TypeRegistry::ptr()->find_type(type_name);
00036   nassertr(handle != TypeHandle::none(), NULL);
00037 
00038   return make_instance(handle, params);
00039 }
00040 
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: FactoryBase::make_instance_more_general
00044 //       Access: Public
00045 //  Description: Attempts to create an instance of the type requested,
00046 //               or some base type of the type requested.  Returns the
00047 //               new instance created, or NULL if the instance could
00048 //               not be created.
00049 //
00050 //               This flavor of make_instance_more_general() accepts a
00051 //               string name that indicates the desired type.  It must
00052 //               be the name of some already-registered type.
00053 ////////////////////////////////////////////////////////////////////
00054 INLINE TypedObject *FactoryBase::
00055 make_instance_more_general(const string &type_name,
00056                            const FactoryParams &params) {
00057   TypeHandle handle = TypeRegistry::ptr()->find_type(type_name);
00058   nassertr(handle != TypeHandle::none(), NULL);
00059 
00060   return make_instance_more_general(handle, params);
00061 }
00062 

Generated on Fri May 2 00:43:37 2003 for Panda by doxygen1.3