The basic process of using the music class is to create it, specify to it the music that you wish to look for in a set of rows, tell it to process the rows and then obtain the results.
We now describe this in more detail. First create an instance of the music class, specifying to it the number of bells you wish to work with:
music mu(5);
Now specify the music that you are looking for via the music details class (see Expression Language for how to do this). The music class behaves like a vector<music_details>
structure so you can access the elements individually before and after. To add a music specification, do something like this:
music_details md("*45"); mu.push_back(md);
If you want, more can be added in the same way or by modifying md and pushing the new structure onto the back of the music list:
md.set("*345*"); mu.push_back(md);
Now you can supply the music class with rows to search against the specified music (note pbdoubles is a vector<row>)
mu.process_rows(pbdoubles.begin(), pbdoubles.end());
Now you can obtain the results from the music class. You can do this in several ways. The first is to obtain the overall total score, for both strokes, or for one:
cout << "Total Score: " << mu.get_score() << endl; cout << "Total Score (Backstroke): " << mu.get_score(eBackStroke) << endl;
The second way is to obtain results for individual items:
music::const_iterator k; for (k = mu.begin(); k != mu.end(); k++) cout << "Total for " << k->get() << ": " << t->count() << " : " << k->total() << endl;
This produces three columns, the first is the music expression that was searched for, the second is the number of matches, the third is the number of matches based on the score. See the Music_Details class for more details on these functions.