Changeset cb991cf in tol


Ignore:
Timestamp:
Mar 15, 2012, 9:43:19 AM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
2c058e5
Parents:
a9c6a36
Message:

Fixes #1470 (trunk)
If Ois.ForceStoredTimeSet is true, then internally stored TimeSet's will be used even if a TimeSet with the same name is available.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@4388 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol/OIS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tol/OIS/ois.cpp

    ra9c6a36 rcb991cf  
    6565size_t BOis::_MaxBlockLength_    = 1024*1024;
    6666int    BOis::_NumAuxiliarBuffer_ = 9;
     67
     68BDat BOis::forceStoredTimeSet_ = 0;
    6769
    6870#ifdef TRACE_OIS_FILE
  • tol/OIS/oisapitol.cpp

    ra9c6a36 rcb991cf  
    216216  );
    217217  OIS_def_BAE_->PutConstant();
     218
     219  BParamDat* ois_forceStoredTimeSet_= new BParamDat
     220  (
     221    "Ois.ForceStoredTimeSet",
     222    forceStoredTimeSet_,
     223    I2("If true then internally stored TimeSet's will be used even if a "
     224       "TimeSet with the same name is available.",
     225       "Si es cierto se usarán siempre los TimeSet alamcenados localmente "
     226       "incluso si está accesible otro con el mismo nombre.")
     227  );
    218228
    219229  loadModeOptions_.AllocBuffer(3);
  • tol/OIS/oisloader.cpp

    ra9c6a36 rcb991cf  
    5959    if(obj->OisOffset() && (obj->OisOffset()!=offset_))
    6060    {
    61       ::Warning(I2("OIS Object already has assigned offset",
    62                    "El objecto OIS ya tiene offset asignado")+
    63                 ": "+obj->Identify());
     61      if(obj->Grammar()!=GraTimeSet() || forceStoredTimeSet_)
     62      {
     63        ::Warning(I2("OIS Object already has assigned offset",
     64                     "El objecto OIS ya tiene offset asignado")+
     65                  ": "+obj->Identify());
     66      }
    6467      return(obj);
    6568    }
    … …  
    13101313          BUserTimeSerie* x = NULL; 
    13111314          List* tree = NULL;
     1315          BText expr = "";
     1316          BUserTimeSet* dating = NULL;
     1317          BDate first, last, beginCache, endCache;
    13121318          if(!offset)
    13131319          {
    … …  
    13201326            object_->SetPos(offset);
    13211327            //CALL ReadNextObject
    1322             BUserTimeSet* dating = NULL;
    13231328            {
    13241329              BINT64 offset_tms = object_->Offset();
    … …  
    13281333                return(NullError("FATAL cannot built dating of serie"));
    13291334              }
    1330               dating = (BUserTimeSet*)GraTimeSet()->FindOperand(r->Name(), false);
    1331               if(!dating) { dating = (BUserTimeSet*)r; }
    1332               else if(dating!=r)       
     1335              if(forceStoredTimeSet_!=0)
     1336              {
     1337                dating = (BUserTimeSet*)r;
     1338              }
     1339              else
    13331340              {
    1334                 static BOffsetObject ofob_tms;
    1335                 ofob_tms.PutOffset(offset_tms);
    1336                 int found_tms = readed_.FindSorted(ofob_tms, CompareOffset);
    1337                 readed_[found_tms].ReplaceObject(dating);
    1338                 DESTROY(r);
    1339               } 
    1340             }
    1341             BDate first, last, beginCache, endCache;
     1341                dating = (BUserTimeSet*)GraTimeSet()->FindOperand(r->Name(), false);
     1342                if(!dating) { dating = (BUserTimeSet*)r; }
     1343                else if(dating!=r)       
     1344                {
     1345                  static BOffsetObject ofob_tms;
     1346                  ofob_tms.PutOffset(offset_tms);
     1347                  int found_tms = readed_.FindSorted(ofob_tms, CompareOffset);
     1348                  readed_[found_tms].ReplaceObject(dating);
     1349                  DESTROY(r);
     1350                } 
     1351              }
     1352            }
    13421353            ERead(first, serie_);
    13431354            ERead(last,  serie_);
    … …  
    13581369                       name+"' description='"+description+"')"));
    13591370              }
     1371              expr = BParser::Unparse(tree,"  ","\n");
    13601372              bool oldEnabled = BOut::Disable();
     1373              BGrammar::IncLevel();
    13611374              x = (BUserTimeSerie*)GraSerie()->EvaluateTree(tree);
     1375              BGrammar::DecLevel();
    13621376              if(oldEnabled) { BOut::Enable(); }
    13631377              if(x)
    … …  
    13681382              else
    13691383              {
    1370                 BText expr = BParser::Unparse(tree,"  ","\n");
    13711384                expr = Compact(expr);
    13721385               #ifndef NDEBUG
    … …  
    13931406          else               
    13941407          { result = x; }
     1408          BUserTimeSerie* ser = (BUserTimeSerie*)result;
     1409          if(dating!=ser->Dating())
     1410          {
     1411            if(forceStoredTimeSet_!=0)
     1412            {
     1413              ser->PutDating(dating);
     1414            }
     1415            if(!dating->IsCompatibleWith(*(ser->Dating()),beginCache,endCache))
     1416            {
     1417              Warning(BText("Dating of loaded Serie ")+name+"="+expr+
     1418                            "is not compatible with original dating "+
     1419                            dating->Identify()+"="+dating->Expression()+" "+
     1420                            "between ["+beginCache+","+endCache+"]");
     1421            } 
     1422          } 
    13951423          if(tree)
    13961424          {
    … …  
    14131441          BHash h(s);
    14141442          Ensure(Read(h.GetBuffer(),sizeof(double),h.Size(),timeset_));
     1443          BUserTimeSet* x_old = (BUserTimeSet*)GraTimeSet()->FindOperand(name,true);
    14151444          BUserTimeSet* x = NULL;
    14161445          char loadTree;
    14171446          ERead(loadTree,timeset_);
    14181447          List* tree = NULL;
     1448          BText expr;
    14191449          if(loadTree)
    14201450          {
    14211451            tree = ReadTree(timeset_);
     1452            expr = Compact(BParser::Unparse(tree,"  ","\n"));
    14221453            if(!tree)
    14231454            {
    … …  
    14251456                     name+"' description='"+description+"')"));
    14261457            }
     1458          }
     1459          if(!forceStoredTimeSet_ && x_old)
     1460          {
     1461            x = x_old;
     1462          }
     1463          else if(tree)
     1464          {
    14271465            bool oldEnabled = BOut::Disable();
    14281466            BDat numErr0 = TOLErrorTryNumber();
     1467            BGrammar::IncLevel();
    14291468            x = (BUserTimeSet*)GraTimeSet()->EvaluateTree(tree);
     1469            BGrammar::DecLevel();
    14301470            BDat numErr1 = TOLErrorTryNumber();
    14311471            if(numErr0<numErr1) { DESTROY(x); }
    … …  
    14421482              }
    14431483            }
    1444             else
    1445             {
    1446               x = (BUserTimeSet*)GraTimeSet()->FindOperand(name,true);
    1447               if(!x)
    1448               {
    1449                 BText expr = Compact(BParser::Unparse(tree,"  ","\n"));
    1450                 if(name.HasName()) { expr = name+" = "+expr; }
    1451                 Warning(BText("Cannot rebuild virtual expression of non "
    1452                         "bounded TimeSet ")+expr+ "\nOnly cached "
    1453                         "dates will be accessible between ["+beginCache+","+
    1454                         endCache+"]\nTo avoid this problem save just "
    1455                         "bounded time sets or use expressions that could "
    1456                         "be evaluated at OIS loading time." );
    1457               }
     1484            else
     1485            {
     1486              if(name.HasName()) { expr = name+" = "+expr; }
     1487              Warning(BText("Cannot rebuild virtual expression of non "
     1488                      "bounded TimeSet ")+expr+ "\nOnly cached "
     1489                      "dates will be accessible between ["+beginCache+","+
     1490                      endCache+"]\nTo avoid this problem save just "
     1491                      "bounded time sets or use expressions that could "
     1492                      "be evaluated at OIS loading time." );
    14581493            }
    14591494          }
    … …  
    14731508          if(tree)
    14741509          {
    1475             if(result && !result->GetOisTree()) { result->PutOisTree(tree); }
     1510            if(result && (x!=x_old) && !result->GetOisTree())
     1511            {
     1512              result->PutOisTree(tree);
     1513            }
    14761514            tree->Destroy();
    14771515          }
  • tol/OIS/tol_ois.h

    ra9c6a36 rcb991cf  
    565565  static bool isLittleEndian_;
    566566
     567//Default for forcing stored TimeSet
     568  static BDat forceStoredTimeSet_;
     569
    567570  static BStruct*  addressStr_;
    568571  static BStruct*  docStr_;
Note: See TracChangeset for help on using the changeset viewer.