Panda3D

Loading...
Searching...
No Matches
factoryParams.I
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 factoryParams.I
10 * @author drose
11 * @date 2000-05-08
12 */
13
14#include "pnotify.h"
15
16/**
17 * Returns the custom pointer that was associated with the factory function.
18 */
19INLINE void *FactoryParams::
20 get_user_data() const {
21 return _user_data;
22}
23
24/**
25 * A handy convenience template function that extracts a parameter of the
26 * indicated type from the FactoryParams list. If the parameter type is
27 * found, it fills the pointer and returns true; otherwise, it sets the
28 * pointer to NULL and returns false.
29 */
30 template<class ParamType>
31 bool get_param_into(ParamType *&pointer, const FactoryParams &params) {
32 FactoryParam *param =
33 params.get_param_of_type(ParamType::get_class_type());
34 if (param == nullptr) {
35 pointer = nullptr;
36 return false;
37 }
38 DCAST_INTO_R(pointer, param, false);
39 return true;
40}
FactoryParam
The base class of any number of specific pieces of parameter information that might be passed to a Fa...
Definition factoryParam.h:30
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition factoryParams.h:36
FactoryParams::get_user_data
void * get_user_data() const
Returns the custom pointer that was associated with the factory function.
Definition factoryParams.I:20
FactoryParams::get_param_of_type
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...
Definition factoryParams.cxx:56
get_param_into
bool get_param_into(ParamType *&pointer, const FactoryParams &params)
A handy convenience template function that extracts a parameter of the indicated type from the Factor...
Definition factoryParams.I:31
pnotify.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.