template<typename FilterT>
class vlink::AbstractFactory< FilterT >
Lazily allocates and caches AbstractObject instances keyed by FilterT.
Holds a std::map<FilterT, std::weak_ptr<Object>> so that multiple node peers requesting the same key reuse the same registration record. The returned std::shared_ptr carries a custom deleter that erases the map entry when the last owner releases the object, which keeps the lookup map free of stale weak_ptr slots.
- 注解
- The factory itself is non-copyable and non-movable; share it through a singleton or a per-transport static instance.
- 模板参数
-
| FilterT | Topic-key type (typically std::string). |
template<typename FilterT >
template<typename ObjectT >
Looks up or creates the ObjectT registered against filter.
If the cached weak_ptr is still valid, the existing instance is shared with the caller. Otherwise a new ObjectT is allocated (outside the factory lock so its constructor can re-enter VLink safely), the resulting shared_ptr is given a deleter that removes the cache entry on destruction, and the value is stored back into the map.
- 模板参数
-
| ObjectT | Concrete subclass of AbstractObject<FilterT> to allocate. |
- 参数
-
| filter | Key identifying the topic. |
- 返回
- Shared ownership handle for the cached object.