Salome HOME
Separate classes related to Filters in Model/ModelAPI
[modules/shaper.git] / src / ModelAPI / ModelAPI_FiltersFactory.h
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef ModelAPI_FiltersFactory_H_
21 #define ModelAPI_FiltersFactory_H_
22
23 #include "ModelAPI_Feature.h"
24 #include "ModelAPI_Filter.h"
25
26 #include <GeomAPI_Shape.h>
27
28
29 /**\class ModelAPI_FiltersFactory
30 * \ingroup DataModel
31 * \brief Manages registering of filters
32 */
33 class ModelAPI_FiltersFactory
34 {
35 public:
36   /// Register an instance of a filter
37   /// \param theID unique identifier of the filter, not necessary equal to the name of filter
38   /// \param theFilter the filter's instance
39   virtual void registerFilter(const std::string& theID, ModelAPI_Filter* theFilter) = 0;
40
41   /// Returns true if all filters of the Filters feature are ok for the Shape (taking into account
42   /// the Reversed states).
43   /// \param theFiltersFeature feature that contains all information about the filters
44   /// \param theShape the checked shape
45   virtual bool isValid(FeaturePtr theFiltersFeature, GeomShapePtr theShape) = 0;
46
47   /// Returns the filters that support the given shape type
48   virtual std::list<FilterPtr> filters(GeomAPI_Shape::ShapeType theType) = 0;
49
50   /// Returns a filter by ID
51   virtual FilterPtr filter(std::string theID) = 0;
52
53   /// Returns a filter ID by the filter pointer
54   virtual std::string id(FilterPtr theFilter) = 0;
55
56 protected:
57   /// Get instance from Session
58   ModelAPI_FiltersFactory() {}
59 };
60
61 #endif