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