File: keywordslines.cc

package info (click to toggle)
simrisc 16.05.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,877; fortran: 665; makefile: 112; ansic: 112; sh: 107
file content (29 lines) | stat: -rw-r--r-- 1,087 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#define XERR
#include "parser.ih"

// static
LineInfoVect const &Parser::keywordsLines(StringVect const &keywords)
{
    Map const *mapPtr = &s_map;
    Map::const_iterator mapIter;

            // E.g., Scenario: iterator: returns the pointer to the Parser
            //  at Scenario's iterator: specification

    for (auto const &keyword: keywords)         // visit the range of keywords
    {
        mapIter = mapPtr->find(keyword);        // ptr to Map::value_type

        if (mapIter == mapPtr->end())       // internal error: throw exception
            throw Exception{} << "Internal error: keyword `" << keyword <<
                                 "' not configured";

        mapPtr = &mapIter->second->d_map;       // use the next keyword
    }

    // with Scenario: death: this is just one line, which may be empty,
    //  in which case it's followed by 101 cumulative death probabilities
    //  or it may contain one word, which is the name of the file containing
    //  the specifications
    return mapIter->second->d_lines;            // return the LineInfoVect
}