<commit_before>#ifndef __TASK_DISTRIBUTION__COMPUTING_UNIT_IMPL_HPP__
#define __TASK_DISTRIBUTION__COMPUTING_UNIT_IMPL_HPP__

#include "computing_unit.hpp"

#include "tuple_serialize.hpp"

#include <functional>

namespace TaskDistribution {
  template <class T>
  ComputingUnit<T>::ComputingUnit() {
    std::hash<std::string> hasher;
    id_ = hasher(typeid(T).name());

    if (map_.find(id_) == map_.end())
      map_[id_] = new ComputingUnit<T>(id_);
  }

#if !(NO_MPI)
  template <class T>
  void ComputingUnit<T>::execute(boost::mpi::communicator& world) const {
    T obj;
    world.recv(0, 0, obj);

    size_t task_hash;
    world.recv(0, 0, task_hash);

    typename T::args_type args;
    world.recv(0, 0, args);

    typename T::result_type res;
    res = obj(args);

    world.send(0, 0, task_hash);
    world.send(0, 0, res);
  }
#endif
};

#endif
<commit_msg>Changed variable name to use id instead of hash.<commit_after>#ifndef __TASK_DISTRIBUTION__COMPUTING_UNIT_IMPL_HPP__
#define __TASK_DISTRIBUTION__COMPUTING_UNIT_IMPL_HPP__

#include "computing_unit.hpp"

#include "tuple_serialize.hpp"

#include <functional>

namespace TaskDistribution {
  template <class T>
  ComputingUnit<T>::ComputingUnit() {
    std::hash<std::string> hasher;
    id_ = hasher(typeid(T).name());

    if (map_.find(id_) == map_.end())
      map_[id_] = new ComputingUnit<T>(id_);
  }

#if !(NO_MPI)
  template <class T>
  void ComputingUnit<T>::execute(boost::mpi::communicator& world) const {
    T obj;
    world.recv(0, 0, obj);

    size_t task_id;
    world.recv(0, 0, task_id);

    typename T::args_type args;
    world.recv(0, 0, args);

    typename T::result_type res;
    res = obj(args);

    world.send(0, 0, task_id);
    world.send(0, 0, res);
  }
#endif
};

#endif

{'fraction_non_alphanumeric': 0.14237478897017444, 'fraction_numerical': 0.011254924029262802, 'mean_word_length': 4.229411764705882, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '1858941', 'n_tokens_mistral': 705, 'n_tokens_neox': 666, 'n_words': 136}