Implementation of DIFactory can manage and create instances by name and automatically (usually based on some configuration) inject dependencies into each instance.
More...
#include <DIFactory.h>
|
DIWrapper * | create (const std::string &name, bool detach=false) |
| Create a new instance by name. If detached is true, the memory of the returned DIWrapper pointer MUST be explicitly deleted. Otherwise, each created instance is managed by the DIFactory.
|
|
template<typename T > |
Poco::SharedPtr< T > | create (const std::string &name, bool detach=false) |
| Create a new instance by name and perform runtime cast to the target type if possible. More...
|
|
DIWrapper * | find (const std::string &name) |
| Find an existing instance and return it. More...
|
|
template<typename T > |
Poco::SharedPtr< T > | find (const std::string &name) |
| Find an existing instance and cast it to the target type if possible. More...
|
|
|
template<typename T > |
Poco::SharedPtr< T > | cast (DIWrapper &wrapper) |
| Cast the wrapped instance to the target type. If the cast is not possible, throw an exception.
|
|
virtual DIWrapper * | findImpl (const std::string &name)=0 |
|
virtual DIWrapper * | createImpl (const std::string &name, bool detach)=0 |
|
virtual void | castImpl (const std::type_info &type, const DIWrapper &wrapper, void *target)=0 |
| Perform cast of the given wrapper to the target of the given type. The target points to the Poco::SharedPtr<T> where typeid(T) == type.
|
|
Implementation of DIFactory can manage and create instances by name and automatically (usually based on some configuration) inject dependencies into each instance.
template<typename T >
Poco::SharedPtr<T> BeeeOn::DIFactory::create |
( |
const std::string & |
name, |
|
|
bool |
detach = false |
|
) |
| |
|
inline |
Create a new instance by name and perform runtime cast to the target type if possible.
- See Also
- DIFactory::create()
virtual DIWrapper* BeeeOn::DIFactory::createImpl |
( |
const std::string & |
name, |
|
|
bool |
detach |
|
) |
| |
|
protectedpure virtual |
- Returns
- DIWrapper that represents the instance of the given name. If it already exists, return the existing one.
DIWrapper* BeeeOn::DIFactory::find |
( |
const std::string & |
name | ) |
|
|
inline |
Find an existing instance and return it.
- Returns
- found instance or nullptr
template<typename T >
Poco::SharedPtr<T> BeeeOn::DIFactory::find |
( |
const std::string & |
name | ) |
|
|
inline |
Find an existing instance and cast it to the target type if possible.
- Returns
- found instance or nullptr
virtual DIWrapper* BeeeOn::DIFactory::findImpl |
( |
const std::string & |
name | ) |
|
|
protectedpure virtual |
- Returns
- DIWrapper that represents the instance of the given name or nullptr.
The documentation for this class was generated from the following files:
- /var/lib/jenkins/workspace/beeeon-gateway-master/base/src/di/DIFactory.h
- /var/lib/jenkins/workspace/beeeon-gateway-master/base/src/di/DIFactory.cpp