File: headerdata.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 (124 lines) | stat: -rw-r--r-- 5,152 bytes parent folder | download
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//#define XERR
#include "loop.ih"


//  woman, death cause, death age, tumor present, tumor detected, tumor is
// interval, tumor diameter, tumor self-detect age, tumor death age, tumor
// doubling time, tumor onset age, tumor preclinical period, natural death age,
// death status, costs, self detected, round detected, screening rounds, TNM

    // round headers are set by modalities/roundheaders.cc

    // by gencases.cc

CSVTable Loop::headerData(size_t iter) const
{
    CSVTable tab{ outStream(d_options.dataFile(), iter), "  " };

    if (not tab.stream())           // tab.stream(): the stream to write the
        return tab;                 //      data to.

    labels(tab.stream());

    ostream &out = tab.stream();    // write the status legenda
    out << "exit status legend:\n";
    for (size_t status = NATURAL_PRE; status != Status_END; ++status)
        out << setw(5) << status << ": " << s_status[status] << '\n';

    out << "'detected by' legend:\n";
    d_modalities.legend(out);

        // the fmt() insertions define the widths of the columns, 
        // not their header labels. Blanks are ignored, hence 'costs67890'
        // case  cause  age  natural  status  present  detected  interval
        // 1     2      3    4        4       6        7         8
        // diameter days  period  onset  self-detect  death
        // 9        10    11      12     13           14
        // costs  self  by  round  rounds  TNM
        // 15     16    17  18     19      20 
        //              **

        // define the 20 fields of the table
    tab.fmt() <<  right(7) <<                                   //  1
                  "Natural" << right("100.12", 2) <<            //  2 -  3
                  "natural" << "status" <<                      //  4 -  5
                  "present" << "detected" << "interval" <<      //  6 -  8
                  "diameter" << "doubling" << "preclinical" <<  //  9 - 11

                                           //  death:
                  "onset" << "self-detect" << "100.00" <<       // 12 - 14
                  "costs67890" <<                               // 15

                "biop567" << "self" << "by" << "round" <<       // 15-pre - 18
                    right(d_nRounds > 10 ? d_nRounds : 10) <<   // 19
                    right(5);                                   // 20

        // the top ine
    tab << hline();

        // the 1st text line + covering hline                   // 6 - 14
    tab.row(5) << hline(9);

        // the 2nd text line + covering hlines
    tab.row(1) <<                                               //  1
            join(4, FMT::CENTER) << "death" <<                  //  2 -  5
            join(6, FMT::RIGHT) << ' ' <<                       //  6 -  11
            ' ' <<                                              // 12
            join(2, FMT::CENTER) << "age" <<                    // 13 - 14
            join(2, FMT::CENTER) << "costs" <<                  // 15 15-pre
            join(3, FMT::CENTER) << "detected";                 // 16 - 18


        // the 3rd text line + covering hlines
    tab.row(1) <<                                               //  1
            hline(4) <<                                         //  2 -  5
            join(4, FMT::RIGHT) << ' ' <<                       //  6 -  9
            "doubling" << "preclinical" << ' ' <<               // 10 - 12
            hline(2) <<                                         // 13 - 14
            hline(2) <<                                         // 15 15-pre 
            hline(3) << "screening";                            // 16 - 18

        // the 4th text line
    tab << "case" <<                                            //  1
            "cause" << "age" <<                                 //  2 -  3
            "natural" << "status" <<                            //  4 -  5
            "present" << "detected" << "interval" <<            //  6 -  8
            "diameter" << "days" << "period" <<                 //  9 - 11
            "onset" << "self-detect" << "death" <<              // 12 - 14
            "screening" <<                                      // 15
            "biop" <<                                           // 15-pre
            "self" << "by" << "round" << "rounds" <<  "TNM";    // 16 - 20

        // the bottom hline
    tab << hline();

    tab.sep(", ");

    return tab;
}

//         out <<
// 1           " woman, "
// 2           "death cause, "
// 3           "death age, "
// 4           "tumor present, "
// 5           "tumor detected, "
// 6           "tumor is interval, "
// 7           "tumor diameter, "

// 8  11       "tumor self-detect age, "
// 9  12       "tumor death age, "
// 10 8        "tumor doubling time, "
// 11 10       "tumor onset age, "
// 12 9        "tumor preclinical period, "

// 13          "natural death age, "
// 14          "death status, "
// 15          "costs, "
// 16          "self detected, "
// 17          "by detected, "
// 18          "round detected, "
// 19          "screening rounds, "
// 20          "TNM, "
//             "\n";
//     }