Changeset 49:cdd4cf3eda0c in rrlib_rtti_conversion for tCompiledConversionOperation.h


Ignore:
Timestamp:
08.02.2022 07:22:43 (12 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Tags:
tip
Message:

Allows to specify destination object pointer type passed to Convert function. Custom types may allow conversion operations to provide additional information (timestamps are an example).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tCompiledConversionOperation.h

    r40 r49  
    9595  }; 
    9696 
    97   tCompiledConversionOperation() : tConversionOperationSequence(), conversion_function_first(nullptr), conversion_function_final(nullptr), fixed_offset_first(0), fixed_offset_final(0), flags(0) 
     97  tCompiledConversionOperation() : tConversionOperationSequence(), conversion_function_first(nullptr), conversion_function_final(nullptr), fixed_offset_first(0), fixed_offset_final(0), flags(0), destination_pointer_type(&typeid(tTypedPointer)) 
    9898  { 
    9999    memset(custom_operation_data_storage, 0, sizeof(custom_operation_data_storage)); 
     
    139139  { 
    140140    assert(flags & tFlag::cRESULT_REFERENCES_SOURCE_DIRECTLY); 
     141    assert(typeid(tTypedPointer) == *destination_pointer_type && "This convert function required default destination_pointer_type"); 
    141142    tTypedConstPointer result(static_cast<const char*>(source_object.GetRawDataPointer()) + fixed_offset_first, type_after_first_fixed_offset); 
    142143    if (get_destination_reference_function_first != nullptr) 
     
    155156 
    156157  /*! 
     158   * return Type of destination_object used when calling Convert 
     159   */ 
     160  const std::type_info& DestinationPointerType() const 
     161  { 
     162    return *destination_pointer_type; 
     163  } 
     164 
     165  /*! 
    157166   * \return Flags for conversion operation 
    158167   */ 
     
    217226  char* custom_operation_data_storage[2 * tCustomOperationData::cMAX_SIZE]; 
    218227 
     228  /*! Type of destination_object used calling Convert; may be subclass of tTypedPointer; set when compiling */ 
     229  const std::type_info* destination_pointer_type; 
     230 
    219231  tCustomOperationData CustomOperationData(size_t index) 
    220232  { 
Note: See TracChangeset for help on using the changeset viewer.