diff options
Diffstat (limited to 'library/cpp/object_factory/object_factory.h')
-rw-r--r-- | library/cpp/object_factory/object_factory.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/object_factory/object_factory.h b/library/cpp/object_factory/object_factory.h index e77d0c28fc..96cc11bcfd 100644 --- a/library/cpp/object_factory/object_factory.h +++ b/library/cpp/object_factory/object_factory.h @@ -54,20 +54,20 @@ namespace NObjectFactory { public: template <class TDerivedProduct> - void Register(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { + void Register(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { if (!creator) - ythrow yexception() << "Please specify non-null creator for " << key; + ythrow yexception() << "Please specify non-null creator for " << key; TWriteGuard guard(CreatorsLock); if (!Creators.insert(typename ICreators::value_type(key, creator)).second) ythrow yexception() << "Product with key " << key << " already registered"; } - template <class TDerivedProduct> - void Register(const TKey& key) { - Register<TDerivedProduct>(key, new TFactoryObjectCreator<TProduct, TDerivedProduct, TArgs...>); - } - + template <class TDerivedProduct> + void Register(const TKey& key) { + Register<TDerivedProduct>(key, new TFactoryObjectCreator<TProduct, TDerivedProduct, TArgs...>); + } + void GetKeys(TSet<TKey>& keys) const { TReadGuard guard(CreatorsLock); keys.clear(); @@ -165,14 +165,14 @@ namespace NObjectFactory { template <class Product> class TRegistrator { public: - TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, void>* creator) { + TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, void>* creator) { Singleton<TObjectFactory<TProduct, TKey>>()->template Register<Product>(key, creator); } - TRegistrator(const TKey& key) { - Singleton<TObjectFactory<TProduct, TKey>>()->template Register<Product>(key); - } - + TRegistrator(const TKey& key) { + Singleton<TObjectFactory<TProduct, TKey>>()->template Register<Product>(key); + } + TRegistrator() : TRegistrator(Product::GetTypeName()) { @@ -221,14 +221,14 @@ namespace NObjectFactory { template <class Product> class TRegistrator { public: - TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { + TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->template Register<Product>(key, creator); } - TRegistrator(const TKey& key) { - Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->template Register<Product>(key); - } - + TRegistrator(const TKey& key) { + Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->template Register<Product>(key); + } + TRegistrator() : TRegistrator(Product::GetTypeName()) { |