FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Rework the property factory to allow stream specific factories, and tweak the logic for deciding whether a property value should be padded. by Numpsy · Pull Request #108 · openmcdf/openmcdf · GitHub

Rework the property factory to allow stream specific factories, and tweak the logic for deciding whether a property value should be padded. - #108

Merged
ironfede merged 2 commits into
openmcdf:masterfrom
Numpsy:users/rw/factory_rework
Aug 6, 2024
Merged

ironfede merged 2 commits into
openmcdf:masterfrom
Numpsy:users/rw/factory_rework

Conversation

Numpsy commented Feb 12, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

A few experiments based on #99 and the comments in #98 -

Instead of having a single, singleton instance of a property factory, which is accessed in several places, instead pass an instance of the factory around, and decide which factory to use at a higher level.

When creating a property via the factory, pass the identifier of the property into the factory, so that it can make property specific choices in which property type to use when needed (mainly to use VtUnalignedString for a couple of string properties, rather than VtString)

Add an additional property factory for the DocumentSummaryInformation stream which has specific knowledge of a couple of unaligned string properties.

Also added the unit test and extra test file from #99 / #98 as a test case for a file that isn't currently read correctly.

Numpsy force-pushed the users/rw/factory_rework branch from 45c58fe to eac03ef Compare February 13, 2024 00:12

ironfede commented Feb 19, 2024
edited
Loading

Copy link
Copy Markdown
Collaborator

Many thanks @Numpsy :I don't think that a solution for the underlying issue can be "super-clean" from a code perspective since the issue derives from a tangled specifc in itself. So I think you should go on on with your experiments towards a fully working solution and only after that starting to think about a clean-up refactoring. I'm sorry for being not-active on this thread but I'm currently out of time to better follow all discussions and evolution of code. Thank you anyway for your developments.

internal class PropertyFactory
internal abstract class PropertyFactory
{
private static ThreadLocal<PropertyFactory> instance

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

As it stands, the factory class is stateless, so I don't know why it needs to be ThreadLocal? (if not, that change could be broken out into a separate PR to make things simpler here)

Numpsy force-pushed the users/rw/factory_rework branch from eac03ef to 53c5f67 Compare February 19, 2024 23:21

Numpsy commented Feb 25, 2024

Copy link
Copy Markdown
Contributor Author

I'll have another look now the other changes are merged (I realised whilst testing those that the current code here is wrong, as it tries to use DocumentSummaryInfoPropertyFactory for user defined properties, which doesn't work because you can't determine the behavior based on property identifier for that)

Numpsy force-pushed the users/rw/factory_rework branch 2 times, most recently from 198be02 to 98c03ee Compare February 27, 2024 23:55
…weak the logic for deciding whether a property value should be padded.
Numpsy force-pushed the users/rw/factory_rework branch from 98c03ee to fd397a3 Compare March 7, 2024 23:07
Numpsy changed the title [WIP] Experiments with the property factory, and the logic to decide … Rework the property factory to allow stream specific factories, and tweak the logic for deciding whether a property value should be padded. Mar 7, 2024

Numpsy commented Mar 7, 2024

Copy link
Copy Markdown
Contributor Author

Rebased onto the other recent changes, and tweaked a little to minimze the changes (the changes in TypedPropertyValue.cs look bigger than they really are due to bracing / indentation changes)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL