Changeset 103:7ec92fcaa2af in finroc_plugins_data_ports


Ignore:
Timestamp:
12.01.2016 14:04:00 (4 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Phase:
public
Message:

Fixed issues in single-threaded mode with features that were introduced in revisions 102:c325ed4d7e3e and 93:c18a28cf462d

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • api/tGenericPortImplementation.h

    r102 r103  
    185185   * This publish()-variant is efficient with all data types. 
    186186   */ 
    187   inline void Publish(core::tAbstractPort& port, common::tReferenceCountingBufferManager* data_buffer) 
     187  inline void Publish(core::tAbstractPort& port, tPortDataPointer<rrlib::rtti::tGenericObject>& data_buffer) 
    188188  { 
    189189    if (IsCheaplyCopiedType(port.GetDataType())) 
    190190    { 
    191191      tCheapCopyPort& cc_port = static_cast<tCheapCopyPort&>(port); 
     192#ifndef RRLIB_SINGLE_THREADED 
    192193      if (optimized::tThreadLocalBufferPools::Get()) 
    193194      { 
    194         common::tPublishOperation<optimized::tCheapCopyPort, typename optimized::tCheapCopyPort::tPublishingDataThreadLocalBuffer> publish_operation(static_cast<optimized::tThreadLocalBufferManager*>(data_buffer), true); 
     195        common::tPublishOperation<optimized::tCheapCopyPort, typename optimized::tCheapCopyPort::tPublishingDataThreadLocalBuffer> publish_operation(static_cast<optimized::tThreadLocalBufferManager*>(data_buffer.implementation.Release()), true); 
    195196        publish_operation.Execute<false, tChangeStatus::CHANGED, false, false>(cc_port); 
    196197      } 
    197198      else 
    198199      { 
    199         optimized::tCheapCopyPort::tUnusedManagerPointer pointer(static_cast<optimized::tCheaplyCopiedBufferManager*>(data_buffer)); 
     200        optimized::tCheapCopyPort::tUnusedManagerPointer pointer(static_cast<optimized::tCheaplyCopiedBufferManager*>(data_buffer.implementation.Release())); 
    200201        common::tPublishOperation<optimized::tCheapCopyPort, typename optimized::tCheapCopyPort::tPublishingDataGlobalBuffer> publish_operation(pointer); 
    201202        publish_operation.Execute<false, tChangeStatus::CHANGED, false, false>(cc_port); 
    202203      } 
     204#else 
     205      cc_port.Publish(*data_buffer, data_buffer.GetTimestamp()); 
     206#endif 
    203207    } 
    204208    else 
    205209    { 
    206       standard::tStandardPort::tUnusedManagerPointer buffer(static_cast<standard::tPortBufferManager*>(data_buffer)); 
     210      standard::tStandardPort::tUnusedManagerPointer buffer(static_cast<standard::tPortBufferManager*>(data_buffer.implementation.Release())); 
    207211      assert(buffer->IsUnused()); 
    208212      static_cast<standard::tStandardPort&>(port).Publish(buffer); 
  • api/tSingleThreadedCheapCopyPort.h

    r69 r103  
    155155  void Publish(const T& data, rrlib::time::tTimestamp timestamp) 
    156156  { 
    157     *static_cast<T*>(current_value.data_pointer) = data; 
    158     current_value.timestamp = timestamp; 
    159     common::tPublishOperation<tSingleThreadedCheapCopyPort<T>, tPublishingData> publish_operation(current_value); 
    160     publish_operation.template Execute<false, tChangeStatus::CHANGED, false, false>(*this); 
     157    if (!GetFlag(tFlag::HIJACKED_PORT)) 
     158    { 
     159      *static_cast<T*>(current_value.data_pointer) = data; 
     160      current_value.timestamp = timestamp; 
     161      common::tPublishOperation<tSingleThreadedCheapCopyPort<T>, tPublishingData> publish_operation(current_value); 
     162      publish_operation.template Execute<false, tChangeStatus::CHANGED, false, false>(*this); 
     163    } 
    161164  } 
    162165 
  • optimized/tSingleThreadedCheapCopyPortGeneric.cpp

    r95 r103  
    181181void tSingleThreadedCheapCopyPortGeneric::Publish(const rrlib::rtti::tGenericObject& data, rrlib::time::tTimestamp timestamp) 
    182182{ 
    183   current_value.data->DeepCopyFrom(data); 
    184   current_value.timestamp = timestamp; 
    185   common::tPublishOperation<tSingleThreadedCheapCopyPortGeneric, tPublishingData> publish_operation(current_value); 
    186   publish_operation.Execute<false, tChangeStatus::CHANGED, false, false>(*this); 
     183  if (!GetFlag(tFlag::HIJACKED_PORT)) 
     184  { 
     185    current_value.data->DeepCopyFrom(data); 
     186    current_value.timestamp = timestamp; 
     187    common::tPublishOperation<tSingleThreadedCheapCopyPortGeneric, tPublishingData> publish_operation(current_value); 
     188    publish_operation.Execute<false, tChangeStatus::CHANGED, false, false>(*this); 
     189  } 
    187190} 
    188191 
  • tGenericPort.h

    r102 r103  
    289289  inline void Publish(tPortDataPointer<rrlib::rtti::tGenericObject>& buffer) 
    290290  { 
    291     implementation->Publish(*GetWrapped(), buffer.implementation.Release()); 
     291    implementation->Publish(*GetWrapped(), buffer); 
    292292  } 
    293293 
  • tPortDataPointer.h

    r87 r103  
    6262// Forward declarations / typedefs / enums 
    6363//---------------------------------------------------------------------- 
     64namespace api 
     65{ 
     66class tGenericPortImplementation; 
     67} 
    6468 
    6569//---------------------------------------------------------------------- 
     
    219223  friend struct api::tPortImplementation<tPortData, api::tPortImplementationTypeTrait<tPortData>::type>; 
    220224  friend class tGenericPort; 
     225  friend class api::tGenericPortImplementation; 
    221226  template <typename U, bool> 
    222227  friend class api::tPullRequestHandlerAdapter; 
  • tests/test_collection.cpp

    r102 r103  
    299299 
    300300  tOutputPort<T> output_port("Output Port", parent); 
    301   tProxyPort<T, true> proxy_port("Proxy Port", parent); 
     301  tProxyPort<T, true> proxy_port("Proxy Port", parent, core::tFrameworkElementFlag::PUSH_STRATEGY); 
    302302  tInputPort<T> input_port("Input Port", parent); 
    303303  output_port.ConnectTo(proxy_port); 
Note: See TracChangeset for help on using the changeset viewer.