Dynamic plugins: how to create instances of IDiffSpread

Using some class variables that are basically IDiffSpreads (but that aren’t used as input or output pins) would be handy.

I can easily create my own Spreads bu using

ISpread<uint> mySpread = new Spread<uint>();

but I don’t know if and how I could have something similar for an IDiffSpread. That would be nice, since I could easily know if something has changed.

IDiffSpread<uint> myDiffSpread = ???;

IDiffSpread is only implemented by the managed pin wrapper classes which in turn ask the underlying native pin whether or not the data changed between the last evaluation and now.

however the Spread class manages a changed flag itself, which gets set whenever something gets written to it. it doesn’t compare the value, it simply sets the flag to true if some value gets assigned to any of its slices. to reset the flag you’ll need to call the method Flush.

Spread<uint> mySpread = new Spread<uint>();
// or simply
var mySpread = new Spread<uint>();
mySpread[0](0) = 1;
// mySpread.IsChanged == true
mySpread.Flush();
// mySpread.IsChanged == false

but i don’t see how that little feature would be useful…it was merely introduced in order to keep marshaling costs to a minimum.

Thanks for the info, I’ll find out what can be useful in my case…