1 // Created by: DAUTRY Philippe
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _TDF_IDFilter_HeaderFile
17 #define _TDF_IDFilter_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TDF_IDMap.hxx>
25 #include <TDF_IDList.hxx>
26 #include <Standard_OStream.hxx>
31 //! This class offers filtering services around an ID list.
39 //! Creates an ID/attribute filter based on an ID
40 //! list. The default mode is "ignore all but...".
42 //! This filter has 2 working mode: keep and ignore.
44 //! Ignore/Exclusive mode: all IDs are ignored except
45 //! these set to be kept, using Keep(). Of course, it
46 //! is possible set an kept ID to be ignored using
49 //! Keep/Inclusive mode: all IDs are kept except these
50 //! set to be ignored, using Ignore(). Of course, it
51 //! is possible set an ignored ID to be kept using
53 Standard_EXPORT TDF_IDFilter(const Standard_Boolean ignoreMode = Standard_True);
55 //! The list of ID is cleared and the filter mode is
56 //! set to ignore mode if <keep> is true; false
58 Standard_EXPORT void IgnoreAll (const Standard_Boolean ignore);
60 //! Returns true is the mode is set to "ignore all
62 Standard_Boolean IgnoreAll() const;
64 //! An attribute with <anID> as ID is to be kept and
65 //! the filter will answer true to the question
67 Standard_EXPORT void Keep (const Standard_GUID& anID);
69 //! Attributes with ID owned by <anIDList> are to be kept and
70 //! the filter will answer true to the question
71 //! IsKept(<anID>) with ID from <anIDList>.
72 Standard_EXPORT void Keep (const TDF_IDList& anIDList);
74 //! An attribute with <anID> as ID is to be ignored and
75 //! the filter will answer false to the question
77 Standard_EXPORT void Ignore (const Standard_GUID& anID);
79 //! Attributes with ID owned by <anIDList> are to be
80 //! ignored and the filter will answer false to the
81 //! question IsKept(<anID>) with ID from <anIDList>.
82 Standard_EXPORT void Ignore (const TDF_IDList& anIDList);
84 //! Returns true if the ID is to be kept.
85 Standard_Boolean IsKept (const Standard_GUID& anID) const;
87 //! Returns true if the attribute is to be kept.
88 Standard_Boolean IsKept (const Handle(TDF_Attribute)& anAtt) const;
90 //! Returns true if the ID is to be ignored.
91 Standard_Boolean IsIgnored (const Standard_GUID& anID) const;
93 //! Returns true if the attribute is to be ignored.
94 Standard_Boolean IsIgnored (const Handle(TDF_Attribute)& anAtt) const;
96 //! Copies the list of ID to be kept or ignored in
97 //! <anIDList>. <anIDList> is cleared before use.
98 Standard_EXPORT void IDList (TDF_IDList& anIDList) const;
100 //! Copies into <me> the contents of
101 //! <fromFilter>. <me> is cleared before copy.
102 Standard_EXPORT void Copy (const TDF_IDFilter& fromFilter);
104 //! Writes the contents of <me> to <OS>.
105 Standard_EXPORT void Dump (Standard_OStream& anOS) const;
119 //! Private, to forbid implicit or hidden accesses to
120 //! the copy constructor.
121 Standard_EXPORT TDF_IDFilter(const TDF_IDFilter& aFilter);
124 Standard_Boolean myIgnore;
131 #include <TDF_IDFilter.lxx>
137 #endif // _TDF_IDFilter_HeaderFile