Salome HOME
Extension of Parameters interface: to set/get double values of results
[modules/shaper.git] / src / ModuleBase / ModuleBase_FilterFactory.h
index bf6986b80fe0e137b7644e95afd5c61410ac9d94..c1a7e36014e37118b1cf74b38baef0bc41f1e624 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        ModuleBase_FilterFactory.h
 // Created:     10 Dec 2014
 // Author:      Natalia ERMOLAEVA
@@ -7,85 +9,54 @@
 
 #include "ModuleBase.h"
 #include "ModuleBase_IWorkshop.h"
+#include "ModuleBase_Filter.h"
+
+#include <SelectMgr_ListOfFilter.hxx>
 
 #include <map>
 #include <set>
 
-class ModuleBase_Filter;
-
 /**
+ * \ingroup GUI
  * Allows to get a selection filter by the feature identifier and 
  * the attribute identifier (if attribute is validated).
  * All accessible filters must be registered by the ID string first.
  * The instance of this factory can be get in the Workshop interface.
- * Keeps the validator objects alive and just returns one of it by request.
- * All the needed information is provided to the validator as an argument,
+ * Keeps the filter objects alive and just returns one of it by request.
+ * All the needed information is provided to the filter as an argument,
  * this allows to work with them independently from the feature specific object.
  */
 class ModuleBase_FilterFactory : public QObject
 {
- public:
-
-   //ModuleBase_FilterFactory();
-   //virtual ~ModuleBase_FilterFactory() {}
-
-
  private:
-  std::map<std::string, ModuleBase_Filter*> myIDs;  ///< map from ID to registered validator
-  /// validators IDs to list of arguments
-  typedef std::map<std::string, std::list<std::string> > AttrValidators;
-  /// validators IDs by feature ID
-  std::map<std::string, AttrValidators> myFeatures;
-  /// validators IDs and arguments by feature and attribute IDs
-  std::map<std::string, std::map<std::string, AttrValidators> > myAttrs;
-  /// Stores the registered attributes that leads to the concealment of referenced objects in 
-  /// data tree. Map from feature kind to set of attribute IDs.
-  std::map<std::string, std::set<std::string> > myConcealed;
+  std::map<std::string, ModuleBase_Filter*> myIDs;  ///< map from ID to registered filter
+  /// filters IDs to list of arguments
+  typedef std::map<std::string, std::list<std::string> > AttrFilters;
+  /// filters IDs by feature ID
+  std::map<std::string, AttrFilters> myFeatures;
+  /// filters IDs and arguments by feature and attribute IDs
+  std::map<std::string, std::map<std::string, AttrFilters> > myAttrs;
 
  public:
-  /// Registers the instance of the validator by the ID
+  /// Registers the instance of the filter by the ID
   MODULEBASE_EXPORT virtual void registerFilter(const std::string& theID,
-                                                ModuleBase_Filter* theValidator);
+                                                ModuleBase_Filter* theFilter);
 
-  /// Assigns validator to the attribute of the feature
+  /// Assigns filter to the attribute of the feature
   MODULEBASE_EXPORT virtual void assignFilter(const std::string& theID,
-                                            const std::string& theFeatureID,
-                                            const std::string& theAttrID);
+                                              const std::string& theFeatureID,
+                                              const std::string& theAttrID,
+                                              const std::list<std::string>& theArguments);
 
-  /// Provides a validator for the feature, returns NULL if no validator
-  MODULEBASE_EXPORT virtual void validators(const std::string& theFeatureID,
-                                       std::list<ModuleBase_Filter*>& theResult,
-                                       std::list<std::list<std::string> >& theArguments) const;
-  /// Provides a validator for the attribute, returns NULL if no validator
-  MODULEBASE_EXPORT virtual void validators(const std::string& theFeatureID,
-                                       const std::string& theAttrID,
-                                       std::list<ModuleBase_Filter*>& theValidators,
-                                       std::list<std::list<std::string> >& theArguments) const;
+  /// Provides a filter for the attribute, returns NULL if no filter
+  MODULEBASE_EXPORT void filters(const std::string& theFeatureID,
+                                 const std::string& theAttrID,
+                                 SelectMgr_ListOfFilter& theFilters) const;
 
-  /// Returns registered validator by its Id
-  MODULEBASE_EXPORT virtual const ModuleBase_Filter* validator(const std::string& theID) const;
-
-  /// Returns true if feature and all its attributes are valid.
-  MODULEBASE_EXPORT virtual bool validate(const std::shared_ptr<ModelAPI_Feature>& theFeature) const;
-
-  /// register that this attribute in feature is not obligatory for the feature execution
-  /// so, it is not needed for the standard validation mechanism
-  virtual void registerNotObligatory(std::string theFeature, std::string theAttribute);
-
-  /// Returns true if the attribute in feature is not obligatory for the feature execution
-  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
-
-  /// register that this attribute conceals in the object browser
-  /// all referenced features after execution
-  virtual void registerConcealment(std::string theFeature, std::string theAttribute);
-
-  /// Returns true that it was registered that attribute conceals the referenced result
-  virtual bool isConcealed(std::string theFeature, std::string theAttribute);
+  /// Returns registered filter by its Id
+  MODULEBASE_EXPORT virtual const ModuleBase_Filter* filter(const std::string& theID) const;
 
 protected:
-  void addDefaultValidators(std::list<ModuleBase_Filter*>& theValidators) const;
-  /// Get instance from workshop
-
   ModuleBase_FilterFactory();
 
   ~ModuleBase_FilterFactory() {}