template<typename FilterT>
class vlink::AbstractFactory< FilterT >
Topic-keyed factory that creates and caches AbstractObject instances.
Maintains a std::map<FilterT, std::weak_ptr<Object>> so that multiple NodeImpl instances sharing the same topic key reuse the same AbstractObject. Objects are reference-counted: the entry is automatically removed from the map when the last shared_ptr to the object is destroyed, preventing stale entries from accumulating.
- 注解
- This class is not copy-constructible or copy-assignable.
- 模板参数
-
| FilterT | The key type used to identify topics (e.g. std::string). |
template<typename FilterT>
template<typename ObjectT>
Retrieves or creates the AbstractObject for the given filter key.
If an object already exists for filter and is still alive (the weak_ptr is valid), the existing shared_ptr is returned. Otherwise a new ObjectT is heap-allocated, wrapped in a shared_ptr with a custom deleter that removes the entry from the internal map on destruction, and cached.
- 模板参数
-
- 参数
-
| filter | Topic key used to look up or create the object. |
- 返回
- A
shared_ptr<ObjectT> for the given filter.