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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IFSelect_Dispatch_HeaderFile
18 #define _IFSelect_Dispatch_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Transient.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 class TCollection_HAsciiString;
27 class IFSelect_Selection;
28 class Interface_InterfaceError;
29 class IFSelect_SelectionIterator;
30 class TCollection_AsciiString;
31 class Interface_EntityIterator;
32 class Interface_Graph;
33 class IFGraph_SubPartsIterator;
36 class IFSelect_Dispatch;
37 DEFINE_STANDARD_HANDLE(IFSelect_Dispatch, Standard_Transient)
39 //! This class allows to describe how a set of Entities has to be
40 //! dispatched into resulting Packets : a Packet is a sub-set of
41 //! the initial set of entities.
43 //! Thus, it can generate zero, one, or more Packets according
44 //! input set and criterium of dispatching. And it can let apart
45 //! some entities : it is the Remainder, which can be recovered
46 //! by a specific Selection (RemainderFromDispatch).
48 //! Depending of sub-classes, a Dispatch can potentially generate
49 //! a limited or not count of packet, and a remainder or none.
51 //! The input set is read from a specified Selection, attached to
52 //! the Dispatch : the Final Selection of the Dispatch. The input
53 //! is the Unique Root Entities list of the Final Selection
54 class IFSelect_Dispatch : public Standard_Transient
60 //! Sets a Root Name as an HAsciiString
61 //! To reset it, give a Null Handle (then, a ShareOut will have
62 //! to define the Default Root Name)
63 Standard_EXPORT void SetRootName (const Handle(TCollection_HAsciiString)& name);
65 //! Returns True if a specific Root Name has been set
66 //! (else, the Default Root Name has to be used)
67 Standard_EXPORT Standard_Boolean HasRootName() const;
69 //! Returns the Root Name for files produced by this dispatch
70 //! It is empty if it has not been set or if it has been reset
71 Standard_EXPORT const Handle(TCollection_HAsciiString)& RootName() const;
73 //! Stores (or Changes) the Final Selection for a Dispatch
74 Standard_EXPORT void SetFinalSelection (const Handle(IFSelect_Selection)& sel);
76 //! Returns the Final Selection of a Dispatch
77 //! we 'd like : C++ : return const &
78 Standard_EXPORT Handle(IFSelect_Selection) FinalSelection() const;
80 //! Returns the complete list of source Selections (starting
81 //! from FinalSelection)
82 Standard_EXPORT IFSelect_SelectionIterator Selections() const;
84 //! Returns True if a Dispatch can have a Remainder, i.e. if its
85 //! criterium can let entities apart. It is a potential answer,
86 //! remainder can be empty at run-time even if answer is True.
87 //! (to attach a RemainderFromDispatch Selection is not allowed if
89 //! Default answer given here is False (can be redefined)
90 Standard_EXPORT virtual Standard_Boolean CanHaveRemainder() const;
92 //! Returns True if a Dispatch generates a count of Packets always
93 //! less than or equal to a maximum value : it can be computed
94 //! from the total count of Entities to be dispatched : <nbent>.
95 //! If answer is False, no limited maximum is expected for account
96 //! If answer is True, expected maximum is given in argument <max>
97 //! Default answer given here is False (can be redefined)
98 Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const;
100 //! Returns a text which defines the way a Dispatch produces
101 //! packets (which will become files) from its Input
102 Standard_EXPORT virtual TCollection_AsciiString Label() const = 0;
104 //! Gets Unique Root Entities from the Final Selection, given an
106 //! This the starting step for an Evaluation (Packets - Remainder)
107 Standard_EXPORT Interface_EntityIterator GetEntities (const Interface_Graph& G) const;
109 //! Returns the list of produced Packets into argument <pack>.
110 //! Each Packet corresponds to a Part, the Entities listed are the
111 //! Roots given by the Selection. Input is given as a Graph.
112 //! Thus, to create a file from a packet, it suffices to take the
113 //! entities listed in a Part of Packets (that is, a Packet)
114 //! without worrying about Shared entities
115 //! This method can raise an Exception if data are not coherent
116 Standard_EXPORT virtual void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const = 0;
118 //! Returns the list of all Input Entities (see GetEntities) which
119 //! are put in a Packet. That is, Entities listed in GetEntities
120 //! but not in Remainder (see below). Input is given as a Graph.
121 Standard_EXPORT Interface_EntityIterator Packeted (const Interface_Graph& G) const;
123 //! Returns Remainder which is a set of Entities. Can be empty.
124 //! Default evaluation is empty (has to be redefined if
125 //! CanHaveRemainder is redefined to return True).
126 Standard_EXPORT virtual Interface_EntityIterator Remainder (const Interface_Graph& G) const;
131 DEFINE_STANDARD_RTTIEXT(IFSelect_Dispatch,Standard_Transient)
141 Handle(TCollection_HAsciiString) thename;
142 Handle(IFSelect_Selection) thefinal;
153 #endif // _IFSelect_Dispatch_HeaderFile