Piro  Development
 All Classes Namespaces Functions Variables Groups
List of all members
Piro::Provider< T > Class Template Reference

Handle for auxiliary object factories. More...

#include <Piro_Provider.hpp>

Public Member Functions

Constructors
 Provider ()
 Constructs a Provider that returns null pointers.
 
 Provider (Teuchos::ENull)
 Constructs an uninitialized Provider. More...
 
template<typename U >
 Provider (const Teuchos::RCP< U > &instance)
 Constructs a Provider returning an already existing instance. More...
 
template<typename P >
 Provider (const P &p)
 Constructs a Provider from a callable object, either a function object (functor) or a function pointer. More...
 
 Provider (const Teuchos::RCP< ProviderBase< T > > &ptr_in)
 Constructs a Provider handle that wraps the provided implementation.
 
Core functionality
Teuchos::RCP< T > operator() (const Teuchos::RCP< Teuchos::ParameterList > &params)
 Returns an instance of a subclass of the type T. More...
 
Validity check
bool nonnull () const
 Checks that the Provider has been initialized.
 
bool is_null () const
 Checks whether the Provider has been left uninitialized.
 
Access to internals
Teuchos::RCP< const
ProviderBase< T > > 
ptr () const
 Returns a const pointer to the internal implementation.
 
Teuchos::RCP< ProviderBase< T > > ptr ()
 Returns a non-const pointer to the internal implementation.
 

Related Functions

(Note that these are not member functions.)

Validity check
template<typename T >
bool nonnull (const Provider< T > &handle)
 Returns true if handle is initialized. More...
 
template<typename T >
bool is_null (const Provider< T > &handle)
 Returns true if handle is uninitialized. More...
 

Detailed Description

template<typename T>
class Piro::Provider< T >

Handle for auxiliary object factories.

A Provider is a smart handle that offers function semantics (i.e. can be called as a function) as well as several implicit conversions as a convenience to manipulate objects that implement the ProviderBase interface.

It is essentially a thin wrapper around Teuchos::RCP<ProviderBase<T>> that preserves its core functionality including sharing and reference counting.

The solver factory Piro::Epetra::SolverFactory uses Providers as sources of auxiliary objects for the different Piro solvers.

Constructor & Destructor Documentation

template<typename T>
Piro::Provider< T >::Provider ( Teuchos::ENull  )
inline

Constructs an uninitialized Provider.

A valid Provider must be assigned to *this before Provider::operator() is called. This constructor exists mostly for debugging purposes and its use is discouraged. The default constructor should be preferred in most cases.

template<typename T>
template<typename U >
Piro::Provider< T >::Provider ( const Teuchos::RCP< U > &  instance)
inline

Constructs a Provider returning an already existing instance.

The template parameter U must refer to a type that can be converted to T.

template<typename T>
template<typename P >
Piro::Provider< T >::Provider ( const P &  p)
inline

Constructs a Provider from a callable object, either a function object (functor) or a function pointer.

The template parameter P must refer to a copy-constructible callable object type such that the following code is valid

Teuchos::RCP<T> instance = p(params);

where params denotes a variable of type Teuchos::RCP<Teuchos::ParameterList>.

Member Function Documentation

template<typename T>
Teuchos::RCP<T> Piro::Provider< T >::operator() ( const Teuchos::RCP< Teuchos::ParameterList > &  params)
inline

Returns an instance of a subclass of the type T.

Precondition
this->nonnull()

Friends And Related Function Documentation

template<typename T >
bool is_null ( const Provider< T > &  handle)
related

Returns true if handle is uninitialized.

References Piro::Provider< T >::is_null().

template<typename T >
bool nonnull ( const Provider< T > &  handle)
related

Returns true if handle is initialized.

References Piro::Provider< T >::nonnull().


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