36class EXPCL_PANDA_PUTIL FactoryBase {
42 FactoryBase() =
default;
43 FactoryBase(
const FactoryBase ©) =
delete;
44 ~FactoryBase() =
default;
46 FactoryBase &operator = (
const FactoryBase ©) =
delete;
72 void write_types(std::ostream &out,
int indent_level = 0)
const;
83 BaseCreateFunc *_func;
87 typedef pmap<TypeHandle, Creator> Creators;
90 typedef pvector<TypeHandle> Preferred;
void register_factory(TypeHandle handle, BaseCreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
TypeHandle find_registered_type(TypeHandle handle)
Returns the TypeHandle given, if it is a registered type, or if it is not registered,...
void write_types(std::ostream &out, int indent_level=0) const
Writes a list of all known types the Factory can create to the indicated output stream,...
TypeHandle get_type(size_t n) const
Returns the nth type the Factory knows how to create.
TypedObject * make_instance(TypeHandle handle, const FactoryParams ¶ms)
Attempts to create a new instance of some class of the indicated type, or some derivative if necessar...
size_t get_num_preferred() const
Returns the number of types added to the preferred-type list.
void add_preferred(TypeHandle handle)
Adds the indicated type to the end of the list of preferred types.
TypeHandle get_preferred(size_t n) const
Returns the nth type added to the preferred-type list.
void clear_preferred()
Empties the list of preferred types.
TypedObject * make_instance_more_general(TypeHandle handle, const FactoryParams ¶ms)
Attempts to create an instance of the type requested, or some base type of the type requested.
size_t get_num_types() const
Returns the number of different types the Factory knows how to create.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
TypeHandle is the identifier used to differentiate C++ class types.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.