queso-0.56.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Private Member Functions | List of all members
QUESO::AlgorithmFactory Class Referenceabstract

#include <AlgorithmFactory.h>

Inheritance diagram for QUESO::AlgorithmFactory:
Inheritance graph
[legend]
Collaboration diagram for QUESO::AlgorithmFactory:
Collaboration graph
[legend]

Public Member Functions

 AlgorithmFactory (const std::string &name)
 
virtual ~AlgorithmFactory ()
 
- Public Member Functions inherited from QUESO::Factory< Algorithm< GslVector, GslMatrix > >
virtual ~Factory ()
 

Static Public Member Functions

static void set_environment (const BaseEnvironment &env)
 
static void set_tk (const BaseTKGroup< GslVector, GslMatrix > &tk)
 
- Static Public Member Functions inherited from QUESO::Factory< Algorithm< GslVector, GslMatrix > >
static SharedPtr< Algorithm
< GslVector, GslMatrix >
>::Type 
build (const std::string &name)
 

Protected Member Functions

virtual SharedPtr< Algorithm
< GslVector, GslMatrix >
>::Type 
build_algorithm ()=0
 
- Protected Member Functions inherited from QUESO::Factory< Algorithm< GslVector, GslMatrix > >
 Factory (const std::string &name)
 

Static Protected Attributes

static const BaseEnvironmentm_env = NULL
 
static const BaseTKGroup
< GslVector, GslMatrix > * 
m_tk = NULL
 

Private Member Functions

virtual SharedPtr< Algorithm
< GslVector, GslMatrix >
>::Type 
create ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from QUESO::Factory< Algorithm< GslVector, GslMatrix > >
static std::map< std::string,
Factory< Algorithm< GslVector,
GslMatrix > > * > & 
factory_map ()
 

Detailed Description

AlgorithmFactory class defintion. Clients subclassing this for their own algorithm (aka Metropolis-Hastings acceptance ratio) should implement build_algorithm.

Definition at line 42 of file AlgorithmFactory.h.

Constructor & Destructor Documentation

QUESO::AlgorithmFactory::AlgorithmFactory ( const std::string &  name)
inline

Constructor. Takes the name to be mapped.

Definition at line 48 of file AlgorithmFactory.h.

49  : Factory<Algorithm<GslVector, GslMatrix> >(name)
50  {}
virtual QUESO::AlgorithmFactory::~AlgorithmFactory ( )
inlinevirtual

Destructor. (Empty.)

Definition at line 55 of file AlgorithmFactory.h.

55 {}

Member Function Documentation

virtual SharedPtr<Algorithm<GslVector, GslMatrix> >::Type QUESO::AlgorithmFactory::build_algorithm ( )
protectedpure virtual
SharedPtr< Algorithm< GslVector, GslMatrix > >::Type QUESO::AlgorithmFactory::create ( )
inlineprivatevirtual

Create a Base class. Force this to be implemented later.

Implements QUESO::Factory< Algorithm< GslVector, GslMatrix > >.

Definition at line 83 of file AlgorithmFactory.h.

References build_algorithm(), m_env, m_tk, queso_assert, and queso_require_msg.

84 {
85  queso_require_msg(m_env, "ERROR: must call set_environment() before building alg!");
86  queso_require_msg(m_tk, "ERROR: must call set_tk() before building alg!");
87 
88  SharedPtr<Algorithm<GslVector, GslMatrix> >::Type new_alg = this->build_algorithm();
89 
90  queso_assert(new_alg);
91 
92  return new_alg;
93 }
static const BaseTKGroup< GslVector, GslMatrix > * m_tk
virtual SharedPtr< Algorithm< GslVector, GslMatrix > >::Type build_algorithm()=0
#define queso_assert(asserted)
Definition: asserts.h:132
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
static const BaseEnvironment * m_env
static void QUESO::AlgorithmFactory::set_environment ( const BaseEnvironment env)
inlinestatic

Definition at line 57 of file AlgorithmFactory.h.

References m_env.

Referenced by QUESO::MetropolisHastingsSG< P_V, P_M >::commonConstructor().

58  {
59  m_env = &env;
60  }
static const BaseEnvironment * m_env
static void QUESO::AlgorithmFactory::set_tk ( const BaseTKGroup< GslVector, GslMatrix > &  tk)
inlinestatic

Definition at line 62 of file AlgorithmFactory.h.

References m_tk.

Referenced by QUESO::MetropolisHastingsSG< P_V, P_M >::commonConstructor().

63  {
64  m_tk = &tk;
65  }
static const BaseTKGroup< GslVector, GslMatrix > * m_tk

Member Data Documentation

const BaseEnvironment * QUESO::AlgorithmFactory::m_env = NULL
staticprotected

Definition at line 70 of file AlgorithmFactory.h.

Referenced by create(), and set_environment().

const BaseTKGroup< GslVector, GslMatrix > * QUESO::AlgorithmFactory::m_tk = NULL
staticprotected

Definition at line 71 of file AlgorithmFactory.h.

Referenced by create(), and set_tk().


The documentation for this class was generated from the following files:

Generated on Thu Dec 15 2016 13:23:13 for queso-0.56.1 by  doxygen 1.8.5