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_ShareOutResult_HeaderFile |
18 | #define _IFSelect_ShareOutResult_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <TColStd_SequenceOfInteger.hxx> |
27 | #include <Interface_Graph.hxx> |
28 | #include <IFGraph_SubPartsIterator.hxx> |
29 | class IFSelect_ShareOut; |
30 | class IFSelect_Dispatch; |
42cf5bc1 |
31 | class Interface_InterfaceModel; |
42cf5bc1 |
32 | class IFSelect_PacketList; |
33 | class Interface_EntityIterator; |
34 | class TCollection_AsciiString; |
35 | |
42cf5bc1 |
36 | //! This class gives results computed from a ShareOut : simulation |
37 | //! before transfer, helps to list entities ... |
38 | //! Transfer itself will later be performed, either by a |
39 | //! TransferCopy to simply divide up a file, or a TransferDispatch |
40 | //! which can be parametred with more details |
41 | class IFSelect_ShareOutResult |
42 | { |
43 | public: |
44 | |
45 | DEFINE_STANDARD_ALLOC |
46 | |
42cf5bc1 |
47 | //! Creates a ShareOutResult from a ShareOut, to work on a Model |
48 | //! (without any more precision; uses Active Protocol) |
49 | Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_ShareOut)& sho, const Handle(Interface_InterfaceModel)& mod); |
50 | |
51 | //! Creates a ShareOutResult from a ShareOut, to work on a Graph |
52 | //! already computed, which defines the Input Model and can |
53 | //! specialize some Entities |
54 | Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_ShareOut)& sho, const Interface_Graph& G); |
55 | |
56 | //! Creates a ShareOutResult from a unique Dispatch, to work on |
57 | //! a Model. As if it was a ShareOut with only one Dispatch |
58 | //! (without any more precision; uses Active Protocol) |
59 | //! Allows to compute the effect of a single Dispatch |
60 | Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_Dispatch)& disp, const Handle(Interface_InterfaceModel)& mod); |
61 | |
62 | //! Creates a ShareOutResult from a unique Dispatch, to work on |
63 | //! a Graph. As if it was a ShareOut with only one Dispatch |
64 | //! Allows to compute the effect of a single Dispatch |
65 | Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_Dispatch)& disp, const Interface_Graph& G); |
66 | |
67 | //! Returns the ShareOut used to create the ShareOutResult |
68 | //! if creation from a Dispatch, returns a Null Handle |
69 | Standard_EXPORT Handle(IFSelect_ShareOut) ShareOut() const; |
70 | |
71 | //! Returns the Graph used to create theShareOutResult |
72 | Standard_EXPORT const Interface_Graph& Graph() const; |
73 | |
74 | //! Erases computed data, in order to command a new Evaluation |
75 | Standard_EXPORT void Reset(); |
76 | |
77 | //! Evaluates the result of a ShareOut : determines Entities to be |
78 | //! forgotten by the ShareOut, Entities to be transferred several |
79 | //! times (duplicated), prepares an iteration on the packets to be |
80 | //! produced |
81 | //! Called the first time anyone question is asked, or after a |
82 | //! call to Reset. Works by calling the method Prepare. |
83 | Standard_EXPORT void Evaluate(); |
0177fe26 |
84 | |
42cf5bc1 |
85 | //! Returns the list of recorded Packets, under two modes : |
86 | //! - <complete> = False, the strict definition of Packets, i.e. |
0177fe26 |
87 | //! for each one, the Root Entities, to be explicitly sent |
42cf5bc1 |
88 | //! - <complete> = True (Default), the completely evaluated list, |
89 | //! i.e. which really gives the destination of each entity : |
90 | //! this mode allows to evaluate duplications |
91 | //! Remark that to send packets, iteration remains preferable |
92 | //! (file names are managed) |
93 | Standard_EXPORT Handle(IFSelect_PacketList) Packets (const Standard_Boolean complete = Standard_True); |
0177fe26 |
94 | |
42cf5bc1 |
95 | //! Returns the total count of produced non empty packets |
96 | //! (in out : calls Evaluate as necessary) |
97 | Standard_EXPORT Standard_Integer NbPackets(); |
98 | |
99 | //! Prepares the iteration on the packets |
100 | //! This method is called by Evaluate, but can be called anytime |
101 | //! The iteration consists in taking each Dispatch of the ShareOut |
102 | //! beginning by the first one, compute its packets, then iterate |
103 | //! on these packets. Once all these packets are iterated, the |
104 | //! iteration passes to the next Dispatch, or stops. |
105 | //! For a creation from a unique Dispatch, same but with only |
106 | //! this Dispatch. |
107 | //! Each packet can be listed, or really transferred (producing |
108 | //! a derived Model, from which a file can be generated) |
109 | //! |
110 | //! Prepare sets the iteration to the first Dispatch, first Packet |
111 | Standard_EXPORT void Prepare(); |
112 | |
113 | //! Returns True if there is more packets in the current Dispatch, |
114 | //! else if there is more Dispatch in the ShareOut |
115 | Standard_EXPORT Standard_Boolean More(); |
116 | |
117 | //! Passes to the next Packet in the current Dispatch, or if there |
118 | //! is none, to the next Dispatch in the ShareOut |
119 | Standard_EXPORT void Next(); |
120 | |
121 | //! Passes to the next Dispatch, regardless about remaining packets |
122 | Standard_EXPORT void NextDispatch(); |
123 | |
124 | //! Returns the current Dispatch |
125 | Standard_EXPORT Handle(IFSelect_Dispatch) Dispatch() const; |
126 | |
127 | //! Returns the Rank of the current Dispatch in the ShareOut |
128 | //! Returns Zero if there is none (iteration finished) |
129 | Standard_EXPORT Standard_Integer DispatchRank() const; |
130 | |
131 | //! Returns Number (rank) of current Packet in current Dispatch, |
132 | //! and total count of Packets in current Dispatch, as arguments |
133 | Standard_EXPORT void PacketsInDispatch (Standard_Integer& numpack, Standard_Integer& nbpacks) const; |
134 | |
135 | //! Returns the list of Roots of the current Packet (never empty) |
136 | //! (i.e. the Entities to be themselves asked for transfer) |
137 | //! Error if there is none (iteration finished) |
138 | Standard_EXPORT Interface_EntityIterator PacketRoot(); |
139 | |
140 | //! Returns the complete content of the current Packet (i.e. |
141 | //! with shared entities, which will also be put in the file) |
142 | Standard_EXPORT Interface_EntityIterator PacketContent(); |
143 | |
144 | //! Returns the File Name which corresponds to current Packet |
145 | //! (computed by ShareOut) |
146 | //! If current Packet has no associated name (see ShareOut), |
147 | //! the returned value is Null |
148 | Standard_EXPORT TCollection_AsciiString FileName() const; |
149 | |
42cf5bc1 |
150 | protected: |
151 | |
42cf5bc1 |
152 | Interface_Graph thegraph; |
153 | IFGraph_SubPartsIterator thedispres; |
154 | |
42cf5bc1 |
155 | private: |
156 | |
42cf5bc1 |
157 | Handle(IFSelect_ShareOut) theshareout; |
158 | Handle(IFSelect_Dispatch) thedispatch; |
159 | Standard_Boolean theeval; |
160 | Standard_Integer thedispnum; |
161 | Standard_Integer thepacknum; |
162 | Standard_Integer thepackdisp; |
163 | Standard_Integer thenbindisp; |
164 | TColStd_SequenceOfInteger thedisplist; |
165 | |
42cf5bc1 |
166 | }; |
167 | |
42cf5bc1 |
168 | #endif // _IFSelect_ShareOutResult_HeaderFile |