$extrastylesheet
#include <factory.h>

Public Member Functions | |
| virtual | ~Factory () |
| virtual UniquePtr< Base > | create ()=0 |
Static Public Member Functions | |
| static UniquePtr< Base > | build (const std::string &name) |
Protected Member Functions | |
| Factory (const std::string &name) | |
| template<> | |
| std::map< std::string, Factory < Partitioner > * > & | factory_map () |
Static Protected Member Functions | |
| static std::map< std::string, Factory< Base > * > & | factory_map () |
Factory class defintion.
| libMesh::Factory< Base >::Factory | ( | const std::string & | name | ) | [inline, protected] |
Constructor. Takes the name to be mapped.
Definition at line 113 of file factory.h.
References libMesh::libmesh_assert(), and libMesh::Quality::name().
{
// Make sure we haven't already added this name
// to the map
libmesh_assert (!factory_map().count(name));
factory_map()[name] = this;
}
| virtual libMesh::Factory< Base >::~Factory | ( | ) | [inline, virtual] |
| UniquePtr< Base > libMesh::Factory< Base >::build | ( | const std::string & | name | ) | [inline, static] |
Builds an object of type Base identified by name.
Definition at line 126 of file factory.h.
References libMesh::Factory< Base >::create(), libMesh::err, and libMesh::Quality::name().
{
// name not found in the map
if (!factory_map().count(name))
{
libMesh::err << "Tried to build an unknown type: " << name << std::endl;
libMesh::err << "valid options are:" << std::endl;
for (typename std::map<std::string,Factory<Base>*>::const_iterator
it = factory_map().begin(); it != factory_map().end(); ++it)
libMesh::err << " " << it->first << std::endl;
libmesh_error_msg("Exiting...");
// We'll never get here
return UniquePtr<Base>();
}
Factory<Base> *f = factory_map()[name];
return UniquePtr<Base>(f->create());
}
| virtual UniquePtr<Base> libMesh::Factory< Base >::create | ( | ) | [pure virtual] |
Create a Base class. Force this to be implemented later.
Implemented in libMesh::FactoryImp< Derived, Base >.
Referenced by libMesh::Factory< Base >::build().
| std::map< std::string, Factory< Partitioner > * > & libMesh::Factory< Partitioner >::factory_map | ( | ) | [protected] |
Definition at line 40 of file partitioner_factory.C.
{
static std::map<std::string, Factory<Partitioner>*> _map;
return _map;
}
| static std::map<std::string, Factory<Base>*>& libMesh::Factory< Base >::factory_map | ( | ) | [static, protected] |
Map from a name to a Factory<Base>* pointer.