Changeset 106:9994afeb1059 in finroc_plugins_structure


Ignore:
Timestamp:
08.05.2017 18:41:22 (4 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Parents:
97:ee56125f8e7c (diff), 105:82afd0470bb1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merged with 14.08

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main_utilities.cpp

    r91 r106  
    245245  { 
    246246#ifdef _LIB_FINROC_PLUGINS_TCP_PRESENT_ 
    247     tcp::tOptions::GetDefaultOptions().connect_to.push_back(rrlib::getopt::EvaluateValue(connect_option)); 
    248     FINROC_LOG_PRINT_STATIC(DEBUG, "Connecting to ", rrlib::getopt::EvaluateValue(connect_option)); 
     247    for (auto & address : rrlib::getopt::EvaluateValueList(connect_option)) 
     248    { 
     249      tcp::tOptions::GetDefaultOptions().connect_to.push_back(address); 
     250      FINROC_LOG_PRINT_STATIC(DEBUG, "Connecting to ", address); 
     251    } 
    249252#endif 
    250253  } 
     
    336339void RegisterCommonOptions() 
    337340{ 
    338   rrlib::getopt::AddValue("log-config", 'l', "Log config file", &OptionsHandler); 
    339   rrlib::getopt::AddValue("config-file", 'c', "Parameter config file", &OptionsHandler); 
     341  rrlib::getopt::AddValue("log-config", 'l', "Log config file", &OptionsHandler, true); 
     342  rrlib::getopt::AddValue("config-file", 'c', "Parameter config file", &OptionsHandler, true); 
    340343  rrlib::getopt::AddValue("listen-address", 0, "Address on which to listen for connections (default: 0.0.0.0), set this to :: to enable IPv6", &OptionsHandler); 
    341   rrlib::getopt::AddValue("port", 'p', "Network port to use", &OptionsHandler); 
     344  rrlib::getopt::AddValue("port", 'p', "Network port to use", &OptionsHandler, true); 
    342345  rrlib::getopt::AddValue("connect", 0, "TCP address of finroc application to connect to (default: localhost:<port>)", &OptionsHandler); 
    343   rrlib::getopt::AddValue("crash-handler", 0, "Enable/disable crash handler (default: 'on' in debug mode - 'off' in release mode).", &OptionsHandler); 
     346  rrlib::getopt::AddValue("crash-handler", 0, "Enable/disable crash handler (default: 'on' in debug mode - 'off' in release mode).", &OptionsHandler, true); 
    344347  rrlib::getopt::AddFlag("pause", 0, "Pause program at startup", &OptionsHandler); 
    345348  rrlib::getopt::AddFlag("port-links-are-not-unique", 0, "Port links in this part are not unique in P2P network (=> host name is prepended in GUI, for instance).", &OptionsHandler); 
  • main_utilities.cpp

    r105 r106  
    133133  if (call_count == 1) 
    134134  { 
    135     FINROC_LOG_PRINT(USER, "\nCaught ", signal_name, ". Exiting..."); 
     135    FINROC_LOG_PRINT_STATIC(USER, "\nCaught ", signal_name, ". Exiting..."); 
    136136    run_main_loop = false; 
    137137    std::unique_lock<std::mutex> l(main_thread_wait_mutex); 
     
    159159  if ((!Shutdown("SIGINT")) && call_count < 5) 
    160160  { 
    161     FINROC_LOG_PRINT(USER, "\nCaught SIGINT again. Unfortunately, the program still has not terminated. Program will be aborted at fifth SIGINT."); 
     161    FINROC_LOG_PRINT_STATIC(USER, "\nCaught SIGINT again. Unfortunately, the program still has not terminated. Program will be aborted at fifth SIGINT."); 
    162162  } 
    163163  else if (call_count >= 5) 
    164164  { 
    165     FINROC_LOG_PRINT(USER, "\nCaught SIGINT for the fifth time. Aborting program."); 
     165    FINROC_LOG_PRINT_STATIC(USER, "\nCaught SIGINT for the fifth time. Aborting program."); 
    166166    abort(); 
    167167  } 
     
    176176  if (!Shutdown("SIGTERM")) 
    177177  { 
    178     FINROC_LOG_PRINT(USER, "\nCaught SIGTERM while shutting down. Aborting program."); 
     178    FINROC_LOG_PRINT_STATIC(USER, "\nCaught SIGTERM while shutting down. Aborting program."); 
    179179    abort(); 
    180180  } 
     
    200200    if (!core::FinrocFileExists(file)) 
    201201    { 
    202       FINROC_LOG_PRINT(ERROR, "Could not find specified config file ", file); 
     202      FINROC_LOG_PRINT_STATIC(ERROR, "Could not find specified config file ", file); 
    203203      return false; 
    204204    } 
    205205    else 
    206206    { 
    207       FINROC_LOG_PRINT(DEBUG, "Loading config file ", file); 
     207      FINROC_LOG_PRINT_STATIC(DEBUG, "Loading config file ", file); 
    208208    } 
    209209    parameters::tConfigurablePlugin::SetConfigFile(file); 
     
    223223    if (port < 1 || port > 65535) 
    224224    { 
    225       FINROC_LOG_PRINT(ERROR, "Invalid port '", port, "'. Using default: ", tcp::tOptions::GetDefaultOptions().preferred_server_port); 
     225      FINROC_LOG_PRINT_STATIC(ERROR, "Invalid port '", port, "'. Using default: ", tcp::tOptions::GetDefaultOptions().preferred_server_port); 
    226226    } 
    227227    else 
    228228    { 
    229       FINROC_LOG_PRINT(DEBUG, "Listening on user defined port ", port, "."); 
     229      FINROC_LOG_PRINT_STATIC(DEBUG, "Listening on user defined port ", port, "."); 
    230230      tcp::tOptions::GetDefaultOptions().preferred_server_port = port; 
    231231    } 
     
    259259#ifdef _LIB_FINROC_PLUGINS_TCP_PRESENT_ 
    260260    tcp::tOptions::GetDefaultOptions().server_listen_address = rrlib::getopt::EvaluateValue(listen_address_option); 
    261     FINROC_LOG_PRINT(DEBUG, "Listening on ", tcp::tOptions::GetDefaultOptions().server_listen_address); 
     261    FINROC_LOG_PRINT_STATIC(DEBUG, "Listening on ", tcp::tOptions::GetDefaultOptions().server_listen_address); 
    262262#endif 
    263263  } 
     
    278278    else 
    279279    { 
    280       FINROC_LOG_PRINT(ERROR, "Option --crash-handler needs be either 'on' or 'off' (not '", s, "')."); 
     280      FINROC_LOG_PRINT_STATIC(ERROR, "Option --crash-handler needs be either 'on' or 'off' (not '", s, "')."); 
    281281      return false; 
    282282    } 
     
    361361    if (!rrlib::crash_handler::InstallCrashHandler()) 
    362362    { 
    363       FINROC_LOG_PRINT(ERROR, "Error installing crash handler. Crashes will simply terminate the program."); 
     363      FINROC_LOG_PRINT_STATIC(ERROR, "Error installing crash handler. Crashes will simply terminate the program."); 
    364364    } 
    365365  } 
     
    383383  catch (const std::exception& e1) 
    384384  { 
    385     FINROC_LOG_PRINT(WARNING, "Error connecting Peer: ", e1); 
     385    FINROC_LOG_PRINT_STATIC(WARNING, "Error connecting Peer: ", e1); 
    386386  } 
    387387#endif 
     
    434434    { 
    435435      scheduling::tExecutionControl::StartAll(*fe); 
    436       FINROC_LOG_PRINT(USER, "Finroc program '", program_name, "' is now running."); 
     436      FINROC_LOG_PRINT_STATIC(USER, "Finroc program '", program_name, "' is now running."); 
    437437    } 
    438438  } 
     
    457457    } 
    458458  } 
    459   FINROC_LOG_PRINT(DEBUG, "Left main loop"); 
     459  FINROC_LOG_PRINT_STATIC(DEBUG, "Left main loop"); 
    460460 
    461461  // In many cases this is not necessary. 
  • tModuleBase.h

    r94 r101  
    134134      : tConveniencePort<parameters::tParameter<T>, tComponent, tFrameworkElement, &tModuleBase::GetParameterParent>(args...) 
    135135    { 
    136       assert(this->GetWrapped()->GetParent()->NameEquals("Parameters")); 
    137       this->AddListenerSimple(static_cast<tModuleBase*>(this->GetWrapped()->GetParent()->GetParent())->parameters_changed); 
     136      if (this->GetWrapped()) 
     137      { 
     138        assert(this->GetWrapped()->GetParent()->NameEquals("Parameters")); 
     139        this->AddListenerSimple(static_cast<tModuleBase*>(this->GetWrapped()->GetParent()->GetParent())->parameters_changed); 
     140      } 
    138141    } 
    139142  }; 
  • tModuleBase.h

    r99 r101  
    8787 
    8888  /** 
    89    * Port and parameter classes to use in modules. 
     89   * RPC port classes to use in modules. 
    9090   * 
    9191   * Constructors take a variadic argument list... just any properties you want to assign to port/parameter. 
     
    9494   * If this is not possible/desired, name needs to be provided as first constructor argument - parent as arbitrary one. 
    9595   * 
    96    * A string as first parameter is interpreted as port name; Any other string as config entry 
     96   * A string is interpreted as port name. 
    9797   * A framework element pointer is interpreted as parent. 
    9898   * tFrameworkElement::tFlags arguments are interpreted as flags. 
    99    * A tQueueSettings argument creates an input queue with the specified settings (not to be used with parameters) 
    100    * tBounds<T> are parameters's bounds. 
    101    * tUnit argument is parameters's unit. 
     99   * tPortCreationInfo<T> argument is copied. This is only allowed as first argument. 
     100   */ 
     101#ifdef _LIB_FINROC_PLUGINS_RPC_PORTS_PRESENT_ 
     102  template <typename T> 
     103  using tServer = tConveniencePort<rpc_ports::tServerPort<T>, tComponent, tFrameworkElement, &tModuleBase::GetServicesParent>; 
     104 
     105  template <typename T> 
     106  using tClient = tConveniencePort<rpc_ports::tClientPort<T>, tComponent, tFrameworkElement, &tModuleBase::GetServicesParent>; 
     107#endif 
     108 
     109  /** 
     110   * Parameter classes to use in modules. 
     111   * 
     112   * Constructors take a variadic argument list... just any properties you want to assign to port/parameter. 
     113   * 
     114   * Parameter name and parent are usually determined automatically (however, only possible when parameter is direct class member). 
     115   * If this is not possible/desired, name needs to be provided as first constructor argument - parent as arbitrary one. 
     116   * 
     117   * A string as first parameter is interpreted as parameter name; Any other string as config entry 
     118   * A framework element pointer is interpreted as parent. 
     119   * tFrameworkElement::tFlags arguments are interpreted as flags. 
     120   * tBounds<T> are parameters' bounds. 
    102121   * const T& is interpreted as parameters's default value. 
    103122   * tPortCreationInfo<T> argument is copied. This is only allowed as first argument. 
     
    107126   * Any further string is interpreted as config entry. 
    108127   */ 
    109 #ifdef _LIB_FINROC_PLUGINS_RPC_PORTS_PRESENT_ 
    110   template <typename T> 
    111   using tServer = tConveniencePort<rpc_ports::tServerPort<T>, tComponent, tFrameworkElement, &tModuleBase::GetServicesParent>; 
    112  
    113   template <typename T> 
    114   using tClient = tConveniencePort<rpc_ports::tClientPort<T>, tComponent, tFrameworkElement, &tModuleBase::GetServicesParent>; 
    115 #endif 
    116  
    117128  template <typename T> 
    118129  class tParameter : public tConveniencePort<parameters::tParameter<T>, tComponent, tFrameworkElement, &tModuleBase::GetParameterParent> 
     
    157168   * \param share_ports Should ports in this interfaces be shared? (so that they can be accessed from other runtime environments) 
    158169   * \param extra_flags Any extra flags to assign to interface 
    159    */ 
    160   core::tPortGroup* CreateInterface(const std::string& name, bool share_ports, tFlags extra_flags = tFlags()); 
     170   * \param default_port_flags Default flags for ports in this interface 
     171   */ 
     172  core::tPortGroup* CreateInterface(const std::string& name, bool share_ports, tFlags extra_flags = tFlags(), tFlags default_port_flags = tFlags()); 
    161173 
    162174  /*! 
Note: See TracChangeset for help on using the changeset viewer.