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 > ¶ms) |
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... | |
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.
|
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.
|
inline |
Constructs a Provider returning an already existing instance.
The template parameter U
must refer to a type that can be converted to T
.
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
where params
denotes a variable of type Teuchos::RCP<Teuchos::ParameterList>
.
|
inline |
Returns an instance of a subclass of the type T.
this->nonnull()
|
related |
Returns true
if handle
is uninitialized.
References Piro::Provider< T >::is_null().
|
related |
Returns true
if handle
is initialized.
References Piro::Provider< T >::nonnull().