blob: d015b942c72b67f7274cad1e936371a98a1ed46e (
plain)
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
|
// $Id$
#ifndef _SCORE_INDEX_MANAGER_H_
#define _SCORE_INDEX_MANAGER_H_
#include <iostream>
#include <vector>
class ScoreProducer;
class ScoreComponentCollection; // debugging only
/** Keep track of scores and score producers. Each score producer is reserved contiguous set of slots
* to put their score components. All the score components are arranged in a vector with no gaps.
* Only 1 ScoreIndexManager object should be instantiated
*/
class ScoreIndexManager
{
friend std::ostream& operator<<(std::ostream& os, const ScoreIndexManager& sim);
public:
ScoreIndexManager() : m_last(0) {}
//! new score producer to manage. Producers must be inserted in the order they are created
void AddScoreProducer(const ScoreProducer* producer);
//! starting score index for a particular score producer with scoreBookkeepingID
size_t GetBeginIndex(size_t scoreBookkeepingID) const { return m_begins[scoreBookkeepingID]; }
//! end score index for a particular score producer with scoreBookkeepingID
size_t GetEndIndex(size_t scoreBookkeepingID) const { return m_ends[scoreBookkeepingID]; }
//! sum of all score components from every score producer
size_t GetTotalNumberOfScores() const { return m_last; }
//! ??? print unweighted scores of each ScoreManager to stream os
void Debug_PrintLabeledScores(std::ostream& os, const ScoreComponentCollection& scc) const;
//! ??? print weighted scores of each ScoreManager to stream os
void Debug_PrintLabeledWeightedScores(std::ostream& os, const ScoreComponentCollection& scc, const std::vector<float>& weights) const;
private:
ScoreIndexManager(const ScoreIndexManager&); // don't implement
std::vector<size_t> m_begins;
std::vector<size_t> m_ends;
std::vector<const ScoreProducer*> m_producers; /**< all the score producers in this run */
size_t m_last;
};
#endif
|