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