Changeset 161:ca6023b95501 in finroc_plugins_data_ports


Ignore:
Timestamp:
13.05.2020 08:24:15 (3 weeks ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Adds support for publishing and obtaining values from generic ports using rrlib_rtti typed pointers (before only tGenericObjects were supported)

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • api/tGenericPortImplementation.cpp

    r155 r161  
    9191  } 
    9292 
    93   virtual void Get(core::tAbstractPort& port, rrlib::rtti::tGenericObject& result, rrlib::time::tTimestamp& timestamp) override 
     93  virtual void Get(core::tAbstractPort& port, rrlib::rtti::tTypedPointer& result, rrlib::time::tTimestamp& timestamp) override 
    9494  { 
    9595    static_cast<tPortBase&>(port).CopyCurrentValueToGenericObject(result, timestamp); 
     
    116116  } 
    117117 
    118   virtual void Publish(core::tAbstractPort& port, const rrlib::rtti::tGenericObject& data, const rrlib::time::tTimestamp& timestamp) override 
     118  virtual void Publish(core::tAbstractPort& port, const rrlib::rtti::tTypedConstPointer& data, const rrlib::time::tTimestamp& timestamp) override 
    119119  { 
    120120#ifndef RRLIB_SINGLE_THREADED 
     
    142142  } 
    143143 
    144   virtual void SetBounds(core::tAbstractPort& port, const rrlib::rtti::tGenericObject& min, const rrlib::rtti::tGenericObject& max) override 
     144  virtual void SetBounds(core::tAbstractPort& port, const rrlib::rtti::tTypedConstPointer& min, const rrlib::rtti::tTypedConstPointer& max) override 
    145145  { 
    146146    FINROC_LOG_PRINT(ERROR, "Cannot set bounds for type ", port.GetDataType().GetName()); 
     
    166166  } 
    167167 
    168   virtual void Get(core::tAbstractPort& port, rrlib::rtti::tGenericObject& result, rrlib::time::tTimestamp& timestamp) override 
     168  virtual void Get(core::tAbstractPort& port, rrlib::rtti::tTypedPointer& result, rrlib::time::tTimestamp& timestamp) override 
    169169  { 
    170170    typename tPortBase::tLockingManagerPointer mgr = static_cast<tPortBase&>(port).GetCurrentValueRaw(); 
     
    179179  } 
    180180 
    181   virtual void Publish(core::tAbstractPort& port, const rrlib::rtti::tGenericObject& data, const rrlib::time::tTimestamp& timestamp) override 
     181  virtual void Publish(core::tAbstractPort& port, const rrlib::rtti::tTypedConstPointer& data, const rrlib::time::tTimestamp& timestamp) override 
    182182  { 
    183183    assert(data.GetType() == port.GetDataType()); 
     
    188188  } 
    189189 
    190   virtual void SetBounds(core::tAbstractPort& port, const rrlib::rtti::tGenericObject& min, const rrlib::rtti::tGenericObject& max) override 
     190  virtual void SetBounds(core::tAbstractPort& port, const rrlib::rtti::tTypedConstPointer& min, const rrlib::rtti::tTypedConstPointer& max) override 
    191191  { 
    192192    FINROC_LOG_PRINT(ERROR, "Cannot set bounds for type ", port.GetDataType().GetName()); 
  • api/tGenericPortImplementation.h

    r135 r161  
    106106   * (Using this get()-variant is more efficient when using cheaply-copied types, but can be costly with large data types) 
    107107   */ 
    108   virtual void Get(core::tAbstractPort& port, rrlib::rtti::tGenericObject& result, rrlib::time::tTimestamp& timestamp) = 0; 
     108  virtual void Get(core::tAbstractPort& port, rrlib::rtti::tTypedPointer& result, rrlib::time::tTimestamp& timestamp) = 0; 
    109109 
    110110  /*! 
     
    172172   * This publish()-variant is efficient when using cheaply-copied types, but can be costly with large data types) 
    173173   */ 
    174   virtual void Publish(core::tAbstractPort& port, const rrlib::rtti::tGenericObject& data, const rrlib::time::tTimestamp& timestamp) = 0; 
     174  virtual void Publish(core::tAbstractPort& port, const rrlib::rtti::tTypedConstPointer& data, const rrlib::time::tTimestamp& timestamp) = 0; 
    175175 
    176176  /*! 
     
    220220   * \param max Maximum value 
    221221   */ 
    222   virtual void SetBounds(core::tAbstractPort& port, const rrlib::rtti::tGenericObject& min, const rrlib::rtti::tGenericObject& max) = 0; 
     222  virtual void SetBounds(core::tAbstractPort& port, const rrlib::rtti::tTypedConstPointer& min, const rrlib::rtti::tTypedConstPointer& max) = 0; 
    223223 
    224224  /*! 
  • optimized/tCheapCopyPort.cpp

    r135 r161  
    245245//} 
    246246 
    247 void tCheapCopyPort::CopyCurrentValueToGenericObject(rrlib::rtti::tGenericObject& buffer, rrlib::time::tTimestamp& timestamp, tStrategy strategy) 
     247void tCheapCopyPort::CopyCurrentValueToGenericObject(rrlib::rtti::tTypedPointer buffer, rrlib::time::tTimestamp& timestamp, tStrategy strategy) 
    248248{ 
    249249  if ((strategy == tStrategy::DEFAULT && PushStrategy()) || strategy == tStrategy::NEVER_PULL) 
  • optimized/tCheapCopyPort.h

    r135 r161  
    192192   * \param strategy Strategy to use for get operation 
    193193   */ 
    194   void CopyCurrentValueToGenericObject(rrlib::rtti::tGenericObject& buffer, rrlib::time::tTimestamp& timestamp, tStrategy strategy = tStrategy::DEFAULT); 
     194  void CopyCurrentValueToGenericObject(rrlib::rtti::tTypedPointer buffer, rrlib::time::tTimestamp& timestamp, tStrategy strategy = tStrategy::DEFAULT); 
    195195 
    196196  /*! 
  • optimized/tSingleThreadedCheapCopyPortGeneric.h

    r131 r161  
    156156   * \param strategy Strategy to use for get operation 
    157157   */ 
    158   void CopyCurrentValueToGenericObject(rrlib::rtti::tGenericObject& buffer, rrlib::time::tTimestamp& timestamp, tStrategy strategy = tStrategy::DEFAULT) 
     158  void CopyCurrentValueToGenericObject(rrlib::rtti::tTypedPointer buffer, rrlib::time::tTimestamp& timestamp, tStrategy strategy = tStrategy::DEFAULT) 
    159159  { 
    160160    timestamp = CurrentValueTimestamp(); 
  • tGenericPort.h

    r153 r161  
    229229   * \param timestamp Buffer to copy timestamp attached to data to (optional) 
    230230   */ 
    231   inline void Get(rrlib::rtti::tGenericObject& result) 
     231  inline void Get(rrlib::rtti::tTypedPointer result) 
    232232  { 
    233233    rrlib::time::tTimestamp timestamp; 
    234234    Get(result, timestamp); 
    235235  } 
    236   inline void Get(rrlib::rtti::tGenericObject& result, rrlib::time::tTimestamp& timestamp) 
     236  inline void Get(rrlib::rtti::tTypedPointer result, rrlib::time::tTimestamp& timestamp) 
    237237  { 
    238238    implementation->Get(*GetWrapped(), result, timestamp); 
     
    297297   * \param timestamp Timestamp to attach to data. 
    298298   */ 
    299   inline void Publish(const rrlib::rtti::tGenericObject& data, const rrlib::time::tTimestamp& timestamp = rrlib::time::cNO_TIME) 
     299  inline void Publish(const rrlib::rtti::tTypedConstPointer& data, const rrlib::time::tTimestamp& timestamp = rrlib::time::cNO_TIME) 
    300300  { 
    301301    implementation->Publish(*GetWrapped(), data, timestamp); 
     
    320320   * \param max Maximum value 
    321321   */ 
    322   inline void SetBounds(const rrlib::rtti::tGenericObject& min, const rrlib::rtti::tGenericObject& max) 
     322  inline void SetBounds(const rrlib::rtti::tTypedConstPointer& min, const rrlib::rtti::tTypedConstPointer& max) 
    323323  { 
    324324    implementation->SetBounds(*GetWrapped(), min, max); 
Note: See TracChangeset for help on using the changeset viewer.