Changeset ddceb1 for src/Parameters


Ignore:
Timestamp:
May 8, 2017, 1:54:50 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
ForceAnnealing_goodresults, ForceAnnealing_tocheck
Children:
7630e3
Parents:
ac3a04
git-author:
Frederik Heber <heber@…> (03/31/17 19:18:12)
git-committer:
Frederik Heber <frederik.heber@…> (05/08/17 13:54:50)
Message:

Action::outputAsPython() access Parameters via getAsStringUnvalidated().

  • otherwise this would not work for Geometry Actions as these cannot yet be validated on e.g. dry-run.
  • as python commands operate via string arguments anyway, this is nothing but an additional transformation.
Location:
src/Parameters
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Parameters/Parameter.hpp

    rac3a04 rddceb1  
    4848  bool isValidAsString(const std::string &_value) const throw(ParameterValidatorException);
    4949  const std::string getAsString() const throw(ParameterValueException);
     50  const std::string getAsStringUnvalidated() const throw(ParameterValueException);
    5051  void setAsString(const std::string &_value) throw(ParameterValueException);
    5152
  • src/Parameters/Parameter_impl.hpp

    rac3a04 rddceb1  
    165165  try {
    166166    return value.getAsString();
     167  } catch(ParameterException &e) {
     168    e << ParameterName(ParameterInterface::getName());
     169    throw;
     170  }
     171}
     172
     173/** Catch call to value.getAsStringUnvalidated() to add exception information.
     174 *
     175 * @return parameter value as string
     176 */
     177template<typename T>
     178inline const std::string Parameter<T>::getAsStringUnvalidated() const throw(ParameterValueException)
     179{
     180  try {
     181    return value.getAsStringUnvalidated();
    167182  } catch(ParameterException &e) {
    168183    e << ParameterName(ParameterInterface::getName());
  • src/Parameters/Specifics/Value_vector.cpp

    rac3a04 rddceb1  
    190190const std::string Value<Vector>::getAsString() const throw(ParameterValueException)
    191191{
     192  converted_value = parseAsVector(value);
     193  if (!ValueSet) throw ParameterValueException();
     194  if (!isValid(converted_value)) throw ParameterValueException();
    192195  return value;
    193196}
    194197
     198const std::string Value<Vector>::getAsStringUnvalidated() const throw(ParameterValueException)
     199{
     200  if (!ValueSet) throw ParameterValueException();
     201  return value;
     202}
    195203
    196204void Value<Vector>::setAsString(const std::string &_value) throw(ParameterException)
  • src/Parameters/Specifics/Value_vector.hpp

    rac3a04 rddceb1  
    5353  bool isValidAsString(const std::string &_value) const throw(ParameterValidatorException);
    5454  const std::string getAsString() const throw(ParameterValueException);
     55  const std::string getAsStringUnvalidated() const throw(ParameterValueException);
    5556  void setAsString(const std::string &_value) throw(ParameterException);
    5657
  • src/Parameters/Value.hpp

    rac3a04 rddceb1  
    8585  bool isValidAsString(const std::string &_value) const throw(ParameterValidatorException);
    8686  const std::string getAsString() const throw(ParameterValueException);
     87  const std::string getAsStringUnvalidated() const throw(ParameterValueException);
    8788  void setAsString(const std::string &_value) throw(ParameterException);
    8889
  • src/Parameters/Value_impl.hpp

    rac3a04 rddceb1  
    184184{
    185185  return toString(get());
     186}
     187
     188/** Getter of unvalidated value, returning string.
     189 *
     190 * @return string value
     191 */
     192template <class T>
     193inline const std::string Value<T>::getAsStringUnvalidated() const throw(ParameterValueException)
     194{
     195  return toString(getUnvalidated());
    186196}
    187197
Note: See TracChangeset for help on using the changeset viewer.