Changeset 83c5220 in tol


Ignore:
Timestamp:
May 9, 2011, 2:26:59 PM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
9d29ae0
Parents:
b4aa879
Message:

Refs #1199
Making optional BFSMEM system

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

Location:
tol
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • tol/bbasic/cor.cpp

    rb4aa879 r83c5220  
    5757}
    5858
     59#if (__USE_POOL__!=__POOL_BFSMEM__)
     60
     61BCore::MemAssignInfo::MemAssignInfo(BCore* address)
     62{
     63  SetAddress(address);
     64}
     65
     66void BCore::MemAssignInfo::SetAddress(BCore* address)
     67{
     68  address_ = address; 
     69  size_    = 0;
     70  pageNum_ = 0;
     71}
     72
     73short BCore::MemAssignInfo::IsAssigned()
     74{
     75  return(-1);
     76}
     77
     78void BCore::MemAssignInfo::SafeDestroy()
     79{
     80}
     81
     82#else
    5983
    6084BCore::MemAssignInfo::MemAssignInfo(BCore* address)
    … …  
    98122  }
    99123}
     124
     125#endif
  • tol/bbasic/tol_bcore.h

    rb4aa879 r83c5220  
    5959    //See on tol_bfsmem.h a sample of Memory Handler
    6060    virtual short IsAssigned() const { return(-1); }
    61 #if (__USE_POOL__==__POOL_BFSMEM__)
    62     virtual BFixedSizeMemoryBase* GetMemHandler() const { return(NULL); }
    63     virtual unsigned short  GetPageNum   () const { return(0); }
    64     virtual size_t GetSizeOf() const { return(0); }
    6561    struct TOL_API MemAssignInfo
    6662    {
    … …  
    7470      void SafeDestroy();
    7571    };
    76 #else
    77     struct TOL_API MemAssignInfo
    78     {
    79       short IsAssigned() { return(-1); }
    80       void SafeDestroy() { }
    81       MemAssignInfo(BCore* adress) { }
    82     };
     72#if (__USE_POOL__==__POOL_BFSMEM__)
     73    virtual BFixedSizeMemoryBase* GetMemHandler() const { return(NULL); }
    8374#endif
     75    virtual unsigned short  GetPageNum   () const { return(0); }
     76    virtual size_t GetSizeOf() const { return(0); }
    8477};
    8578
  • tol/btol/bgrammar/nameblock.cpp

    rb4aa879 r83c5220  
    5858      BRequiredPackage    BNameBlock::globalRequiredPackages_;
    5959
     60#if (__USE_POOL__==__POOL_BFSMEM__)
    6061static BFixedSizeMemoryBase* BFSMEM_Hndlr =
    6162 BFSMSingleton<sizeof(BNameBlock)>::Handler();
    62 
     63#endif
    6364static BStruct* strNameBlockMemberInfo_  = NULL;
    6465static BStruct* strClassMemberInfo_  = NULL;
    … …  
    128129  SetEmptyKey(public_ ,NULL);
    129130  SetEmptyKey(private_,NULL);
     131#if (__USE_POOL__==__POOL_BFSMEM__)
    130132  short isAssigned = BFSMEM_Hndlr->IsAssigned(this,this->_bfsm_PageNum__);
     133#else
     134  short isAssigned = -1;
     135#endif
    131136  createdWithNew_ = isAssigned==1;
    132137}
    … …  
    152157  SetEmptyKey(public_ ,NULL);
    153158  SetEmptyKey(private_,NULL);
     159#if (__USE_POOL__==__POOL_BFSMEM__)
    154160  short isAssigned = BFSMEM_Hndlr->IsAssigned(this,this->_bfsm_PageNum__);
     161#else
     162  short isAssigned = -1;
     163#endif
    155164  createdWithNew_ = isAssigned==1;
    156165}
    … …  
    174183  startedPackage(false)
    175184{
     185#if (__USE_POOL__==__POOL_BFSMEM__)
    176186  short isAssigned = BFSMEM_Hndlr->IsAssigned(this,this->_bfsm_PageNum__);
     187#else
     188  short isAssigned = -1;
     189#endif
    177190  createdWithNew_ = isAssigned!=-1;
    178191  *this = ns;
    … …  
    277290//--------------------------------------------------------------------
    278291{
     292#if (__USE_POOL__==__POOL_BFSMEM__)
    279293  if(createdWithNew_)
    280294  {
    … …  
    282296    return(isAssigned);
    283297  }
    284   else               
     298  else       
     299#endif       
    285300  {
    286301    return(true);
    … …  
    321336//--------------------------------------------------------------------
    322337{
     338#if (__USE_POOL__==__POOL_BFSMEM__)
    323339  if(current_ &&
    324340     current_->createdWithNew_ &&
    … …  
    328344    current_ = NULL;
    329345  }
     346#endif
    330347  return(current_);
    331348}
    … …  
    344361//--------------------------------------------------------------------
    345362{
     363#if (__USE_POOL__==__POOL_BFSMEM__)
    346364  if(building_ &&
    347365     building_->Contens().createdWithNew_ &&
    … …  
    353371    building_ = NULL;
    354372  }
     373#endif
    355374  return(building_);
    356375}
  • tol/btol/bgrammar/syn.cpp

    rb4aa879 r83c5220  
    461461}
    462462
     463
    463464//--------------------------------------------------------------------
    464465union BIntPointerMask
    … …  
    468469  const BSyntaxObject*        obj_;
    469470  const BGrammar*             gra_;
     471#if (__USE_POOL__==__POOL_BFSMEM__)
    470472  const BFixedSizeMemoryBase* mhn_;
     473#endif
    471474};
    472475
    … …  
    496499     (sizeof(objMask.obj_) == size) &&
    497500     (objMask.obj_->GetPageNum() == pageNum)&&
     501#if (__USE_POOL__==__POOL_BFSMEM__)
    498502     (objMask.obj_->GetMemHandler() == mhnMask.mhn_)&&
     503#endif
    499504     (objMask.obj_->IsAssigned()!=0))
    500505  {
    … …  
    518523  objMask.obj_ = this;
    519524  graMask.gra_ = Grammar();
     525#if (__USE_POOL__==__POOL_BFSMEM__)
    520526  mhnMask.mhn_ = GetMemHandler();
     527#endif
    521528  int mode = Mode();
    522529  int size = sizeof(this);
    … …  
    534541  return(BText(address));
    535542}
     543
  • tol/btol/timeset_type/tol_btmsgra.h

    rb4aa879 r83c5220  
    424424  }
    425425
    426   BBool Contain       (const BDate&)             const { return(BFALSE); }
    427   BInt  PeriodsBetween(const BDate& d1, const BDate& d2) const  {  return(0); }
     426//BBool Contain       (const BDate&)             const { return(BFALSE); }
     427//BInt  PeriodsBetween(const BDate& d1, const BDate& d2) const  {  return(0); }
    428428
    429429protected:
  • tol/contrib/optimal_bw/FastUnivariateDensityDerivative.cpp

    rb4aa879 r83c5220  
    5757    size_ = size;
    5858    _bfsm_BaseSize__ = sizeof(double)*size_;
    59 
     59#if (__USE_POOL__==__POOL_BFSMEM__)
    6060    buffer_ = (double*)BFixedSizeMemoryBase::
    6161              Instance(_bfsm_BaseSize__)->New(_bfsm_BaseSize__,_bfsm_VectorPageNum__);
    62 //  buffer_ = new double[size_];
     62#else
     63    buffer_ = new double[size_];
     64#endif
    6365  }
    6466  else
    … …  
    7476  if(buffer_)
    7577  {
     78#if (__USE_POOL__==__POOL_BFSMEM__)
    7679    BFixedSizeMemoryBase::Instance(_bfsm_BaseSize__)->Delete(buffer_,_bfsm_VectorPageNum__);
    77   //delete buffer_;
     80#else
     81    delete buffer_;
     82#endif
    7883    buffer_ = NULL;
    7984    size_ = 0;
    … …  
    9095    size_ = size;
    9196    _bfsm_BaseSize__ = sizeof(int)*size_;
     97#if (__USE_POOL__==__POOL_BFSMEM__)
    9298    buffer_ = (int*)BFixedSizeMemoryBase::
    9399              Instance(_bfsm_BaseSize__)->New(_bfsm_BaseSize__,_bfsm_VectorPageNum__);
    94   //buffer_ = new int[size_];
     100#else
     101    buffer_ = new int[size_];
     102#endif
    95103  }
    96104  else
    … …  
    106114  if(buffer_)
    107115  {
     116#if (__USE_POOL__==__POOL_BFSMEM__)
    108117    BFixedSizeMemoryBase::Instance(_bfsm_BaseSize__)->Delete(buffer_,_bfsm_VectorPageNum__);
    109   //delete buffer_;
     118#else
     119    delete buffer_;
     120#endif
    110121    buffer_ = NULL;
    111122    size_ = 0;
Note: See TracChangeset for help on using the changeset viewer.