<commit_before>/*! \file
 *
 * \brief The base class for all modules (source)
 * \author <NAME> (<EMAIL>)
 */


#include "pulsar/modulebase/ModuleBase.hpp"
#include "pulsar/datastore/Wavefunction.hpp"

using pulsar::modulemanager::ModuleManager;
using pulsar::modulemanager::ModuleInfo;
using pulsar::datastore::Wavefunction;
using pulsar::modulemanager::ModuleTreeNode;
using pulsar::datastore::CacheData;
using pulsar::datastore::OptionMap;
using pulsar::exception::GeneralException;


namespace pulsar{
namespace modulebase {


ModuleBase::ModuleBase(ID_t id, const char * modtype)
    : tbts_(std::cout.rdbuf(), nullptr),  // by default, go to cout only
      out(&tbts_),
      id_(id), modtype_(modtype), mlocator_(nullptr), treenode_(nullptr)
{
    out.debug("Constructed %? module [%?]\n", modtype, id);
}


ModuleBase::~ModuleBase()
{
    if(treenode_ == nullptr)
        out.debug("Destroying a module that doesn't have a tree node...");
    else
    {
        out.debug("Module [%?] : Output size: %?\n", id(), get_output().size());
        out.debug("Destructed module [%?] : %? v%?\n", id(), name(), version());
        mlocator_->notify_destruction(id());
    }
}



/////////////////////////////
// Basic Info
/////////////////////////////
ID_t ModuleBase::id(void) const noexcept
{
    return id_;
}


std::string ModuleBase::key(void) const<commit_msg>Fix MPI printing in modules<commit_after>/*! \file
 *
 * \brief The base class for all modules (source)
 * \author <NAME> (<EMAIL>)
 */


#include "pulsar/modulebase/ModuleBase.hpp"
#include "pulsar/datastore/Wavefunction.hpp"
#include "pulsar/output/GlobalOutput.hpp"

using pulsar::modulemanager::ModuleManager;
using pulsar::modulemanager::ModuleInfo;
using pulsar::datastore::Wavefunction;
using pulsar::modulemanager::ModuleTreeNode;
using pulsar::datastore::CacheData;
using pulsar::datastore::OptionMap;
using pulsar::exception::GeneralException;


namespace pulsar{
namespace modulebase {


ModuleBase::ModuleBase(ID_t id, const char * modtype)
    : tbts_(output::get_global_output().rdbuf(), nullptr),
      out(&tbts_),
      id_(id), modtype_(modtype), mlocator_(nullptr), treenode_(nullptr)
{
    out.debug("Constructed %? module [%?]\n", modtype, id);
}


ModuleBase::~ModuleBase()
{
    if(treenode_ == nullptr)
        out.debug("Destroying a module that doesn't have a tree node...");
    else
    {
        out.debug("Module [%?] : Output size: %?\n", id(), get_output().size());
        out.debug("Destructed module [%?] : %? v%?\n", id(), name(), version());
        mlocator_->notify_destruction(id());
    }
}



/////////////////////////////
// Basic Info
/////////////////////////////
ID_t ModuleBase::id(void) const noexcept
{
    return id_;
}


std::string ModuleBase::key(void) const
{'fraction_non_alphanumeric': 0.19892086330935252, 'fraction_numerical': 0.0, 'mean_word_length': 3.6818181818181817, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '4604317', 'n_tokens_mistral': 904, 'n_tokens_neox': 888, 'n_words': 189}