Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ScoreProducer.h « src « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bd56a7a0dbcebbfe6ede8cfe3b084c9115b3de03 (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
// $Id$

#ifndef _SCORE_PRODUCER_H_
#define _SCORE_PRODUCER_H_

#include <string>

class ScoreIndexManager;

// to keep track of the various things that can produce a score,
// we use this evil implementation-inheritance to give them each
// a unique, sequential (read: good for vector indices) ID
//
// NOTE- do not confuse this with a producer/consumer pattern.
// this is not a producer in that sense.
class ScoreProducer
{
private:
	static unsigned int s_globalScoreBookkeepingIdCounter;
	unsigned int m_scoreBookkeepingId;

	ScoreProducer(const ScoreProducer&);  // don't implement
protected:
	// it would be nice to force registration here, but some Producer objects
	// are constructed before they know how many scores they have
	ScoreProducer();
	virtual ~ScoreProducer();

public:
	unsigned int GetScoreBookkeepingID() const { return m_scoreBookkeepingId; }

	//! returns the number of scores that a subclass produces.
	// For example, a language model conventionally produces 1, a translation table some arbitrary number, etc
	virtual unsigned int GetNumScoreComponents() const = 0;

	//! returns a string description of this producer
	virtual const std::string GetScoreProducerDescription() const = 0;
};

#endif