Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:54

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 
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Creates a ShareOutResult from a ShareOut, to work on a Model
0046   //! (without any more precision; uses Active Protocol)
0047   Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_ShareOut)& sho, const 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 Handle(IFSelect_ShareOut)& sho, const Interface_Graph& G);
0053   
0054   //! Creates a ShareOutResult from a unique Dispatch, to work on
0055   //! a Model. As if it was a ShareOut with only one Dispatch
0056   //! (without any more precision; uses Active Protocol)
0057   //! Allows to compute the effect of a single Dispatch
0058   Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_Dispatch)& disp, const Handle(Interface_InterfaceModel)& mod);
0059   
0060   //! Creates a ShareOutResult from a unique Dispatch, to work on
0061   //! a Graph. As if it was a ShareOut with only one Dispatch
0062   //! Allows to compute the effect of a single Dispatch
0063   Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_Dispatch)& disp, const Interface_Graph& G);
0064   
0065   //! Returns the ShareOut used to create the ShareOutResult
0066   //! if creation from a Dispatch, returns a Null Handle
0067   Standard_EXPORT Handle(IFSelect_ShareOut) ShareOut() const;
0068   
0069   //! Returns the Graph used to create theShareOutResult
0070   Standard_EXPORT const Interface_Graph& Graph() const;
0071   
0072   //! Erases computed data, in order to command a new Evaluation
0073   Standard_EXPORT void Reset();
0074   
0075   //! Evaluates the result of a ShareOut : determines Entities to be
0076   //! forgotten by the ShareOut, Entities to be transferred several
0077   //! times (duplicated), prepares an iteration on the packets to be
0078   //! produced
0079   //! Called the first time anyone question is asked, or after a
0080   //! call to Reset. Works by calling the method Prepare.
0081   Standard_EXPORT void Evaluate();
0082 
0083   //! Returns the list of recorded Packets, under two modes :
0084   //! - <complete> = False, the strict definition of Packets, i.e.
0085   //! for each one, the Root Entities, to be explicitly sent
0086   //! - <complete> = True (Default), the completely evaluated list,
0087   //! i.e. which really gives the destination of each entity :
0088   //! this mode allows to evaluate duplications
0089   //! Remark that to send packets, iteration remains preferable
0090   //! (file names are managed)
0091   Standard_EXPORT Handle(IFSelect_PacketList) Packets (const Standard_Boolean complete = Standard_True);
0092 
0093   //! Returns the total count of produced non empty packets
0094   //! (in out : calls Evaluate as necessary)
0095   Standard_EXPORT Standard_Integer NbPackets();
0096   
0097   //! Prepares the iteration on the packets
0098   //! This method is called by Evaluate, but can be called anytime
0099   //! The iteration consists in taking each Dispatch of the ShareOut
0100   //! beginning by the first one, compute its packets, then iterate
0101   //! on these packets. Once all these packets are iterated, the
0102   //! iteration passes to the next Dispatch, or stops.
0103   //! For a creation from a unique Dispatch, same but with only
0104   //! this Dispatch.
0105   //! Each packet can be listed, or really transferred (producing
0106   //! a derived Model, from which a file can be generated)
0107   //!
0108   //! Prepare sets the iteration to the first Dispatch, first Packet
0109   Standard_EXPORT void Prepare();
0110   
0111   //! Returns True if there is more packets in the current Dispatch,
0112   //! else if there is more Dispatch in the ShareOut
0113   Standard_EXPORT Standard_Boolean More();
0114   
0115   //! Passes to the next Packet in the current Dispatch, or if there
0116   //! is none, to the next Dispatch in the ShareOut
0117   Standard_EXPORT void Next();
0118   
0119   //! Passes to the next Dispatch, regardless about remaining packets
0120   Standard_EXPORT void NextDispatch();
0121   
0122   //! Returns the current Dispatch
0123   Standard_EXPORT Handle(IFSelect_Dispatch) Dispatch() const;
0124   
0125   //! Returns the Rank of the current Dispatch in the ShareOut
0126   //! Returns Zero if there is none (iteration finished)
0127   Standard_EXPORT Standard_Integer DispatchRank() const;
0128   
0129   //! Returns Number (rank) of current Packet in current Dispatch,
0130   //! and total count of Packets in current Dispatch, as arguments
0131   Standard_EXPORT void PacketsInDispatch (Standard_Integer& numpack, Standard_Integer& nbpacks) const;
0132   
0133   //! Returns the list of Roots of the current Packet (never empty)
0134   //! (i.e. the Entities to be themselves asked for transfer)
0135   //! Error if there is none (iteration finished)
0136   Standard_EXPORT Interface_EntityIterator PacketRoot();
0137   
0138   //! Returns the complete content of the current Packet (i.e.
0139   //! with shared entities, which will also be put in the file)
0140   Standard_EXPORT Interface_EntityIterator PacketContent();
0141   
0142   //! Returns the File Name which corresponds to current Packet
0143   //! (computed by ShareOut)
0144   //! If current Packet has no associated name (see ShareOut),
0145   //! the returned value is Null
0146   Standard_EXPORT TCollection_AsciiString FileName() const;
0147 
0148 protected:
0149 
0150   Interface_Graph thegraph;
0151   IFGraph_SubPartsIterator thedispres;
0152 
0153 private:
0154 
0155   Handle(IFSelect_ShareOut) theshareout;
0156   Handle(IFSelect_Dispatch) thedispatch;
0157   Standard_Boolean theeval;
0158   Standard_Integer thedispnum;
0159   Standard_Integer thepacknum;
0160   Standard_Integer thepackdisp;
0161   Standard_Integer thenbindisp;
0162   TColStd_SequenceOfInteger thedisplist;
0163 
0164 };
0165 
0166 #endif // _IFSelect_ShareOutResult_HeaderFile