Changeset 138:111f36e50cbd in finroc_plugins_structure


Ignore:
Timestamp:
25.05.2020 22:41:13 (6 weeks ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Tags:
tip
Message:

Adds cNO_FILE string contstant to tCompositeComponent that can be passed to constructor of components that are fully coded and not intended to be used with a structure XML file.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tCompositeComponent.cpp

    r134 r138  
    7474const tComponent::tInterfaceInfo tCompositeComponent::cSERVICES_INTERFACE_INFO = { "Services", tFlag::PROXY_INTERFACE | tFlag::INTERFACE_FOR_RPC_PORTS }; 
    7575const tComponent::tInterfaceInfo tCompositeComponent::cPARAMETERS_INTERFACE_INFO = { "Parameters", tFlag::PROXY_INTERFACE | tFlag::INTERFACE_FOR_DATA_PORTS | tFlag::PARAMETER_INTERFACE | tFlag::INTERFACE_FOR_INPUTS }; 
     76const std::string tCompositeComponent::cNO_FILE = "<No File>"; 
    7677 
    7778//---------------------------------------------------------------------- 
     
    8182tCompositeComponent::tCompositeComponent(core::tFrameworkElement *parent, const std::string &name, const std::string &structure_config_file, tFlags extra_flags, bool share_ports) : 
    8283  tComponent(parent, name, extra_flags | tFlag::FINSTRUCTABLE_GROUP | (share_ports ? tFlag::SHARED : tFlag::FINSTRUCTABLE_GROUP)), 
    83   par_manages_parameter_configuration(parent == &core::tRuntimeEnvironment::GetInstance() || extra_flags.Get(tFlag::MANAGES_PARAMETER_CONFIGURATION) ? nullptr : new tStaticParameter<bool>("Manages Parameter Configuration", this)), 
    84   structure_config_file_parameter(structure_config_file.length() > 0 ? NULL : new tStaticParameter<std::string>("XML file", this, "")), 
     84  par_manages_parameter_configuration(parent == &core::tRuntimeEnvironment::GetInstance() || extra_flags.Get(tFlag::MANAGES_PARAMETER_CONFIGURATION) || structure_config_file == cNO_FILE ? nullptr : new tStaticParameter<bool>("Manages Parameter Configuration", this)), 
     85  structure_config_file_parameter(structure_config_file.length() ? nullptr : new tStaticParameter<std::string>("XML file", this, "")), 
    8586  structure_config_file(rrlib::util::StartsWith(structure_config_file, cUNWANTED_XML_FILE_PREFIX) ? structure_config_file.substr(strlen(cUNWANTED_XML_FILE_PREFIX)) : structure_config_file) 
    8687{ 
     88  if (structure_config_file == cNO_FILE) 
     89  { 
     90    this->structure_config_file = ""; 
     91  } 
     92 
    8793  core::tFrameworkElementTags::AddTag(*this, "group"); 
    88   if (structure_config_file.length() > 0) // Fixed name? => we can help finstruct by adding annotation 
     94  if (this->structure_config_file.length()) // Fixed name? => we can help finstruct by adding annotation 
    8995  { 
    9096    core::tFrameworkElementTags::AddTag(*this, "finstructable structure file: " + this->structure_config_file); 
    9197  } 
    92   if (!par_manages_parameter_configuration) 
     98  if ((!par_manages_parameter_configuration) && parent == &core::tRuntimeEnvironment::GetInstance()) 
    9399  { 
    94100    SetFlag(tFlag::MANAGES_PARAMETER_CONFIGURATION, true); 
  • tCompositeComponent.h

    r132 r138  
    9090  using tStaticParameter = tConveniencePort<parameters::tStaticParameter<T>, tComponent, core::tFrameworkElement, &tComponent::GetThis>; 
    9191 
     92  /*! String constant for 'no structure config file' */ 
     93  static const std::string cNO_FILE; 
     94 
     95 
    9296  /*! 
    9397   * Whether this composite component stores and loads configuration of parameters below (config file links in particular) 
    9498   * (For parameters that are below another sub-composite-component that manages parameter configuration, this component is responsible for their configuration) 
     99   * Parameter is created unless tFlag::MANAGES_PARAMETER_CONFIGURATION or cNO_FILE is passed to constructor. 
    95100   */ 
    96101  std::unique_ptr<tStaticParameter<bool>> par_manages_parameter_configuration; 
     
    98103  /*! 
    99104   * Contains name of XML file to use 
    100    * Parameter only exists if no (fixed) XML file was provided via constructor 
     105   * Parameter only exists if empty string is passed to constructor as 'structure_config_file'. 
    101106   */ 
    102107  std::unique_ptr<tStaticParameter<std::string>> structure_config_file_parameter; 
     
    106111   * \param parent Parent 
    107112   * \param name Name of component 
    108    * \param structure_config_file Structure config XML file 
     113   * \param structure_config_file Fixed structure XML file. If set to cNO_FILE, neither par_manages_parameter_configuration nor structure_config_file_parameter are created. 
    109114   * \param extra_flags Any extra flags for component 
    110115   * \param share_ports Share ports in interfaces so that they can be connected to remote components? 
Note: See TracChangeset for help on using the changeset viewer.