File: setproportion.cc

package info (click to toggle)
simrisc 16.06.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,889; fortran: 669; makefile: 112; ansic: 112; sh: 107
file content (27 lines) | stat: -rw-r--r-- 822 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
#define XERR
#include "costs.ih"

void Costs::setProportion(bool lungCancer)
{
    d_base.back() = "proportion:";

    LineInfo const *lineInfo = Parser::one(d_base).get();
    istringstream in{ lineInfo->tail };            // get the line's tail

    if (not (in >> d_discountProportion))
    {
        Err::msg(Err::SPEC_ERROR) << 
            "[Costs:] proportion: must specify at least one value" << endl;
        return;
    }
                                                    // at LC simulations:
    if (lungCancer)                                 // maybe a 2nd proportion?
    {
        double prop2;
        if (in >> prop2)                            // if so, use it 
            d_discountProportion = prop2;           
    }

    if (not Globals::proportion(d_discountProportion))
        Err::range();
}