Ticket #4949 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Remove templates from IValidator interface.

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Release 2.1
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Owen Arnold

Description

Templating the class makes it very difficult to use without know the type of the property it is attached to. We can alleviate this by making the checkValidity method use a boost::any instance. The isValid method can be left templated so that the interface is not polluted with boost::any.

This will make writing Python algorithms much simpler as a single validator type can be used.

Comments from Russell

We love changes that modify huge number of files :)
Option 2 seems to have more merit to me. Would be good to keep boost::any pretty well encapsulated though.

While we're at it I think we should do a couple of other things:
 - lose the bare pointers and the need for the clone() method.
 - only include concrete validators in algorithms that actually need them (i.e. take them out of Algorithm.h and the like)

As an aside, when in the distant past I tried to allow const workspace properties (e.g. WorkspaceProperty<const MatrixWorkspace>) my recollection is that it was the validators that prevented that (or made it too hard for me at the time). This might help with that.

Russell

Change History

comment:1 Changed 9 years ago by Martyn Gigg

  • Summary changed from Remove templates from IVAlidator interface. to Remove templates from IValidator interface.

comment:2 Changed 9 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:3 Changed 9 years ago by Martyn Gigg

Refs #4949. Remove TYPE from IValidator interface.

Touches nearly everything unfortunately but is necessary.

Changeset: c20c02a8c1ae21c0cfa7a8ca1828e1635c22930f

comment:4 Changed 9 years ago by Martyn Gigg

Refs #4949. Fix the build.

MSVC can't deduce type from make_shared if it is assigned to a superclass_sptr

Changeset: 46b57d605e799c6d86c39d9b2369a66cb5ee5bee

comment:5 Changed 9 years ago by Martyn Gigg

Refs #4949. MSVC fixes for make_shared

Changeset: 945d2cb4ffeeff6b0dff19c6872ea0027df43ad9

comment:6 Changed 9 years ago by Martyn Gigg

Refs #4949. Fix Python enum exports.

Changeset: a9c659a9fe0d17dae06fa626c487a9e4488e8560

comment:7 Changed 9 years ago by Martyn Gigg

Refs #4949. Catch another use of cend which the Mac doesn't have

Changeset: c0833defb73353fa437ea52e32921a7a1c7bc8c4

comment:8 Changed 9 years ago by Martyn Gigg

Refs #4949. Other default value make_shared references.

Changeset: 0ce3342929c40f92034875817303bd038660e7b3

comment:9 Changed 9 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

I couldn't get rid of the clone method unfortunately as I need it in Python. WIKI page at http://www.mantidproject.org/Writing_A_Validator

comment:10 Changed 8 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:11 Changed 8 years ago by Owen Arnold

  • Status changed from verifying to closed

Generics removed. Everything else seems to be working.

comment:12 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 5795

Note: See TracTickets for help on using tickets.