Ticket #4119 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Merge ValidatorAnyList into ListValidator

Reported by: Russell Taylor Owned by: Alex Buts
Priority: major Milestone: Release 2.0
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Janik Zikovsky

Description

These classes do essentially the same thing. ListValidator is currently only for string properties, but there's no reason why it can't be made more general.

Consider making use of template specialization for methods where it makes sense to keep the string-specific code for string properties.

Change History

comment:1 Changed 9 years ago by Alex Buts

  • Status changed from new to accepted

comment:2 Changed 9 years ago by Alex Buts

refs #4119 Fixes this

But generic validator can not be initiated by strings

Changeset: efa72eab153309124c6b5d61a229a8287d849714

comment:3 Changed 9 years ago by Alex Buts

refs #4119 Fixing Unix error

Changeset: 165150d867b4a3676a661908024472b984936079

comment:4 Changed 9 years ago by Alex Buts

refs #4119 Trying to fix unix error

Changeset: 5c66fc34f113dc38f34e042361ff4d563a979529

comment:5 Changed 9 years ago by Alex Buts

refs #4119 Fixing error with test/ListAnyValidatorTest.h

Trivial mistyped letter in test header

Changeset: 5092f0a363dc1de4f5165227155b1fed6cc0919d

comment:6 Changed 9 years ago by Alex Buts

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

The only way I found to keep current List validator interface is inheriting it from ListAnyValidator and overloading couple of specific functions (not sure if clone needs overloading, but did it anyway)

Using templates would cause access ListValidator (with strings) through ListValidator<>, which would cause large changes everywhere. Did not found any other way of achieving this.

Any generic (not sting) validator accepts new values of its type only -- naturally.

It would be nice to allow initiating this by strings too, and it seems can be done but I have not find way of achieving this quickly. Probably there is the space for another ticket. --> This feature implemented below

Last edited 9 years ago by Alex Buts (previous) (diff)

comment:7 Changed 9 years ago by Alex Buts

refs #4119 Fixed last uncertainty with list validators.

Using template methaprogramming, the function addAllowed value modified to accept any input argument for which lexical cast to target template class exists.

Changeset: 01b6b12e81eb941f43102d941a95faa016da713a

comment:8 Changed 9 years ago by Alex Buts

refs #4119 Minor cosmetic changes

Changeset: e017361642fdfa99f2c9a7445888c1ab499aebfc

comment:9 Changed 9 years ago by Alex Buts

refs #4119 Trying to fix Unix error.

Changeset: 8491163369f22357e4a035fe88961aa7631220b0

comment:10 Changed 9 years ago by Alex Buts

refs #4119 Overload one function in ListValidator to keep python happy

Changeset: 5d8f015691600ccfd589ba6cecc05a13ae3a6ea0

comment:11 Changed 9 years ago by Alex Buts

Any generic validator now can add (ListAnyValidator<type>::addAlowedValue(const TYPE &value)) any TYPE value for which a lexical cast to basic validator type is possible.

Do not work for python though, so for ListValidator::addAlowedValue(const std::string &value)) only string input is possible.

Last edited 9 years ago by Alex Buts (previous) (diff)

comment:12 Changed 9 years ago by Alex Buts

refs #4119 Fixes this

But generic validator can not be initiated by strings

Changeset: efa72eab153309124c6b5d61a229a8287d849714

comment:13 Changed 9 years ago by Alex Buts

refs #4119 Fixing Unix error

Changeset: 165150d867b4a3676a661908024472b984936079

comment:14 Changed 9 years ago by Alex Buts

refs #4119 Trying to fix unix error

Changeset: 5c66fc34f113dc38f34e042361ff4d563a979529

comment:15 Changed 9 years ago by Alex Buts

refs #4119 Fixing error with test/ListAnyValidatorTest.h

Trivial mistyped letter in test header

Changeset: 5092f0a363dc1de4f5165227155b1fed6cc0919d

comment:16 Changed 9 years ago by Alex Buts

refs #4119 Attempt to use templated enable_if to allow string input

Does not work but interesting template options arise.

Changeset: a34651a60e79fd0741d123f92e72bff86bfbb98a

comment:17 Changed 9 years ago by Alex Buts

refs #4119 Fixed last uncertainty with list validators.

Using template methaprogramming, the function addAllowed value modified to accept any input argument for which lexical cast to target template class exists.

Changeset: 01b6b12e81eb941f43102d941a95faa016da713a

comment:18 Changed 9 years ago by Alex Buts

refs #4119 Minor cosmetic changes

Changeset: e017361642fdfa99f2c9a7445888c1ab499aebfc

comment:19 Changed 9 years ago by Alex Buts

refs #4119 Trying to fix Unix error.

Changeset: 8491163369f22357e4a035fe88961aa7631220b0

comment:20 Changed 9 years ago by Alex Buts

refs #4119 Overload one function in ListValidator to keep python happy

Changeset: 5d8f015691600ccfd589ba6cecc05a13ae3a6ea0

comment:21 Changed 9 years ago by Janik Zikovsky

  • Status changed from verify to verifying
  • Tester set to Janik Zikovsky

comment:22 Changed 9 years ago by Janik Zikovsky

Refs #4119: Indentation and extra comments

Changeset: 0401f448e72e8c996c8a2fe90066148a61805918

comment:23 Changed 9 years ago by Janik Zikovsky

  • Status changed from verifying to closed

Passed by code inspection

comment:24 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 4966

Note: See TracTickets for help on using tickets.