Fixed wrong prediction for incomplete ranges.
[fic.git] / interfaces.cpp
blob106ebca554d0c2796976c5b8dcad9528f00b3ce6
1 #include "headers.h"
2 #include "fileUtil.h"
4 using namespace std;
6 bool IRoot::allSettingsToFile(const char *fileName) {
7 try {
8 ofstream file( fileName, ios_base::binary|ios_base::trunc|ios_base::out );
9 file.exceptions( ifstream::eofbit | ifstream::failbit | ifstream::badbit );
10 put( file, SettingsMagic );
11 file_saveAllSettings(file);
12 return true;
13 } catch(exception &e) {
14 return false;
18 bool IRoot::allSettingsFromFile(const char *fileName) {
19 ASSERT(getMode()==Clear);
20 try {
21 ifstream file( fileName, ios_base::binary|ios_base::in );
22 file.exceptions( ifstream::eofbit | ifstream::failbit | ifstream::badbit );
23 if (get<Uint16>(file)!=SettingsMagic)
24 return false;
25 file_loadAllSettings(file);
26 return true;
27 } catch(exception &e) {
28 return false;
33 void IQuality2SE::regularRangeErrors( float quality, int levelEnd, float *errors ) {
34 ASSERT( checkBoundsFunc<float>(0,quality,1)==quality && levelEnd>2 && errors );
36 float (IQuality2SE::*func)(float,int)= &IQuality2SE::rangeSE;
38 for (int level=0; level<levelEnd; ++level)
39 errors[level]= (this->*func)( quality, powers[level*2] );