Changeset 133:fb0f074ccf14 in finroc_plugins_data_ports


Ignore:
Timestamp:
30.09.2018 15:17:08 (10 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
14.08
Phase:
public
Message:

Adds methods to set maximum input queue length of data ports at runtime (which already existed in early Finroc versions)

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • common/tAbstractDataPort.h

    r59 r133  
    195195  { 
    196196    custom_changed_flag = new_value; 
     197  } 
     198 
     199  /*! 
     200   * Adjusts maximum queue length 
     201   * 
     202   * \param max_queue_length Maximum number of elements in queue (a value of -1 indicates that the queue has (virtually) no size limit). 
     203   */ 
     204  void SetMaxQueueLength(int max_queue_length) 
     205  { 
     206    SetMaxQueueLengthImplementation(max_queue_length); 
    197207  } 
    198208 
     
    369379 
    370380  /*! 
     381   * Adjusts maximum queue length 
     382   * 
     383   * \param max_queue_length Maximum number of elements in queue (a value of -1 indicates that the queue has (virtually) no size limit). 
     384   */ 
     385  virtual void SetMaxQueueLengthImplementation(int max_queue_length) = 0; 
     386 
     387  /*! 
    371388   * Push initial value to the specified port 
    372389   * (checks etc. have been done by AbstractDataPort class) 
  • optimized/tCheapCopyPort.cpp

    r69 r133  
    523523} 
    524524 
    525 //void tCheapCopyPort::SetMaxQueueLengthImpl(int length) 
    526 //{ 
    527 //  assert((GetFlag(tFlag::HAS_QUEUE) && queue != NULL)); 
    528 //  assert((!IsOutputPort())); 
    529 //  assert((length >= 1)); 
    530 //  queue->SetMaxLength(length); 
    531 //} 
     525void tCheapCopyPort::SetMaxQueueLengthImplementation(int length) 
     526{ 
     527  if (!input_queue) 
     528  { 
     529    FINROC_LOG_PRINT(WARNING, "Cannot set queue length for port without queue"); 
     530  } 
     531  else 
     532  { 
     533    input_queue->SetMaxQueueLength(length); 
     534  } 
     535} 
    532536 
    533537void tCheapCopyPort::SetPullRequestHandler(tPullRequestHandlerRaw* pull_request_handler_) 
  • optimized/tCheapCopyPort.h

    r91 r133  
    957957  tLockingManagerPointer PullValueRaw(bool ignore_pull_request_handler_on_this_port = false); 
    958958 
    959 //  virtual void SetMaxQueueLengthImpl(int length); 
     959  virtual void SetMaxQueueLengthImplementation(int length) override; 
    960960 
    961961  /*! 
  • standard/tStandardPort.cpp

    r69 r133  
    322322} 
    323323 
    324 //void tStandardPort::SetMaxQueueLengthImplementation(int length) 
    325 //{ 
    326 //  assert((GetFlag(tFlag::HAS_QUEUE) && queue != NULL)); 
    327 //  assert((!IsOutputPort())); 
    328 //  assert((length >= 1)); 
    329 //  queue->SetMaxLength(length); 
    330 //} 
     324void tStandardPort::SetMaxQueueLengthImplementation(int length) 
     325{ 
     326  if (!input_queue) 
     327  { 
     328    FINROC_LOG_PRINT(WARNING, "Cannot set queue length for port without queue"); 
     329  } 
     330  else 
     331  { 
     332    input_queue->SetMaxQueueLength(length); 
     333  } 
     334} 
    331335 
    332336void tStandardPort::SetPullRequestHandler(tPullRequestHandlerRaw* pull_request_handler_) 
  • standard/tStandardPort.h

    r59 r133  
    598598  tLockingManagerPointer PullValueRaw(bool ignore_pull_request_handler_on_this_port = false); 
    599599 
    600   //virtual void SetMaxQueueLengthImplementation(int length); 
     600  virtual void SetMaxQueueLengthImplementation(int length) override; 
    601601 
    602602  /*! 
Note: See TracChangeset for help on using the changeset viewer.