The data is grouped into tracks where a new track starts after each line break as shown above (in the actual data there are thousands of tracks). Notice that each track has a varying number of lines. Each line contains four entries that correspond to Energy, x-position, y-position and z-position. I am trying to write a program that will take this data and sort it into a group of three classes using composition. The three classes will be written as follows:
class Step
{
public:
float m_energy;
float m_xpos;
float m_ypos;
float m_zpos;
}
class Tracks
{
Step *m_steps;
int m_num_steps;
}
class DB
{
Tracks *m_tracks;
int m_num_tracks;
}
The first class will contain the lines which are composed of energy, and the x,y and z positions. The second class (Tracks) will contain a collection of the lines which form the tracks. The final class (DB), the full data base class, will contain the entire data set which is the collection of the tracks. I am very new to object oriented programming so any ideas on how to approach this problem would be greatly appreciated.