<commit_before>/*
 * Program.cpp
 *
 *  Created on: 08.03.2016
 *      Author: hartung
 */

#include "initialization/MainFactory.hpp"
#include "initialization/Program.hpp"
#include "initialization/XMLConfigurationReader.hpp"
#include "simulation/AbstractSimulation.hpp"

#ifdef USE_MPI
#include <mpi.h>
#endif

#ifdef USE_NETWORK_OFFLOADER
#include "InitialNetworkServer.hpp"
#include "NetworkFunctions.hpp"
#endif

namespace Initialization
{
    Program::Program(const CommandLineArgs & cla)
            : _isInitialized(false),
              _usingMPI(false),
              _usingOMP(false),
              _commandLineArgs(cla),
              _pp(),
              _simulations()
    {
    }

    Program::Program(int* argc, char** argv[])
            : _isInitialized(false),
              _usingMPI(false),
              _usingOMP(false),
              _commandLineArgs(CommandLineArgs(argc, argv)),
              _pp(),
              _simulations()
    {
    }

    Program::~Program()
    {
        if (_isInitialized)
            deinitialize();
    }

    void Program::initialize()
    {
        if (_isInitialized)
            return;
        Util::Logger::initialize(_commandLineArgs.getLogSettings());
        //create simulation plan, i.e. multiple simulation plans if mpi should be used (for each mpi process one plan)
        // read config file:
        XMLConfigurationReader reader(_commandLineArgs.getConfigFilePath());
        _pp = reader.getProgramPlan();
<commit_msg>Make use of constructor delegation<commit_after>/*
 * Program.cpp
 *
 *  Created on: 08.03.2016
 *      Author: hartung
 */

#include "initialization/MainFactory.hpp"
#include "initialization/Program.hpp"
#include "initialization/XMLConfigurationReader.hpp"
#include "simulation/AbstractSimulation.hpp"

#ifdef USE_MPI
#include <mpi.h>
#endif

#ifdef USE_NETWORK_OFFLOADER
#include "InitialNetworkServer.hpp"
#include "NetworkFunctions.hpp"
#endif

namespace Initialization
{

    Program::Program(const CommandLineArgs & cla)
            : _isInitialized(false),
              _usingMPI(false),
              _usingOMP(false),
              _commandLineArgs(cla),
              _pp(),
              _simulations()
    {
    }

    Program::Program(int* argc, char** argv[])
            : Program::Program(CommandLineArgs(argc, argv))
    {
    }

    Program::~Program()
    {
        if (_isInitialized)
            deinitialize();
    }

    void Program::initialize()
    {
        if (_isInitialized)
            return;
        Util::Logger::initialize(_commandLineArgs.getLogSettings());
        //create simulation plan, i.e. multiple simulation plans if mpi should be used (for each mpi process one plan)
        // read config file:
        XMLConfigurationReader reader(_commandLineArgs.getConfigFilePath());
        _pp = reader.getProgramPlan();

{'fraction_non_alphanumeric': 0.10919943820224719, 'fraction_numerical': 0.0056179775280898875, 'mean_word_length': 2.57465495608532, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4601869', 'n_tokens_mistral': 813, 'n_tokens_neox': 801, 'n_words': 167}