1 // Created on: 1996-09-04
2 // Created by: Christian CAILLET
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Transfer_TransientProcess_HeaderFile
18 #define _Transfer_TransientProcess_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TColStd_HSequenceOfTransient.hxx>
24 #include <Transfer_ProcessForTransient.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_CString.hxx>
28 #include <Standard_Type.hxx>
29 #include <Standard_Transient.hxx>
30 #include <TCollection_AsciiString.hxx>
31 #include <NCollection_DataMap.hxx>
32 class Interface_InterfaceModel;
33 class Interface_HGraph;
34 class Interface_Graph;
35 class Interface_EntityIterator;
37 class Transfer_TransientProcess;
38 DEFINE_STANDARD_HANDLE(Transfer_TransientProcess, Transfer_ProcessForTransient)
40 //! Adds specific features to the generic definition :
41 //! TransientProcess is intended to work from an InterfaceModel
42 //! to a set of application objects.
44 //! Hence, some information about starting entities can be gotten
45 //! from the model : for Trace, CheckList, Integrity Status
46 class Transfer_TransientProcess : public Transfer_ProcessForTransient
52 //! Sets TransientProcess at initial state, with an initial size
53 Standard_EXPORT Transfer_TransientProcess(const Standard_Integer nb = 10000);
55 //! Sets an InterfaceModel, used by StartTrace, CheckList, queries
56 //! on Integrity, to give information significant for each norm.
57 Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
59 //! Returns the Model used for StartTrace
60 Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
62 //! Sets a Graph : superseedes SetModel if already done
63 Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& HG);
65 Standard_EXPORT Standard_Boolean HasGraph() const;
67 Standard_EXPORT Handle(Interface_HGraph) HGraph() const;
69 Standard_EXPORT const Interface_Graph& Graph() const;
71 //! Sets a Context : according to receiving appli, to be
72 //! interpreted by the Actor
73 Standard_EXPORT void SetContext (const Standard_CString name, const Handle(Standard_Transient)& ctx);
75 //! Returns the Context attached to a name, if set and if it is
76 //! Kind of the type, else a Null Handle
77 //! Returns True if OK, False if no Context
78 Standard_EXPORT Standard_Boolean GetContext (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& ctx) const;
80 //! Returns (modifiable) the whole definition of Context
81 //! Rather for internal use (ex.: preparing and setting in once)
82 Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Context();
84 //! Specific printing to trace an entity : prints label and type
86 Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& start, Standard_OStream& S) const Standard_OVERRIDE;
88 //! Specific number of a starting object for check-list : Number
90 Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
92 //! Returns the list of sharings entities, AT ANY LEVEL, which are
93 //! kind of a given type. Calls TypedSharings from Graph
94 //! Returns an empty list if the Graph has not been aknowledged
95 Standard_EXPORT Interface_EntityIterator TypedSharings (const Handle(Standard_Transient)& start, const Handle(Standard_Type)& type) const;
97 //! Tells if an entity is well loaded from file (even if its data
98 //! fail on checking, they are present). Mostly often, answers
99 //! True. Else, there was a syntactic error in the file.
100 //! A non-loaded entity MAY NOT BE transferred, unless its Report
101 //! (in the model) is interpreted
102 Standard_EXPORT Standard_Boolean IsDataLoaded (const Handle(Standard_Transient)& ent) const;
104 //! Tells if an entity fails on data checking (load time,
105 //! syntactic, or semantic check). Normally, should answer False.
106 //! It is not prudent to try transferring an entity which fails on
108 Standard_EXPORT Standard_Boolean IsDataFail (const Handle(Standard_Transient)& ent) const;
110 //! Prints statistics on a given output, according mode
111 Standard_EXPORT void PrintStats (const Standard_Integer mode, Standard_OStream& S) const;
113 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) RootsForTransfer();
118 DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient)
128 Handle(Interface_InterfaceModel) themodel;
129 Handle(Interface_HGraph) thegraph;
130 NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thectx;
131 Handle(TColStd_HSequenceOfTransient) thetrroots;
142 #endif // _Transfer_TransientProcess_HeaderFile