levylabpitt / Transport

VIs for scripting and performing transport measurments.
Other
0 stars 0 forks source link

Control Experiment: XML #46

Closed ciozi137 closed 2 years ago

ciozi137 commented 2 years ago

Saving a class to XML is a hazardous operation, best summed up by "don't do it." We have been living dangerously for a long time and changes made in SMO 1.4.0.66+ have made us face reality.

  1. bad idea to flatten directly class unless it is purely byValue.
  2. If it is, then best is to use a Serializer specifically for your class.
  3. If it is ByReference, you absolutely need a flatten/unflatten method
  4. If it is a mix of ByRef/ByValue (like SMO), I suggest you consider it as a ByRef object.

Base Class ==> Flatten.vi and Unflatten.vi (or Marshal/Unmarshal, or Serialize/Deserialize)

If it works with NI-XML, go for it... but be prepared to have a second-try on error, which would be to do it class-by-class. Each class overrides the parent method and serializes to known format.

--- Francois Normandin

Even though all of the LevyLab SMOs are byValue (as of 1/2022), SMOs are a mixture.

I propose we abandon flattening altogether and pass metadata out of Control Experiment.vi after first stripping the classes themselves. Replace this existing code: image

With something like: image image