Example #1
0
map<string, string> GsaAbstractBase::process_obt_file(std::ifstream &fin_obt, FileManager &file_manager)
{
    map<string, string> grp_2_grp_type;
    //map<string, vector<string> > grp_2_regec_vec;
    string line;
    vector<string> tokens;
    string cur_grp_type;
    int lnum = 0;
    try {
        while(getline(fin_obt, line))
        {
            ++lnum;
            strip_ip(line);
            if (line[0] == '#')
            {
            }
            else if (upper_cp(line.substr(0, 8)) == "OBS_TYPE")
            {
                tokens.clear();
                tokenize(line, tokens, "\t\n\r() ");
                cur_grp_type = tokens[1];
                upper_ip(cur_grp_type);
            }
            //else if (upper_cp(line.substr(0, 8)) == "REGEX")
            //{
            //	tokens.clear();
            //	tokenize(line, tokens, "\t\n\r() ");
            //	string regex_str = tokens[1];
            //	strip_ip(regex_str, "\"");
            //	upper_ip(regex_str);
            //}
            else
            {
                string grp = upper_cp(line);
                grp_2_grp_type[grp] = cur_grp_type;
            }
        }
    }
    catch(exception &e)
    {
        PestFileErrorAccess e_new(file_manager.get_full_filename("obt"), e.what());
        cout << e.what() << endl;
        std::stringstream out;
        out << "Error parsing \"" << file_manager.get_full_filename("obt") << "\" on line number " << lnum << endl;
        e_new.add_back(out.str());
        e_new.raise();
    }
    return grp_2_grp_type;
}
Example #2
0
map<string, string>  GsaAbstractBase::process_gsa_file(ifstream &fin, FileManager &file_manager)
{
    map<string, string> arg_map;
    string line;
    int lnum = 0;
    try {
        while(getline(fin, line))
        {
            ++lnum;
            strip_ip(line);
            if (line[0] == '#')
            {
            }
            else
            {
                string line_upper = upper_cp(line);
                parce_line(line_upper, arg_map);
            }
        }
    }
    catch (PestConversionError &e) {
        std::stringstream out;
        out << "Error parsing \"" << file_manager.get_full_filename("gsa") << "\" on line number " << lnum << endl;
        out << e.what() << endl;
        e.add_front(out.str());
        e.raise();
    }
    return arg_map;
}