Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speckle_Toolkit: pass custom hashcode to the Speckle Serialiser #17

Open
alelom opened this issue Jun 13, 2019 · 2 comments
Open

Speckle_Toolkit: pass custom hashcode to the Speckle Serialiser #17

alelom opened this issue Jun 13, 2019 · 2 comments
Assignees
Labels
type:question Ask for further details or start conversation

Comments

@alelom
Copy link
Member

alelom commented Jun 13, 2019

Scenario

Tell speckle "how to diff" based on the specified objects' Hashcode.

For some (quite convoluted/do not ask) reason, we would like to calculate the Hash for the BHoMObject externally to the object, not overriding/calling bhomObject.GetHashCode(), in order to pass it to Speckle's Serialise method (see question below).

Question

With reference to the Serialise method of Speckle:
https://github.com/speckleworks/SpeckleCore/blob/9545e96f04d85f46203a99c21c76eeea0ea03dae/SpeckleCore/Conversion/ConverterSerialisation.cs#L39-L53

is it possible to pass a custom HashCode, perhaps in the Dictionary<int, string> traverse parameter? If so, how am I supposed to populate the string part of the dictionary (which apparently represents some sort of "path")?

@alelom alelom added the type:question Ask for further details or start conversation label Jun 13, 2019
@didimitrie
Copy link
Member

Gotcha. Nevertheless, that's the default system method and i'm using it solely for speckle abstract inner references.

Ie, if you're passing through abstract bhom objects, it's up to you to override that in your classes.

If you actually want to override the hash of a speckle object, you can just set it, it's public!

@alelom
Copy link
Member Author

alelom commented Jun 13, 2019

If you actually want to override the hash of a speckle object, you can just set it, it's public!

Should've checked better, as usual. This might just work for us. Thanks!

@epignatelli epignatelli removed their assignment Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Ask for further details or start conversation
Projects
None yet
Development

No branches or pull requests

3 participants