Salome HOME
Unit tests for already implemented filters.
[modules/shaper.git] / src / FiltersAPI / FiltersAPI_Filter.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 FILTERSAPI_FILTER_H_
21 #define FILTERSAPI_FILTER_H_
22
23 #include "FiltersAPI.h"
24
25 #include <ModelHighAPI_Dumper.h>
26 #include <ModelHighAPI_Selection.h>
27
28 class ModelAPI_Attribute;
29
30 /**\class FiltersAPI_Filter
31  * \ingroup CPPHighAPI
32  * \brief Interface for the Filter
33  */
34 class FiltersAPI_Filter
35 {
36 public:
37   FILTERSAPI_EXPORT
38   FiltersAPI_Filter(
39       const std::string& theName,
40       const bool theRevertFilter = false,
41       const std::list<ModelHighAPI_Selection>& theArguments = std::list<ModelHighAPI_Selection>());
42
43   // Internal constructor based on filter arguments
44   FILTERSAPI_EXPORT
45   FiltersAPI_Filter(const std::string& theName,
46                     const std::list<std::shared_ptr<ModelAPI_Attribute> >& theArguments);
47
48   /// Destructor
49   FILTERSAPI_EXPORT
50   virtual ~FiltersAPI_Filter();
51
52   const std::string& name() const { return myName; }
53   bool isReversed() const { return myReversed; }
54   const std::list<ModelHighAPI_Selection>& arguments() const { return myFilterArguments; }
55
56   /// Dump wrapped feature
57   FILTERSAPI_EXPORT
58   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
59
60 private:
61   std::string myName;
62   bool myReversed;
63   std::list<ModelHighAPI_Selection> myFilterArguments;
64 };
65
66 typedef std::shared_ptr<FiltersAPI_Filter> FilterAPIPtr;
67
68 /// Create list of filters
69 FILTERSAPI_EXPORT FilterAPIPtr
70 addFilter(const std::string& name = std::string(),
71           const bool exclude = false,
72           const std::list<ModelHighAPI_Selection>& args = std::list<ModelHighAPI_Selection>());
73
74 #endif