Changeset 2491


Ignore:
Timestamp:
04/19/23 18:33:40 (13 months ago)
Author:
ymipsl
Message:

Fix the problem of shared_from_this() needed at construction time. Deported at connection output.
YM

Location:
XIOS3/dev/XIOS_ATTACHED/src/filter
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/dev/XIOS_ATTACHED/src/filter/client_online_reader_filter.cpp

    r2482 r2491  
    2929// connect filters 
    3030    fileReaderSourceFilter_->connectOutput(redistributeFilter_, 0); 
    31     
    32    // shared_ptr<CClientOnlineReaderFilter> toto = shared_from_this() ; 
    33     // very bad thing to bypass shared pointer assignement in constructor: just for test ! 
    34     auto sharedThis = new std::shared_ptr<CClientOnlineReaderFilter>(this) ; 
    35     redistributeFilter_->connectOutput(*sharedThis, 0); 
    3631 
    3732    field_ = fieldIn ; 
    3833    freqOp_ = fieldOut->getRelFile()->output_freq ; 
    3934    offset_ = fieldOut->freq_offset ; 
     35  } 
     36 
     37 
     38  void CClientOnlineReaderFilter::connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot) 
     39  { 
     40    // connection to redistributeFilter cannot be done at construction time due to shared_from_this(), doing it now 
     41    redistributeFilter_->connectOutput(shared_from_this(), 0); 
     42    CFilter::connectOutput(inputPin,inputSlot) ; 
    4043  } 
    4144 
  • XIOS3/dev/XIOS_ATTACHED/src/filter/client_online_reader_filter.hpp

    r2482 r2491  
    3030       */ 
    3131      CClientOnlineReaderFilter(CGarbageCollector& gc, CField* field); 
    32  
     32      virtual void connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot) ; 
    3333      /*! 
    3434       * Transforms the data received from the model into a packet and send it 
  • XIOS3/dev/XIOS_ATTACHED/src/filter/output_pin.hpp

    r2143 r2491  
    3030       * \param inputSlot the input slot number 
    3131       */ 
    32       void connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot); 
     32      void virtual connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot); 
    3333 
    3434      /*! 
Note: See TracChangeset for help on using the changeset viewer.