NewFileConstraint.h

Classes

NewFileConstraint -- Constrain a string to be a new (non-existent) file (full description)

class NewFileConstraint : public ParameterConstraint<String>

Interface

Public Members
NewFileConstraint(Bool deleteIfExists = True)
NewFileConstraint(const NewFileConstraint &other)
NewFileConstraint &operator=(const NewFileConstraint &other)
~NewFileConstraint()
virtual Bool valueOK(const String &value, String &error) const
virtual ParameterConstraint<String> *clone() const

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

Use this if you want a New File.

Synopsis

NewFileConstraint is a parameter constraint that is intended to be used for String parameters which are interpreted as output file names. It uses class NewFile to determine if the file has to be deleted before using it.

Example

Parameter outfile(inputRecord, "outfile", ParameterSet::In); outfile.setConstraint(NewFileConstraint());

Motivation

Output file names are fairly common parameters, this consolidates the error checking and "remove if it already exists" logic.

To Do

Member Description

NewFileConstraint(Bool deleteIfExists = True)

Currently the deleteIfExists argument has no affect

NewFileConstraint(const NewFileConstraint &other)

Copy constructor (copy semantics)

NewFileConstraint &operator=(const NewFileConstraint &other)

Assignment (copy semantics)

~NewFileConstraint()

Destructor

virtual Bool valueOK(const String &value, String &error) const

Indicates whether the specified string is a valid new file, invoking the choice GUI. If it returns False, an error message is returned.

virtual ParameterConstraint<String> *clone() const

Set the constraint