There is one more new concept you need to learn a little about before we explain how to use FARFALLA. As we have seen, in C++ we can create our own data types called classes. It is possible to create new data classes which are inherited from other classes. When we say a class inherits from another class what we mean is that it gets all of the variables and functions that the ``parent'' class has plus any new things that we add.
Make sure you don't confuse the concepts of inheritance with the concepts of FARFALLA trees we talked about earlier. The ``parent'' class that we are referring to here is not the same as a parent of a child in a FARFALLA tree.
Lets look at an example. First recall our definition of the erp class from before:
class erp {
public:
short adc0u; // ADC 0 side Unattenuated
short adc1u; // ADC 1 side Unattenuated
// Note: short is the same as INTEGER*2
float energy; // ERP Energy
}
We are going to make a new class called calibratedErp. calibratedErp should contain everything that erp contained plus some new calibrated information. Here is how we do it:
class calibratedErp: public erp { //make a new class inherited from erp
public:
short pe1; //Photo-electrons side 1
short pe2; //Photo-electrons side 2
}
The line class calibratedErp: public erp is what tells the compiler that the calibratedErp class is inherited from erp. The public has to do with what parts of the data and functions of the class are available to other parts of the program. If you want more details about this you should refer to a C++ book. In addition we have added the variables pe1 and pe2.
So now we can make a variable of type calibratedErp and it will have the data members adc1u, adc0u, energy(inherited from erp) and also pe1 and pe2. Inheritance is one of the central ideas behind FARFALLA. Now that you have a familiarity with these concepts we can look at how FARFALLA works.