Changeset 177:92c581db5581 in finroc_plugins_data_ports


Ignore:
Timestamp:
25.03.2021 07:52:14 (4 weeks ago)
Author:
Max Reichardt <max.reichardt@…>
Branch:
17.03
Phase:
public
Message:

Fixes bug in recent changeset 3f95d4a4a332 ('Adds Publish method with const data buffer to tGenericPort')

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • api/tGenericPortImplementation.h

    r175 r177  
    183183   * This publish()-variant is efficient with all data types. 
    184184   */ 
    185   template <typename T> 
    186   inline void Publish(core::tAbstractPort& port, tPortDataPointer<T>& data_buffer) 
     185  inline void Publish(core::tAbstractPort& port, tPortDataPointer<rrlib::rtti::tGenericObject>& data_buffer) 
    187186  { 
    188187    if (IsCheaplyCopiedType(port.GetDataType())) 
     
    214213 
    215214  /*! 
     215   * Publish Data Buffer obtained from another port. This data will be forwarded to any connected ports. 
     216   * Should only be called on output ports. 
     217   * 
     218   * \param port Wrapped port to operate on 
     219   * \param data_buffer Data to publish. 
     220   * 
     221   * This publish()-variant is efficient with all data types. 
     222   */ 
     223  inline void PublishConstBuffer(core::tAbstractPort& port, tPortDataPointer<const rrlib::rtti::tGenericObject>& data_buffer) 
     224  { 
     225    if (IsCheaplyCopiedType(port.GetDataType())) 
     226    { 
     227      this->Publish(port, *data_buffer, data_buffer.GetTimestamp()); // copy and publish (as non-generic ports) 
     228    } 
     229    else 
     230    { 
     231      standard::tStandardPort::tLockingManagerPointer buffer(static_cast<standard::tPortBufferManager*>(data_buffer.implementation.Release())); 
     232      assert(!buffer->IsUnused()); 
     233      static_cast<standard::tStandardPort&>(port).Publish(buffer); 
     234    } 
     235  } 
     236 
     237  /*! 
    216238   * Set new bounds 
    217239   * (This is not thread-safe and must only be done in "pause mode") 
  • tGenericPort.h

    r175 r177  
    314314  inline void Publish(tPortDataPointer<const rrlib::rtti::tGenericObject>& buffer) 
    315315  { 
    316     implementation->Publish(*GetWrapped(), buffer); 
     316    implementation->PublishConstBuffer(*GetWrapped(), buffer); 
    317317  } 
    318318 
Note: See TracChangeset for help on using the changeset viewer.