Poster of Linux kernelThe best gift for a Linux geek
FactoryImp

FactoryImp

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

FactoryImp -  

SYNOPSIS


#include <factory.h>

Inherits Factory< Base >.  

Public Member Functions


FactoryImp (const std::string &name)

~FactoryImp ()
 

Static Public Member Functions


static AutoPtr< Base > build (const std::string &name)
 

Protected Member Functions


template<> std::map< std::string, Factory< Partitioner > * > & factory_map ()
 

Static Protected Member Functions


static std::map< std::string, Factory< Base > * > & factory_map ()
 

Private Member Functions


AutoPtr< Base > create ()
 

Detailed Description

 

template<class Derived, class Base> class FactoryImp< Derived, Base >

Factory implementation class.

Definition at line 82 of file factory.h.  

Constructor & Destructor Documentation

 

template<class Derived, class Base> FactoryImp< Derived, Base >::FactoryImp (const std::string &name) [inline]Constructor. Takes a name as input.

Definition at line 89 of file factory.h.

: Factory<Base>(name) { }
 

template<class Derived, class Base> FactoryImp< Derived, Base >::~FactoryImp () [inline]Destructor. Empty.

Definition at line 94 of file factory.h.

{}
 

Member Function Documentation

 

template<class Base > AutoPtr< Base > Factory< Base >::build (const std::string &name) [inline, static, inherited]Builds an object of type Base identified by name.

Definition at line 124 of file factory.h.

References Factory< Base >::create(), and Quality::name().

{
  // name not found in the map
  if (!factory_map().count(name))
    {
      std::cerr << 'Tried to build an unknown type: ' << name << std::endl;

      std::cerr << 'valid options are:' << std::endl;
      
      for (typename std::map<std::string,Factory<Base>*>::const_iterator
             it = factory_map().begin(); it != factory_map().end(); ++it)
        std::cerr << '  ' << it->first << std::endl;

      libmesh_error();
      
      // Do this the stoopid way for IBM xlC
      AutoPtr<Base> ret_val (NULL);
      
      return ret_val;
    }
  
  // Do this the stoopid way for IBM xlC
  Factory<Base> *f = factory_map()[name];
  
  AutoPtr<Base> ret_val (f->create());
  
  return ret_val;
}
 

template<class Derived , class Base > AutoPtr< Base > FactoryImp< Derived, Base >::create () [inline, private, virtual]Returns:

a new object of type Derived.

Implements Factory< Base >.

Definition at line 168 of file factory.h.

{  
  // Do this the stoopid way for IBM xlC
  AutoPtr<Base> ret_val (new Derived);

  return ret_val;
}
 

template<class Base> static std::map<std::string, Factory<Base>*>& Factory< Base >::factory_map () [static, protected, inherited]Map from a name to a Factory<Base>* pointer.

 

template<> std::map< std::string, Factory< Partitioner > * > & Factory< Partitioner >::factory_map () [protected, inherited]

Definition at line 39 of file partitioner_factory.C.

{
  static std::map<std::string, Factory<Partitioner>*> _map;
  return _map;      
}

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Static Public Member Functions
Protected Member Functions
Static Protected Member Functions
Private Member Functions
Detailed Description
template<class Derived, class Base> class FactoryImp< Derived, Base >
Constructor & Destructor Documentation
template<class Derived, class Base> FactoryImp< Derived, Base >::FactoryImp (const std::string &name) [inline]Constructor. Takes a name as input.
template<class Derived, class Base> FactoryImp< Derived, Base >::~FactoryImp () [inline]Destructor. Empty.
Member Function Documentation
template<class Base > AutoPtr< Base > Factory< Base >::build (const std::string &name) [inline, static, inherited]Builds an object of type Base identified by name.
template<class Derived , class Base > AutoPtr< Base > FactoryImp< Derived, Base >::create () [inline, private, virtual]Returns:
template<class Base> static std::map<std::string, Factory<Base>*>& Factory< Base >::factory_map () [static, protected, inherited]Map from a name to a Factory<Base>* pointer.
template<> std::map< std::string, Factory< Partitioner > * > & Factory< Partitioner >::factory_map () [protected, inherited]
Author

This document was created by man2html, using the manual pages.
Time: 21:45:57 GMT, April 16, 2011