1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_FeatureValidator.h
5 // Author: Vitaly SMETANNIKOV
7 #ifndef Model_FeatureValidator_H
8 #define Model_FeatureValidator_H
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_FeatureValidator.h>
18 /**\class Model_FeatureValidator
20 * \brief The geneneric validator for the whole feature.
22 * Can be redefined for some specific feature, but by default for each feature this validator is
23 * used: it checks each argument of the feature and if one of it is not valid (and obligatory),
24 * the hole feature is invalid.
26 class Model_FeatureValidator : public ModelAPI_FeatureValidator
28 // not obligatory attributes, not checked for initialization
29 std::map<std::string, std::set<std::string> > myNotObligatory;
31 /// Returns true if feature and/or attributes are valid
32 /// \param theFeature the validated feature
33 /// \param theArguments the arguments in the configuration file for this validator
34 /// \param theError erros message produced by validator to the user if it fails
35 /// \returns true if feature is valid
36 MODEL_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
37 const std::list<std::string>& theArguments,
38 Events_InfoMessage& theError) const;
40 /// sets not obligatory attributes, not checked for initialization
41 virtual void registerNotObligatory(std::string theFeature, std::string theAttribute);
43 /// Returns true if the attribute in feature is not obligatory for the feature execution
44 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);