Writing about integer sequences and more.
[fic.git] / modules / noPredictor.h
blob84dbc7e819a07e99ee24b09ceefc2c24165340e1
1 #ifndef NOPREDICTOR_HEADER_
2 #define NOPREDICTOR_HEADER_
4 #include "../headers.h"
6 /** Predictor that doesn't predict, just tries all the domains */
7 class MNoPredictor: public IStdEncPredictor {
9 DECLARE_TypeInfo_noSettings( MNoPredictor, "brute force"
10 , "Doesn't predict, tries all possibilities." )
12 public:
13 /** \name IStdEncPredictor interface
14 * @{ */
15 IOneRangePredictor* newPredictor(const NewPredictorData &data)
16 { return new OneRangePredictor( data.poolInfos->back().indexBegin, data.allowRotations ); }
17 void cleanUp() {} // nothing to clean up
18 /// @}
20 protected:
21 /** Predictor class returned when calling #newPredictor
22 * - returns all domains in all rotations in one chunk */
23 class OneRangePredictor: public IOneRangePredictor {
24 int domCount /// the domain count
25 , rotations; ///< the number of rotations used
27 public:
28 OneRangePredictor(int domainCount,bool allowRotations)
29 : domCount(domainCount), rotations( allowRotations ? 8 : 1 ) {}
30 /** \name OneRangePred interface
31 * @{ */
32 Predictions& getChunk(float /*maxPredictedSE*/,Predictions &store) {
33 store.clear();
34 if (domCount) {
35 store.reserve(domCount*rotations);
36 for (int id=0; id<domCount; ++id)
37 for (int r=0; r<rotations; ++r)
38 store.push_back( Prediction(id,r) );
39 domCount= 0;
41 return store;
43 /// @}
44 }; // MNoPredictor::OneRangePredictor class
46 }; // MNoPredictor class
48 #endif