Refactoring #1730

Refactor ICompositeSample hierarchy

Added by pospelov about 4 years ago. Updated about 4 years ago.

Status:ResolvedStart date:06 Dec 2016
Priority:NormalDue date:
Assignee:pospelov% Done:


Target version:Sprint 33


To implement #1624 (#1562 is also related), we might have to provide the following

  • Turn lots of ISample into ICompositeSample to make possible access to composed members.

like InterferenceFunction2D which should provide access to DecayFunction via tree hierarchy

  • include Beam, Detector and many other non-ISample classes into tree hierarchy

to be able to see "wavelength" in a list of fit parameters

  • Make possible to notify parent if parameter of child has changed

if we fit parameters of decay function, the parent (i.e. InterferenceFunction) has to be notified to update pre-calculated variables.

Folowing is proposed:

  • Remove distinction between ISample and ICompositeSample
  • Introduce new “INode” between IParameterized and ISample

INode will be a base class for all items composing a tree hierarchy, with vector of children, and possibly the pointer to the parent.

  • Leave ISample with few methods like “containMagneticMaterial”
  • Remove ICompositeSample class

move registerChild() and similar on board of ISample
all ISample will get ICompositeSample functionality

  • Introduce INode

An empty class between IParameterized and ISample

  • Move registerChild() and Co from ISample on board to INode
  • Make INode actually own its children

which is not the case now in the case of ICompositeSample

  • Consider making INode to know its parent

to be able to notify parent on parameter change
for automatic remove of INode from parent's children on ~INode() destruction

  • Introduce additional callbacks in IParameterized

to notify any possible client about registered parameter change

  • Consider getting rid of "double *" in RealParameter in the favor of lambda-like setters


#1 Updated by pospelov about 4 years ago

  • Status changed from Backlog to Rfc
  • Target version set to Sprint 33

#2 Updated by pospelov about 4 years ago

  • Status changed from Rfc to Sprint
  • Assignee set to pospelov

Then I start slowly via focused pull requests to have only few changes at a time.

#3 Updated by pospelov about 4 years ago

  • Status changed from Sprint to Resolved

Also available in: Atom PDF