Panda3D
factoryParams.I
1 // Filename: factoryParams.I
2 // Created by: drose (08May00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "pnotify.h"
16 
17 
18 ////////////////////////////////////////////////////////////////////
19 // Function: get_param_into
20 // Description: A handy convenience template function that extracts a
21 // parameter of the indicated type from the
22 // FactoryParams list. If the parameter type is found,
23 // it fills the pointer and returns true; otherwise, it
24 // sets the pointer to NULL and returns false.
25 ////////////////////////////////////////////////////////////////////
26 template<class ParamType>
27 bool get_param_into(ParamType *&pointer, const FactoryParams &params) {
28  FactoryParam *param =
29  params.get_param_of_type(ParamType::get_class_type());
30  if (param == (FactoryParam *)NULL) {
31  pointer = NULL;
32  return false;
33  }
34  DCAST_INTO_R(pointer, param, false);
35  return true;
36 }
The base class of any number of specific pieces of parameter information that might be passed to a Fa...
Definition: factoryParam.h:34
FactoryParam * get_param_of_type(TypeHandle type) const
Returns the first parameter that matches exactly the indicated type, or if there are no exact matches...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40