#pragma once #include "IDictionary.h" #include "registerDictionaries.h" #include namespace Poco { namespace Util { class AbstractConfiguration; } class Logger; } namespace DB { class Context; class DictionaryFactory : private boost::noncopyable { public: static DictionaryFactory & instance(); /// Create dictionary from AbstractConfiguration parsed /// from xml-file on filesystem. DictionaryPtr create( const std::string & name, const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix, const Context & context, bool check_source_config = false) const; /// Create dictionary from DDL-query DictionaryPtr create(const std::string & name, const ASTCreateQuery & ast, const Context & context) const; using Creator = std::function; bool isComplex(const std::string & layout_type) const; void registerLayout(const std::string & layout_type, Creator create_layout, bool is_complex); private: using LayoutRegistry = std::unordered_map; LayoutRegistry registered_layouts; using LayoutComplexity = std::unordered_map; LayoutComplexity layout_complexity; }; }