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 Message_Messenger;
36 class Interface_EntityIterator;
39 class Transfer_TransientProcess;
40 DEFINE_STANDARD_HANDLE(Transfer_TransientProcess, Transfer_ProcessForTransient)
42 //! Adds specific features to the generic definition :
43 //! TransientProcess is intended to work from an InterfaceModel
44 //! to a set of application objects.
46 //! Hence, some informations about starting entities can be gotten
47 //! from the model : for Trace, CheckList, Integrity Status
48 class Transfer_TransientProcess : public Transfer_ProcessForTransient
54 //! Sets TransientProcess at initial state, with an initial size
55 Standard_EXPORT Transfer_TransientProcess(const Standard_Integer nb = 10000);
57 //! Sets an InterfaceModel, used by StartTrace, CheckList, queries
58 //! on Integrity, to give informations significant for each norm.
59 Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
61 //! Returns the Model used for StartTrace
62 Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
64 //! Sets a Graph : superseedes SetModel if already done
65 Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& HG);
67 Standard_EXPORT Standard_Boolean HasGraph() const;
69 Standard_EXPORT Handle(Interface_HGraph) HGraph() const;
71 Standard_EXPORT const Interface_Graph& Graph() const;
73 //! Sets a Context : according to receiving appli, to be
74 //! interpreted by the Actor
75 Standard_EXPORT void SetContext (const Standard_CString name, const Handle(Standard_Transient)& ctx);
77 //! Returns the Context attached to a name, if set and if it is
78 //! Kind of the type, else a Null Handle
79 //! Returns True if OK, False if no Context
80 Standard_EXPORT Standard_Boolean GetContext (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& ctx) const;
82 //! Returns (modifiable) the whole definition of Context
83 //! Rather for internal use (ex.: preparing and setting in once)
84 Standard_EXPORT NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Context();
86 //! Specific printing to trace an entity : prints label and type
88 Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const Standard_OVERRIDE;
90 //! Specific number of a starting object for check-list : Number
92 Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
94 //! Returns the list of sharings entities, AT ANY LEVEL, which are
95 //! kind of a given type. Calls TypedSharings from Graph
96 //! Returns an empty list if the Graph has not been aknowledged
97 Standard_EXPORT Interface_EntityIterator TypedSharings (const Handle(Standard_Transient)& start, const Handle(Standard_Type)& type) const;
99 //! Tells if an entity is well loaded from file (even if its data
100 //! fail on checking, they are present). Mostly often, answers
101 //! True. Else, there was a syntactic error in the file.
102 //! A non-loaded entity MAY NOT BE transferred, unless its Report
103 //! (in the model) is interpreted
104 Standard_EXPORT Standard_Boolean IsDataLoaded (const Handle(Standard_Transient)& ent) const;
106 //! Tells if an entity fails on data checking (load time,
107 //! syntactic, or semantic check). Normally, should answer False.
108 //! It is not prudent to try transferring an entity which fails on
110 Standard_EXPORT Standard_Boolean IsDataFail (const Handle(Standard_Transient)& ent) const;
112 //! Prints statistics on a given output, according mode
113 Standard_EXPORT void PrintStats (const Standard_Integer mode, const Handle(Message_Messenger)& S) const;
115 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) RootsForTransfer();
120 DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient)
130 Handle(Interface_InterfaceModel) themodel;
131 Handle(Interface_HGraph) thegraph;
132 NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thectx;
133 Handle(TColStd_HSequenceOfTransient) thetrroots;
144 #endif // _Transfer_TransientProcess_HeaderFile