Salome HOME
Update the doxygen documentation
[modules/shaper.git] / src / Model / Model_FeatureValidator.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_FeatureValidator.h
4 // Created:     8 Jul 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef Model_FeatureValidator_H
8 #define Model_FeatureValidator_H
9
10 #include <Model.h>
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_FeatureValidator.h>
13
14 #include <memory>
15 #include <set>
16 #include <map>
17
18 /**\class Model_FeatureValidator
19  * \ingroup DataModel
20  * \brief The geneneric validator for the whole feature.
21  *
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.
25  */
26 class Model_FeatureValidator : public ModelAPI_FeatureValidator
27 {
28   // not obligatory attributes, not checked for initialization
29   std::map<std::string, std::set<std::string> > myNotObligatory;
30 public:
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   /// \returns true if feature is valid
35   MODEL_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
36     const std::list<std::string>& theArguments) const;
37
38   /// sets not obligatory attributes, not checked for initialization
39   virtual void registerNotObligatory(std::string theFeature, std::string theAttribute);
40
41   /// Returns true if the attribute in feature is not obligatory for the feature execution
42   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
43 };
44
45 #endif