Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:20:41

0001 // Created on: 1992-11-17
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IFSelect_ShareOutResult_HeaderFile
0018 #define _IFSelect_ShareOutResult_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <Interface_Graph.hxx>
0026 #include <IFGraph_SubPartsIterator.hxx>
0027 class IFSelect_ShareOut;
0028 class IFSelect_Dispatch;
0029 class Interface_InterfaceModel;
0030 class IFSelect_PacketList;
0031 class Interface_EntityIterator;
0032 class TCollection_AsciiString;
0033 
0034 //! This class gives results computed from a ShareOut : simulation
0035 //! before transfer, helps to list entities ...
0036 //! Transfer itself will later be performed, either by a
0037 //! TransferCopy to simply divide up a file, or a TransferDispatch
0038 //! which can be parametred with more details
0039 class IFSelect_ShareOutResult
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   //! Creates a ShareOutResult from a ShareOut, to work on a Model
0045   //! (without any more precision; uses Active Protocol)
0046   Standard_EXPORT IFSelect_ShareOutResult(const occ::handle<IFSelect_ShareOut>&        sho,
0047                                           const occ::handle<Interface_InterfaceModel>& mod);
0048 
0049   //! Creates a ShareOutResult from a ShareOut, to work on a Graph
0050   //! already computed, which defines the Input Model and can
0051   //! specialize some Entities
0052   Standard_EXPORT IFSelect_ShareOutResult(const occ::handle<IFSelect_ShareOut>& sho,
0053                                           const Interface_Graph&                G);
0054 
0055   //! Creates a ShareOutResult from a unique Dispatch, to work on
0056   //! a Model. As if it was a ShareOut with only one Dispatch
0057   //! (without any more precision; uses Active Protocol)
0058   //! Allows to compute the effect of a single Dispatch
0059   Standard_EXPORT IFSelect_ShareOutResult(const occ::handle<IFSelect_Dispatch>&        disp,
0060                                           const occ::handle<Interface_InterfaceModel>& mod);
0061 
0062   //! Creates a ShareOutResult from a unique Dispatch, to work on
0063   //! a Graph. As if it was a ShareOut with only one Dispatch
0064   //! Allows to compute the effect of a single Dispatch
0065   Standard_EXPORT IFSelect_ShareOutResult(const occ::handle<IFSelect_Dispatch>& disp,
0066                                           const Interface_Graph&                G);
0067 
0068   //! Returns the ShareOut used to create the ShareOutResult
0069   //! if creation from a Dispatch, returns a Null Handle
0070   Standard_EXPORT occ::handle<IFSelect_ShareOut> ShareOut() const;
0071 
0072   //! Returns the Graph used to create theShareOutResult
0073   Standard_EXPORT const Interface_Graph& Graph() const;
0074 
0075   //! Erases computed data, in order to command a new Evaluation
0076   Standard_EXPORT void Reset();
0077 
0078   //! Evaluates the result of a ShareOut : determines Entities to be
0079   //! forgotten by the ShareOut, Entities to be transferred several
0080   //! times (duplicated), prepares an iteration on the packets to be
0081   //! produced
0082   //! Called the first time anyone question is asked, or after a
0083   //! call to Reset. Works by calling the method Prepare.
0084   Standard_EXPORT void Evaluate();
0085 
0086   //! Returns the list of recorded Packets, under two modes :
0087   //! - <complete> = False, the strict definition of Packets, i.e.
0088   //! for each one, the Root Entities, to be explicitly sent
0089   //! - <complete> = True (Default), the completely evaluated list,
0090   //! i.e. which really gives the destination of each entity :
0091   //! this mode allows to evaluate duplications
0092   //! Remark that to send packets, iteration remains preferable
0093   //! (file names are managed)
0094   Standard_EXPORT occ::handle<IFSelect_PacketList> Packets(const bool complete = true);
0095 
0096   //! Returns the total count of produced non empty packets
0097   //! (in out : calls Evaluate as necessary)
0098   Standard_EXPORT int NbPackets();
0099 
0100   //! Prepares the iteration on the packets
0101   //! This method is called by Evaluate, but can be called anytime
0102   //! The iteration consists in taking each Dispatch of the ShareOut
0103   //! beginning by the first one, compute its packets, then iterate
0104   //! on these packets. Once all these packets are iterated, the
0105   //! iteration passes to the next Dispatch, or stops.
0106   //! For a creation from a unique Dispatch, same but with only
0107   //! this Dispatch.
0108   //! Each packet can be listed, or really transferred (producing
0109   //! a derived Model, from which a file can be generated)
0110   //!
0111   //! Prepare sets the iteration to the first Dispatch, first Packet
0112   Standard_EXPORT void Prepare();
0113 
0114   //! Returns True if there is more packets in the current Dispatch,
0115   //! else if there is more Dispatch in the ShareOut
0116   Standard_EXPORT bool More();
0117 
0118   //! Passes to the next Packet in the current Dispatch, or if there
0119   //! is none, to the next Dispatch in the ShareOut
0120   Standard_EXPORT void Next();
0121 
0122   //! Passes to the next Dispatch, regardless about remaining packets
0123   Standard_EXPORT void NextDispatch();
0124 
0125   //! Returns the current Dispatch
0126   Standard_EXPORT occ::handle<IFSelect_Dispatch> Dispatch() const;
0127 
0128   //! Returns the Rank of the current Dispatch in the ShareOut
0129   //! Returns Zero if there is none (iteration finished)
0130   Standard_EXPORT int DispatchRank() const;
0131 
0132   //! Returns Number (rank) of current Packet in current Dispatch,
0133   //! and total count of Packets in current Dispatch, as arguments
0134   Standard_EXPORT void PacketsInDispatch(int& numpack, int& nbpacks) const;
0135 
0136   //! Returns the list of Roots of the current Packet (never empty)
0137   //! (i.e. the Entities to be themselves asked for transfer)
0138   //! Error if there is none (iteration finished)
0139   Standard_EXPORT Interface_EntityIterator PacketRoot();
0140 
0141   //! Returns the complete content of the current Packet (i.e.
0142   //! with shared entities, which will also be put in the file)
0143   Standard_EXPORT Interface_EntityIterator PacketContent();
0144 
0145   //! Returns the File Name which corresponds to current Packet
0146   //! (computed by ShareOut)
0147   //! If current Packet has no associated name (see ShareOut),
0148   //! the returned value is Null
0149   Standard_EXPORT TCollection_AsciiString FileName() const;
0150 
0151 protected:
0152   Interface_Graph          thegraph;
0153   IFGraph_SubPartsIterator thedispres;
0154 
0155 private:
0156   occ::handle<IFSelect_ShareOut> theshareout;
0157   occ::handle<IFSelect_Dispatch> thedispatch;
0158   bool                           theeval;
0159   int                            thedispnum;
0160   int                            thepacknum;
0161   int                            thepackdisp;
0162   int                            thenbindisp;
0163   NCollection_Sequence<int>      thedisplist;
0164 };
0165 
0166 #endif // _IFSelect_ShareOutResult_HeaderFile