FIX: Downcast of Data #7
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The toPython method in PythonFactory has 2 purposes:
the key used for this map was BaseData::GetClass()->templateName, which happens to always be an empty string (dunno what this variable is actually supposed to store, but in the case of Data, it's alwas an empty string for me....) Thus, if a data is detected to be a "DataString" for instance, this type will be stored in a map, under the key "" (emptyString), and the next time a data must be retrieved, let's say a vector, the code will look at its templateName ("" emptyString), look into the downcast map for an existing type for this key, and return a DataString instead of a DataContainer...
This PR replaces the use of tempalteName as a key for the map, with the data's typeInfo->name(), thus effectively storing the right key in the map.