Ignore:
Timestamp:
07/17/15 13:58:12 (9 years ago)
Author:
rlacroix
Message:

Add a basic garbage collector to ensure no packets linger in the filter graph.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/filter/store_filter.cpp

    r638 r639  
    66namespace xios 
    77{ 
    8   CStoreFilter::CStoreFilter(CContext* context, CGrid* grid) 
    9     : CInputPin(1) 
     8  CStoreFilter::CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid) 
     9    : CInputPin(gc, 1) 
    1010    , context(context) 
    1111    , grid(grid) 
     
    6363  { 
    6464    packets.insert(std::make_pair(data[0]->timestamp, data[0])); 
     65    // The packet is always destroyed by the garbage collector 
     66    // so we register but never unregister 
     67    gc.registerFilter(this, data[0]->timestamp); 
     68  } 
     69 
     70  void CStoreFilter::invalidate(Time timestamp) 
     71  { 
     72    CInputPin::invalidate(timestamp); 
     73    packets.erase(packets.begin(), packets.lower_bound(timestamp)); 
    6574  } 
    6675} // namespace xios 
Note: See TracChangeset for help on using the changeset viewer.