Changeset 9:f909044a9f7b in rrlib_rtti_conversion for tRegisteredConversionOperation.cpp


Ignore:
Timestamp:
22.09.2017 01:26:15 (2 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Adds option to specify type conversions operations that are not usually combined (you could call combinations deprecated) and fixes various bugs found with unit test in finroc_plugins_runtime_construction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tRegisteredConversionOperation.cpp

    r7 r9  
    7474 
    7575tRegisteredConversionOperation::tRegisteredConversionOperation(util::tManagedConstCharPointer name, const tSupportedTypes& supported_source_types, const tSupportedTypes& supported_destination_types, 
    76     const tConversionOption* single_conversion_option, const tParameterDefinition& parameter) : 
     76    const tConversionOption* single_conversion_option, const tParameterDefinition& parameter, const tRegisteredConversionOperation* not_usually_combined_with) : 
    7777  name(std::move(name)), 
    7878  supported_source_types(supported_source_types), 
    7979  supported_destination_types(supported_destination_types), 
    8080  parameter(parameter), 
    81   single_conversion_option(single_conversion_option) 
     81  single_conversion_option(single_conversion_option), 
     82  not_usually_combined_with_handle(not_usually_combined_with ? not_usually_combined_with->GetHandle() : 0xFFFF) 
    8283{ 
    8384  if (parameter && (!(parameter.GetType().GetTypeTraits() & trait_flags::cIS_STRING_SERIALIZABLE))) 
     
    9495  parameter(), 
    9596  single_conversion_option(nullptr), 
    96   handle(-1) 
     97  handle(-1), 
     98  not_usually_combined_with_handle(0xFFFF) 
    9799{ 
    98100  handle = static_cast<decltype(handle)>(tRegisteredConversionOperation::RegisteredOperations().operations.Add(this)); 
     
    191193    if (name == operation->Name()) 
    192194    { 
    193       auto option = operation->GetConversionOption(source_type, destination_type, nullptr); 
     195      auto option = operation->GetConversionOption((!source_type) && operation->SupportedSourceTypes().filter == tSupportedTypeFilter::SINGLE ? operation->SupportedSourceTypes().single_type : source_type, 
     196                    (!destination_type) && operation->SupportedDestinationTypes().filter == tSupportedTypeFilter::SINGLE ? operation->SupportedDestinationTypes().single_type : destination_type, nullptr); 
    194197      if (option.type != tConversionOptionType::NONE) 
    195198      { 
Note: See TracChangeset for help on using the changeset viewer.