Changeset 472:caae658585be in finroc_core


Ignore:
Timestamp:
25.02.2020 06:58:33 (2 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Children:
473:4b81cd5b0170, 474:fbdcd51b85a7
Phase:
public
Message:

Makes core support composite ports (ports with children)

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • port/tAbstractPort.cpp

    r464 r472  
    563563    // count parents 
    564564    int this_parent_node_count = 1; 
    565     tFrameworkElement* parent = this->GetParent(); 
     565    const tFrameworkElement* parent = this; 
    566566    while ((parent = parent->GetParent())) 
    567567    { 
    568       this_parent_node_count++; 
     568      if (!parent->IsPort()) 
     569      { 
     570        this_parent_node_count++; 
     571      } 
    569572    } 
    570573 
    571574    int other_parent_node_count = 1; 
    572     parent = other.GetParent(); 
     575    parent = &other; 
    573576    while ((parent = parent->GetParent())) 
    574577    { 
    575       other_parent_node_count++; 
     578      if (!parent->IsPort()) 
     579      { 
     580        other_parent_node_count++; 
     581      } 
    576582    } 
    577583 
     
    607613  else 
    608614  { 
    609     tFrameworkElement* component = (GetParent() && GetParent()->GetFlag(tFlag::INTERFACE)) ? GetParent()->GetParent() : nullptr; 
     615    tFrameworkElement* interface_candidate = this->GetParent(); 
     616    while (interface_candidate && interface_candidate->IsPort()) 
     617    { 
     618      interface_candidate = interface_candidate->GetParent(); 
     619    } 
     620    tFrameworkElement* component = (interface_candidate && interface_candidate->GetFlag(tFlag::INTERFACE)) ? interface_candidate->GetParent() : nullptr; 
    610621    if (component) 
    611622    { 
     
    617628    else 
    618629    { 
    619       FINROC_LOG_PRINT(WARNING, "This proxy port is not part of a interface. So far, no heuristics for this case have been implemented. Guessing connect direction to be its primary connect direction."); 
     630      FINROC_LOG_PRINT(WARNING, "This proxy port is not part of an interface. So far, no heuristics for this case have been implemented. Guessing connect direction to be its primary connect direction."); 
    620631      to_destination = this->IsOutputPort(); 
    621632    } 
  • port/tAbstractPort.h

    r464 r472  
    416416  virtual tConnectDirection InferConnectDirection(const tPath& path) const; 
    417417 
     418  virtual void OnManagedDelete() override; 
     419 
    418420//---------------------------------------------------------------------- 
    419421// Private fields and methods 
     
    494496  } 
    495497 
    496   virtual void OnManagedDelete() override; 
    497  
    498498}; 
    499499 
  • port/tEdgeAggregator.cpp

    r439 r472  
    145145  while (current) 
    146146  { 
    147     if (current->GetFlag(tFlag::EDGE_AGGREGATOR) && (!current->GetFlag(tFlag::NETWORK_ELEMENT))) 
     147    if (current->GetFlag(tFlag::EDGE_AGGREGATOR) && (!current->GetFlag(tFlag::NETWORK_ELEMENT)) && (!current->IsPort())) 
    148148    { 
    149149      return static_cast<tEdgeAggregator*>(current); 
  • port/tEdgeAggregator.h

    r440 r472  
    139139  inline static bool IsDataFlowType(const rrlib::rtti::tType& type) 
    140140  { 
    141     return type.GetTypeClassification() != rrlib::rtti::tTypeClassification::RPC_TYPE; 
     141    return type.GetTypeClassification() != rrlib::rtti::tTypeClassification::RPC_TYPE && type.GetTypeClassification() != rrlib::rtti::tTypeClassification::PORT_COMPOSITE_INTERFACE; 
    142142  } 
    143143 
  • port/tPortGroup.h

    r414 r472  
    175175   * \return Default flags for any ports to be created in this Group 
    176176   */ 
    177   tFlags GetDefaultPortFlags() 
     177  tFlags GetDefaultPortFlags() const 
    178178  { 
    179179    return default_port_flags; 
  • tFrameworkElement.cpp

    r469 r472  
    120120  creater_thread_uid(rrlib::thread::tThread::CurrentThreadId()), 
    121121#endif 
    122   flags(flags), 
    123   children(flags.Get(tFlag::PORT) ? &empty_child_set : new tChildSet()) 
    124 { 
    125   if (flags.Raw() & cSTATUS_FLAGS.Raw()) 
    126   { 
    127     FINROC_LOG_PRINT(ERROR, "No status flags may be set in constructor"); 
    128     abort(); 
    129   } 
     122  flags(flags.Raw() & (~cSTATUS_FLAGS.Raw())), 
     123  children(flags.Get(tFlag::PORT) && (!flags.Get(tFlag::COMPOSITE_PORT)) ? &empty_child_set : new tChildSet()) 
     124{ 
    130125  if (name.length() > 0) 
    131126  { 
     
    184179void tFrameworkElement::AddChild(tLink& child) 
    185180{ 
    186   if (IsPort()) 
     181  if (IsPort() && (!flags.Get(tFlag::COMPOSITE_PORT))) 
    187182  { 
    188183    FINROC_LOG_PRINT(ERROR, "Cannot add children to port"); 
  • tFrameworkElementFlags.h

    r439 r472  
    110110  // Constant flags 
    111111  UNUSED_CONSTANT_PORT_FLAG_4 = EDGE_AGGREGATOR, 
    112   UNUSED_CONSTANT_PORT_FLAG_3, 
     112  COMPOSITE_PORT,          //!< Port with child ports 
    113113  SENSOR_DATA_PORT,        //!< Is the data processed in this port sensor data? (hint for visualization; relevant for interface especially) 
    114114  CONTROLLER_DATA_PORT,    //!< Is the data processed in this port controller data? (hint for visualization; relevant for interface especially) 
Note: See TracChangeset for help on using the changeset viewer.