Changeset 49:cdd4cf3eda0c in rrlib_rtti_conversion
- Timestamp:
- 08.02.2022 07:22:43 (22 months ago)
- Branch:
- 17.03
- Phase:
- public
- Tags:
- tip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tCompiledConversionOperation.h
r40 r49 95 95 }; 96 96 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)) 98 98 { 99 99 memset(custom_operation_data_storage, 0, sizeof(custom_operation_data_storage)); … … 139 139 { 140 140 assert(flags & tFlag::cRESULT_REFERENCES_SOURCE_DIRECTLY); 141 assert(typeid(tTypedPointer) == *destination_pointer_type && "This convert function required default destination_pointer_type"); 141 142 tTypedConstPointer result(static_cast<const char*>(source_object.GetRawDataPointer()) + fixed_offset_first, type_after_first_fixed_offset); 142 143 if (get_destination_reference_function_first != nullptr) … … 155 156 156 157 /*! 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 /*! 157 166 * \return Flags for conversion operation 158 167 */ … … 217 226 char* custom_operation_data_storage[2 * tCustomOperationData::cMAX_SIZE]; 218 227 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 219 231 tCustomOperationData CustomOperationData(size_t index) 220 232 { -
tConversionOperationSequence.cpp
r46 r49 144 144 } 145 145 146 tCompiledConversionOperation tConversionOperationSequence::Compile(bool allow_reference_to_source, const tType& source_type, const tType& destination_type ) const146 tCompiledConversionOperation tConversionOperationSequence::Compile(bool allow_reference_to_source, const tType& source_type, const tType& destination_type, const std::type_info& destination_pointer_type) const 147 147 { 148 148 // ############ … … 406 406 result.destination_type = last_conversion->destination_type; 407 407 static_cast<tConversionOperationSequence&>(result).intermediate_type = this->intermediate_type; 408 result.destination_pointer_type = &(first_operation == &cFOR_EACH_OPERATION ? typeid(tTypedPointer) : destination_pointer_type); // Special For-Each operation works with standard typed pointers only 408 409 409 410 // Handle special case: only const offsets -
tConversionOperationSequence.h
r3 r49 139 139 * \param source_type Source Type (can be omitted if first operation has fixed source type) 140 140 * \param destination_type Destination Type (can be omitted if last operation has fixed destination type) 141 * \param destination_pointer_type Type of destination_object pointer caller provides to Convert function. Custom types allow conversion operations to provide additional information (timestamps are an example). 141 142 * \throw Throws exception if conversion operation sequence erroneous, ambiguous, or cannot be used to convert specified types 142 143 */ 143 tCompiledConversionOperation Compile(bool allow_reference_to_source, const tType& source_type = tType(), const tType& destination_type = tType() ) const;144 tCompiledConversionOperation Compile(bool allow_reference_to_source, const tType& source_type = tType(), const tType& destination_type = tType(), const std::type_info& destination_pointer_type = typeid(tTypedPointer)) const; 144 145 145 146 /*!
Note: See TracChangeset
for help on using the changeset viewer.