cpp-mate
0.7
Helpful library for C++.
|
Represents abstract factory. More...
#include <Forge.hpp>
Public Member Functions | |
Factory (const Factory &other)=delete | |
Disabled copy constructor. More... | |
Factory (Factory &&other)=default | |
Default move constructor. More... | |
Factory & | operator= (const Factory &other)=delete |
Disabled assign operator. More... | |
Factory & | operator= (Factory &&other)=default |
Default move operator. More... | |
template<typename... A> | |
std::unique_ptr< T > | createInstance (const std::string &name, A &&... args) const |
Creates a new instance by name. More... | |
template<typename... A> | |
std::unique_ptr< T > | requestInstance (A &&... args) const |
Tries to create a new instance by provided arguments. More... | |
std::vector< std::string > | getProviders () const |
Returns list of provider names. More... | |
I | getInfo (const std::string &name) const |
Returns information about provider by name. More... | |
void | registerProvider (std::unique_ptr< P > provider, bool override=false) |
Registers new provider. More... | |
bool | deregisterProvider (const std::string &name) |
Deregisters provider by name. More... | |
Protected Member Functions | |
Factory ()=default | |
virtual | ~Factory ()=default |
P & | getProvider (const std::string &name) const |
Returns provider by name. More... | |
Protected Attributes | |
std::map< std::string, std::unique_ptr< P > > | _providers |
Map of providers. More... | |
Represents abstract factory.
|
delete |
Disabled copy constructor.
other | another instance to copy. |
|
default |
Default move constructor.
other | another instance to move. |
|
protecteddefault |
Constructor.
|
protectedvirtualdefault |
Destructor.
|
inline |
Creates a new instance by name.
name | the name of the provider. |
args | arguments for instance initialization. |
std::invalid_argument |
|
inline |
Deregisters provider by name.
name | the name of provider to unregister. |
true
if the provider has been successfully deregistered; false
otherwise.
|
inline |
Returns information about provider by name.
name | the name of provider. |
std::invalid_argument |
|
inlineprotected |
Returns provider by name.
name | the name of provider. |
|
inline |
Returns list of provider names.
|
delete |
Disabled assign operator.
other | other instance to assign. |
|
default |
Default move operator.
other | another instance to move. |
|
inline |
Registers new provider.
provider | the provider to register. |
override | if this flag is true existing provider (with same name) will be overridden; otherwise std::invalid_argument will be thrown. |
std::invalid_argument |
|
inline |
Tries to create a new instance by provided arguments.
args | arguments for instance initialization. |
std::invalid_argument |
|
protected |
Map of providers.