BHoM / Speckle_Toolkit

GNU Lesser General Public License v3.0
10 stars 2 forks source link

Speckle_Toolkit: pass custom hashcode to the Speckle Serialiser #17

Open alelom opened 5 years ago

alelom commented 5 years ago

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")?

didimitrie commented 5 years ago

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 commented 5 years ago

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!