File: addmodality.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 (56 lines) | stat: -rw-r--r-- 1,854 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#define XERR
#include "screening.ih"

bool Screening::addModality(istream &in, Round &round)
{
    string modality;                        // determine the modalities to use

    while (in >> modality)
    {
        Err::Context context;

        if (uint16_t idx = d_modalities.find(modality); idx == UNDEFINED)
            context = Err::UNDEFINED_MODALITY;


            // -------------------------------------------
            // lungCancer      CT      action
            // -------------------------------------------
            //     0           0       add
            //     0           1       BC_CT_INVALID
            //     1           0       LC_INVALID_MODALITY
            //     1           1       add
            // -------------------------------------------
                                            // if LC simulation is requested
                                            // but no CT modality requested
        else if (d_lungCancer and modality != "CT")
        {
            Err::msg(Err::LC_INVALID_MODALITY) << modality << endl;
            return false;
        }
                                            // BC simulation and CT is spec'd
        else if (not d_lungCancer and modality == "CT")
            context = Err::BC_CT_INVALID;
        else
        {
            // TODO: the last entry in d_roundVect (may still be empty)
            //       may not contain modality 'idx'
            if (round.add(idx))
            {
                d_modalities.activate(modality);
                continue;
            }

            context = Err::MODALITY_REPEATED;
        }

        Err::msg(context) << modality << endl;
        return false;

    }

    return true;
}

//        if ((this->*d_checkCT)(modality))   // issue one warning if CT is
//            continue;                       // not specified