Changeset 639
- Timestamp:
- 07/17/15 13:58:12 (9 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/filter/file_writer_filter.cpp
r638 r639 5 5 namespace xios 6 6 { 7 CFileWriterFilter::CFileWriterFilter(C Field* field)8 : CInputPin( 1)7 CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field) 8 : CInputPin(gc, 1) 9 9 , field(field) 10 10 { -
XIOS/trunk/src/filter/file_writer_filter.hpp
r638 r639 15 15 public: 16 16 /*! 17 * Constructs the filter (with one input slot) associated to the specified field. 17 * Constructs the filter (with one input slot) associated to the specified field 18 * and a garbage collector. 18 19 * 20 * \param gc the associated garbage collector 19 21 * \param field the associated field 20 22 */ 21 CFileWriterFilter(C Field* field);23 CFileWriterFilter(CGarbageCollector& gc, CField* field); 22 24 23 25 protected: -
XIOS/trunk/src/filter/filter.cpp
r637 r639 3 3 namespace xios 4 4 { 5 CFilter::CFilter( size_t inputSlotsCount, IFilterEngine* engine)6 : CInputPin( inputSlotsCount)5 CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine) 6 : CInputPin(gc, inputSlotsCount) 7 7 , COutputPin() 8 8 , engine(engine) -
XIOS/trunk/src/filter/filter.hpp
r637 r639 20 20 * and the specified engine. 21 21 * 22 * \param gc the associated garbage collector 22 23 * \param inputSlotsCount the number of input slots 23 24 * \param engine the filter engine 24 25 */ 25 CFilter( size_t inputSlotsCount, IFilterEngine* engine);26 CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 26 27 27 28 protected: -
XIOS/trunk/src/filter/input_pin.cpp
r637 r639 1 1 #include "input_pin.hpp" 2 #include "garbage_collector.hpp" 2 3 #include "exception.hpp" 3 4 4 5 namespace xios 5 6 { 6 CInputPin::CInputPin(size_t slotsCount) 7 : slotsCount(slotsCount) 7 CInputPin::CInputPin(CGarbageCollector& gc, size_t slotsCount) 8 : gc(gc) 9 , slotsCount(slotsCount) 8 10 { /* Nothing to do */ } 9 11 … … 19 21 std::map<Time, InputBuffer>::iterator it = inputs.find(packet->timestamp); 20 22 if (it == inputs.end()) 23 { 21 24 it = inputs.insert(std::make_pair(packet->timestamp, InputBuffer(slotsCount))).first; 25 gc.registerFilter(this, packet->timestamp); 26 } 22 27 it->second.slotsFilled++; 23 28 it->second.packets[inputSlot] = packet; … … 25 30 if (it->second.slotsFilled == slotsCount) 26 31 { 32 // Unregister before calling onInputReady in case the filter registers again 33 gc.unregisterFilter(this, packet->timestamp); 27 34 onInputReady(it->second.packets); 28 35 inputs.erase(it); 29 36 } 30 37 } 38 39 void CInputPin::invalidate(Time timestamp) 40 { 41 inputs.erase(inputs.begin(), inputs.lower_bound(timestamp)); 42 } 31 43 } // namespace xios -
XIOS/trunk/src/filter/input_pin.hpp
r637 r639 9 9 namespace xios 10 10 { 11 class CGarbageCollector; 12 11 13 /*! 12 14 * An input pin handles the data packets received by a filter. … … 16 18 public: 17 19 /*! 18 * Constructs an input pin with the specified number of slots. 20 * Constructs an input pin with the specified number of slots 21 * and an associated garbage collector. 19 22 * 23 * \param gc the garbage collector associated with this input pin 20 24 * \param slotsCount the number of slots 21 25 */ 22 CInputPin( size_t slotsCount);26 CInputPin(CGarbageCollector& gc, size_t slotsCount); 23 27 24 28 /*! … … 32 36 void setInput(size_t inputSlot, CDataPacketPtr packet); 33 37 38 /*! 39 * Removes all pending packets which are older than the specified timestamp. 40 * 41 * \param timestamp the timestamp used for invalidation 42 */ 43 void virtual invalidate(Time timestamp); 44 34 45 protected: 46 CGarbageCollector& gc; //!< The garbage collector associated to the input pin 47 35 48 /*! 36 49 * Function triggered when all slots have been filled for a specific timestamp. -
XIOS/trunk/src/filter/store_filter.cpp
r638 r639 6 6 namespace xios 7 7 { 8 CStoreFilter::CStoreFilter(C Context* context, CGrid* grid)9 : CInputPin( 1)8 CStoreFilter::CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid) 9 : CInputPin(gc, 1) 10 10 , context(context) 11 11 , grid(grid) … … 63 63 { 64 64 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)); 65 74 } 66 75 } // namespace xios -
XIOS/trunk/src/filter/store_filter.hpp
r638 r639 16 16 public: 17 17 /*! 18 * Constructs the filter with one input slot for the specified grid19 * and context.18 * Constructs the filter with one input slot and an associated 19 * garbage collector for the specified grid and context. 20 20 * 21 * \param gc the garbage collector associated with this input pin 21 22 * \param context the context to which the data belongs 22 23 * \param grid the grid to which the data is attached 23 24 */ 24 CStoreFilter(C Context* context, CGrid* grid);25 CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid); 25 26 26 27 /*! … … 48 49 CDataPacket::StatusCode getData(Time timestamp, CArray<double, N>& data); 49 50 51 /*! 52 * Removes all pending packets which are older than the specified timestamp. 53 * 54 * \param timestamp the timestamp used for invalidation 55 */ 56 void virtual invalidate(Time timestamp); 57 50 58 protected: 51 59 /*! -
XIOS/trunk/src/interface/c/iccalendar.cpp
r598 r639 16 16 context->updateCalendar(step); 17 17 context->sendUpdateCalendar(step); 18 context->checkPrefetchingOfEnabledReadModeFiles();19 18 CTimer::get("XIOS").suspend(); 20 19 } -
XIOS/trunk/src/node/context.cpp
r619 r639 931 931 void CContext::updateCalendar(int step) 932 932 { 933 info(50) <<"updateCalendar : before : "<<calendar->getCurrentDate()<<endl;933 info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 934 934 calendar->update(step); 935 info(50)<<"updateCalendar : after : "<<calendar->getCurrentDate()<<endl; 935 info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 936 937 if (hasClient) 938 { 939 checkPrefetchingOfEnabledReadModeFiles(); 940 garbageCollector.invalidate(calendar->getCurrentDate()); 941 } 936 942 } 937 943 -
XIOS/trunk/src/node/context.hpp
r598 r639 11 11 //#include "context_server.hpp" 12 12 #include "data_output.hpp" 13 #include "garbage_collector.hpp" 13 14 14 15 #include "mpi.hpp" … … 218 219 std::map<int, StdSize> dataSize_; 219 220 StdString idServer_; 221 CGarbageCollector garbageCollector; 220 222 221 223
Note: See TracChangeset
for help on using the changeset viewer.