<commit_before>/**
 * @file plugin_factory.h
 *
 * @date Nov 20, 2012
 * @author partio
 */

#ifndef PLUGIN_FACTORY_H
#define PLUGIN_FACTORY_H

#include <vector>
#include "plugin_container.h"
#include <mutex>
#include <memory>

#define GET_PLUGIN(P) std::dynamic_pointer_cast<himan::plugin::P> (plugin_factory::Instance()->Plugin(#P))

namespace himan
{

class plugin_factory
{
public:
    static plugin_factory* Instance();

    std::vector<std::shared_ptr<plugin::himan_plugin>> Plugins(HPPluginClass = kUnknownPlugin); // Kinda ugly

	
	/**
	 * @brief Return instance of the requested plugin if found. Caller must cast
	 * the plugin to the derived class. 
	 */
	
    std::shared_ptr<plugin::himan_plugin> Plugin(const std::string& theClassName);

    ~plugin_factory() = default;

private:
    // Hide constructor
    plugin_factory();

    plugin_factory(const plugin_factory&) = delete;

    static std::unique_ptr<plugin_factory> itsInstance;

    void ReadPlugins();

    bool Load(const std::string& thePluginFileName);

    void Unload();

    std::vector<std::shared_ptr<plugin_container>> itsPluginFactory;

    std::vector<std::string> itsPluginSearchPath;
    std::unique_ptr<logger> itsLogger;

	std::mutex itsPluginMutex;

};

} // namespace himan

#endif /* PLUGIN_FACTORY_H */
<commit_msg>remove default which crashed himan in certain conditions<commit_after>/**
 * @file plugin_factory.h
 *
 * @date Nov 20, 2012
 * @author partio
 */

#ifndef PLUGIN_FACTORY_H
#define PLUGIN_FACTORY_H

#include <vector>
#include "plugin_container.h"
#include <mutex>
#include <memory>

#define GET_PLUGIN(P) std::dynamic_pointer_cast<himan::plugin::P> (plugin_factory::Instance()->Plugin(#P))

namespace himan
{

class plugin_factory
{
public:
    static plugin_factory* Instance();

    std::vector<std::shared_ptr<plugin::himan_plugin>> Plugins(HPPluginClass = kUnknownPlugin); // Kinda ugly

	
	/**
	 * @brief Return instance of the requested plugin if found. Caller must cast
	 * the plugin to the derived class. 
	 */
	
    std::shared_ptr<plugin::himan_plugin> Plugin(const std::string& theClassName);

    ~plugin_factory() {}

private:
    // Hide constructor
    plugin_factory();

    plugin_factory(const plugin_factory&) = delete;

    static std::unique_ptr<plugin_factory> itsInstance;

    void ReadPlugins();

    bool Load(const std::string& thePluginFileName);

    void Unload();

    std::vector<std::shared_ptr<plugin_container>> itsPluginFactory;

    std::vector<std::string> itsPluginSearchPath;
    std::unique_ptr<logger> itsLogger;

	std::mutex itsPluginMutex;

};

} // namespace himan

#endif /* PLUGIN_FACTORY_H */

{'fraction_non_alphanumeric': 0.12533031332578332, 'fraction_numerical': 0.004530011325028313, 'mean_word_length': 4.824175824175824, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4606540', 'n_tokens_mistral': 885, 'n_tokens_neox': 834, 'n_words': 190}