diff options
author | insight <insight@yandex-team.ru> | 2022-02-10 16:46:59 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:59 +0300 |
commit | 122c87ebe5797d52f1800afb02c87f751135d0a4 (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/object_factory | |
parent | 3649e6106e994e7f969877e4b10207d3556454b2 (diff) | |
download | ydb-122c87ebe5797d52f1800afb02c87f751135d0a4.tar.gz |
Restoring authorship annotation for <insight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/object_factory')
-rw-r--r-- | library/cpp/object_factory/object_factory.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/library/cpp/object_factory/object_factory.h b/library/cpp/object_factory/object_factory.h index a389f7b651..96cc11bcfd 100644 --- a/library/cpp/object_factory/object_factory.h +++ b/library/cpp/object_factory/object_factory.h @@ -23,7 +23,7 @@ namespace NObjectFactory { virtual ~IFactoryObjectCreator() { } }; - + #define FACTORY_OBJECT_NAME(Name) \ static TString GetTypeName() { \ return #Name; \ @@ -31,7 +31,7 @@ namespace NObjectFactory { virtual TString GetType() const override { \ return #Name; \ } - + template <class TBaseProduct, class TDerivedProduct, class... TArgs> class TFactoryObjectCreator: public IFactoryObjectCreator<TBaseProduct, TArgs...> { TDerivedProduct* Create(TArgs... args) const override { @@ -45,13 +45,13 @@ namespace NObjectFactory { return new TDerivedProduct(); } }; - + template <class P, class K, class... TArgs> class IObjectFactory { public: typedef P TProduct; typedef K TKey; - + public: template <class TDerivedProduct> void Register(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { @@ -102,7 +102,7 @@ namespace NObjectFactory { IFactoryObjectCreator<TProduct, void>* creator = IObjectFactory<TProduct, TKey, void>::GetCreator(key); return creator == nullptr ? nullptr : creator->Create(); } - + static TString KeysDebugString() { TSet<TString> keys; Singleton<TObjectFactory<TProduct, TKey>>()->GetKeys(keys); @@ -112,7 +112,7 @@ namespace NObjectFactory { } return keysStr; } - + static TProduct* Construct(const TKey& key, const TKey& defKey) { TProduct* result = Singleton<TObjectFactory<TProduct, TKey>>()->Create(key); if (!result && !!defKey) { @@ -195,7 +195,7 @@ namespace NObjectFactory { static TProduct* Construct(const TKey& key, TArgs... args) { return Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->Create(key, std::forward<TArgs>(args)...); } - + template <class... Args> static THolder<TProduct> VerifiedConstruct(Args&&... args) { auto result = MakeHolder(std::forward<Args>(args)...); @@ -211,7 +211,7 @@ namespace NObjectFactory { static void GetRegisteredKeys(TSet<TKey>& keys) { return Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->GetKeys(keys); } - + static TSet<TKey> GetRegisteredKeys() { TSet<TKey> keys; Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->GetKeys(keys); |