<commit_before>/*
 * Method.cpp
 *
 *  Created on: Jan 6, 2017
 *      Author: wfg
 */


#include "core/Method.h"
#include "functions/adiosFunctions.h"


namespace adios
{


Method::Method( const std::string name, const bool debugMode ):
    m_Name{ name },
    m_DebugMode{ debugMode }
{
    // m_Type can stay empty (forcing the choice of the default engine)
    m_nThreads = 1;
}


Method::~Method( )
{ }

bool isUserDefined()
{
    return false; //TODO: check if XML has the method defined
}

void Method::SetEngine( const std::string type )
{
    m_Type = type;
}

void Method::AllowThreads( const int nThreads )
{
    if (nThreads > 1)
        m_nThreads = nThreads;
    else
        m_nThreads = 1;
}


//PRIVATE Functions
void Method::AddTransportParameters( const std::string type, const std::vector<std::string>& parameters )
{
    if( m_DebugMode == true )
    {
        if( type.empty() || type.find("=") != type.npos )
            throw std::invalid_argument( "ERROR: first argument in AddTransport must be a single word for transport\n" );
    }

    std::map<std::string, std::string> mapParameters = BuildParametersMap( parameters, m_DebugMode );
    if( m_DebugMode == true )
    {
        if( mapParameters.count("transport") == 1 )
            std::invalid_argument( "ERROR: transport can't be redefined with \"transport=type\", "
                                   "type must be the first argument\n" );
    }

    mapParameters["transport"] = type;
    m_TransportParameters.push_back( mapParameters );
}



} //end namespace


<commit_msg>fix the same function name again<commit_after>/*
 * Method.cpp
 *
 *  Created on: Jan 6, 2017
 *      Author: wfg
 */


#include "core/Method.h"
#include "functions/adiosFunctions.h"


namespace adios
{


Method::Method( const std::string name, const bool debugMode ):
    m_Name{ name },
    m_DebugMode{ debugMode }
{
    // m_Type can stay empty (forcing the choice of the default engine)
    m_nThreads = 1;
}


Method::~Method( )
{ }

bool Method::isUserDefined()
{
    return false; //TODO: check if XML has the method defined
}

void Method::SetEngine( const std::string type )
{
    m_Type = type;
}

void Method::AllowThreads( const int nThreads )
{
    if (nThreads > 1)
        m_nThreads = nThreads;
    else
        m_nThreads = 1;
}


//PRIVATE Functions
void Method::AddTransportParameters( const std::string type, const std::vector<std::string>& parameters )
{
    if( m_DebugMode == true )
    {
        if( type.empty() || type.find("=") != type.npos )
            throw std::invalid_argument( "ERROR: first argument in AddTransport must be a single word for transport\n" );
    }

    std::map<std::string, std::string> mapParameters = BuildParametersMap( parameters, m_DebugMode );
    if( m_DebugMode == true )
    {
        if( mapParameters.count("transport") == 1 )
            std::invalid_argument( "ERROR: transport can't be redefined with \"transport=type\", "
                                   "type must be the first argument\n" );
    }

    mapParameters["transport"] = type;
    m_TransportParameters.push_back( mapParameters );
}



} //end namespace



{'fraction_non_alphanumeric': 0.1238488409018736, 'fraction_numerical': 0.0057161003493172435, 'mean_word_length': 2.8985148514851486, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1314187', 'n_tokens_mistral': 1014, 'n_tokens_neox': 968, 'n_words': 275}