A user who wishes to define their own criteria can do so by inserting code in “SRC/Result/predfinedCriteria.cpp” source file and re-compiling the library. Three areas are to be modified:
The integer ID associated with the criterion must first be defined. This is done by inserting the appropriate “#define” statement at the beginning. For example:
#define UD_criterion_1 20001
#define UD_criterion_2 20002
#define UD_criterion_3 20003
#define UD_criterion_4 20004
// ...
where all user criteria are assumed to be prefixed with the “UD_” string. (It is advised to prefix the criteria following this kind of convention to reduce the risk of clash with someone else’s criterion.)
Then, at the beginning of the “result::calcPredefinedCriterion” method, the mapping between criteria names and integer IDs must be built (“critNameIds” variable). This is currently done by the following C++ lines:
if (bFirstHere) {
critNameIds.insert(make_pair("HoneycombAirbusMoS",HoneycombAirbusMoS));
critNameIds.insert(make_pair("HoneycombAirbusSR",HoneycombAirbusSR));
critNameIds.insert(make_pair("VonMisesMoS",VonMisesMoS));
critNameIds.insert(make_pair("VonMisesSR",VonMisesSR));
critNameIds.insert(make_pair("SGI_SR",SGI_SR));
critNameIds.insert(make_pair("UD_criterion_1",UD_criterion_1));
critNameIds.insert(make_pair("UD_criterion_2",UD_criterion_2));
critNameIds.insert(make_pair("UD_criterion_3",UD_criterion_3));
critNameIds.insert(make_pair("UD_criterion_4",UD_criterion_4));
// ...
}
(Here again, the User is allowed to change the criteria name and associated integer variable names.)
Finally, the new criterion “case” must be defined in the “switch(critId)” case. The case integer ID corresponds to the integer value defined with “#define” statement. The tough part of the job is to write the appropriate C++ source code. It is hoped that the criteria already defined will serve as a source of inspiration for developers.