<commit_before>/**
 *  @autor arssivka
 *  @date 7/8/16
 */

#pragma once


#include <string>
#include <map>
#include <forward_list>
#include <set>
#include <vector>
#include "AbstractPropertyListener.h"
#include "CopyOnWrite.h"

namespace rrc {
    /**
     * @brief Class that holds settings collections aka. PropertyDictionary and grants access to some properties via listeners.
     */
    class SettingsHolder {
    public:

        /**
         * @brief Method for adding property to settings collection(it wiil create collection if there is no such one). Also it can update value of existing property.
         * @param dictionaryName Name of the collection in which you need to store or update your property.
         * @param propertyName Name of the property that you need to update or create.
         * @param property It is a needed value of type int, float, bool or std:string or Property instance.
         */
        template<class T>
        void addOrUpdateProperty(const std::string& dictionaryName, const std::string& propertyName, T&& property) {
            auto dictionary = mDictionaries.find(dictionaryName);
            if(dictionary != mDictionaries.end()) {
                dictionary->second.addOrUpdateProperty(propertyName, std::forward<T>(property));
            }
            else {
                mDictionaries.insert({dictionaryName, PropertyContainer(propertyName, std::forward<T>(property))});
            }
        }

        /**
         * @brief Checks if there is any settings collection in SettingsHolder.<commit_msg>Misstype fix. Foramt fix.<commit_after>/**
 *  @autor arssivka
 *  @date 7/8/16
 */

#pragma once


#include <string>
#include <map>
#include <forward_list>
#include <set>
#include <vector>
#include "AbstractPropertyListener.h"
#include "CopyOnWrite.h"

namespace rrc {
    /**
     * @brief Class that holds settings collections aka. PropertyDictionary and grants access to some properties via listeners.
     */
    class SettingsHolder {
    public:

        /**
         * @brief Method for adding property to settings collection(it will create collection if there is no such one).
         * Also it can update value of existing property.
         * @param dictionaryName Name of the collection in which you need to store or update your property.
         * @param propertyName Name of the property that you need to update or create.
         * @param property It is a needed value of type int, float, bool or std:string or Property instance.
         */
        template<class T>
        void addOrUpdateProperty(const std::string& dictionaryName, const std::string& propertyName, T&& property) {
            auto dictionary = mDictionaries.find(dictionaryName);
            if(dictionary != mDictionaries.end()) {
                dictionary->second.addOrUpdateProperty(propertyName, std::forward<T>(property));
            } else {
                mDictionaries.insert({dictionaryName, PropertyContainer(propertyName, std::forward<T>(property))});
            }
        }

        /**
         * @brief Checks if there is any settings collection in SettingsHolder.
{'fraction_non_alphanumeric': 0.09038645800063877, 'fraction_numerical': 0.0025550942190993293, 'mean_word_length': 2.791767554479419, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '3497428', 'n_tokens_mistral': 805, 'n_tokens_neox': 778, 'n_words': 292}