0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / IFSelect / IFSelect_SelectExtract.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-11-17
2// Created by: Christian CAILLET
3// Copyright (c) 1992-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _IFSelect_SelectExtract_HeaderFile
18#define _IFSelect_SelectExtract_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <IFSelect_SelectDeduct.hxx>
25#include <Standard_Integer.hxx>
26class Interface_EntityIterator;
27class Interface_Graph;
28class Standard_Transient;
29class Interface_InterfaceModel;
30class TCollection_AsciiString;
31
32
33class IFSelect_SelectExtract;
34DEFINE_STANDARD_HANDLE(IFSelect_SelectExtract, IFSelect_SelectDeduct)
35
36//! A SelectExtract determines a list of Entities from an Input
37//! Selection, as a sub-list of the Input Result
38//! It works by applying a sort criterium on each Entity of the
39//! Input. This criterium can be applied Direct to Pick Items
40//! (default case) or Reverse to Remove Item
41//!
42//! Basic features (the unique Input) are inherited from SelectDeduct
43class IFSelect_SelectExtract : public IFSelect_SelectDeduct
44{
45
46public:
47
48
49 //! Returns True if Sort criterium is Direct, False if Reverse
50 Standard_EXPORT Standard_Boolean IsDirect() const;
51
52 //! Sets Sort criterium sense to a new value
53 //! (True : Direct , False : Reverse)
54 Standard_EXPORT void SetDirect (const Standard_Boolean direct);
55
56 //! Returns the list of selected entities. Works by calling the
57 //! method Sort on each input Entity : the Entity is kept as
58 //! output if Sort returns the same value as Direct status
79104795 59 Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
42cf5bc1 60
61 //! Returns True for an Entity if it satisfies the Sort criterium
62 //! It receives :
63 //! - <rank>, the rank of the Entity in the Iteration,
64 //! - <ent> , the Entity itself, and
65 //! - <model>, the Starting Model
66 //! Hence, the Entity to check is "model->Value(num)" (but an
67 //! InterfaceModel allows other checks)
68 //! This method is specific to each class of SelectExtract
69 Standard_EXPORT virtual Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const = 0;
70
71 //! Works as Sort but works on the Graph
72 //! Default directly calls Sort, but it can be redefined
73 //! If SortInGraph is redefined, Sort should be defined even if
74 //! not called (to avoid deferred methods in a final class)
75 Standard_EXPORT virtual Standard_Boolean SortInGraph (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Interface_Graph& G) const;
76
77 //! Returns a text saying "Picked" or "Removed", plus the
78 //! specific criterium returned by ExtractLabel (see below)
79104795 79 Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
42cf5bc1 80
81 //! Returns a text defining the criterium for extraction
82 Standard_EXPORT virtual TCollection_AsciiString ExtractLabel() const = 0;
83
84
85
86
92efcf78 87 DEFINE_STANDARD_RTTIEXT(IFSelect_SelectExtract,IFSelect_SelectDeduct)
42cf5bc1 88
89protected:
90
91
92 //! Initializes a SelectExtract : enforces the sort to be Direct
93 Standard_EXPORT IFSelect_SelectExtract();
94
95
96
97private:
98
99
100 Standard_Boolean thesort;
101
102
103};
104
105
106
107
108
109
110
111#endif // _IFSelect_SelectExtract_HeaderFile