1 // Created on: 1996-01-26
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 _IFSelect_ContextWrite_HeaderFile
18 #define _IFSelect_ContextWrite_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Interface_CheckIterator.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_CString.hxx>
27 class Interface_InterfaceModel;
28 class Interface_Protocol;
29 class IFSelect_AppliedModifiers;
30 class Interface_HGraph;
31 class IFSelect_GeneralModifier;
32 class Interface_Graph;
33 class Standard_Transient;
34 class Interface_Check;
37 //! This class gathers various information used by File Modifiers
38 //! apart from the writer object, which is specific of the norm
39 //! and of the physical format
41 //! These information are controlled by an object AppliedModifiers
42 //! (if it is not defined, no modification is allowed on writing)
44 //! Furthermore, in return, ContextModif can record Checks, either
45 //! one for all, or one for each Entity. It supports trace too.
46 class IFSelect_ContextWrite
53 //! Prepares a ContextWrite with these information :
54 //! - the model which is to be written
55 //! - the protocol to be used
57 //! - an object AppliedModifiers to work. It gives a list of
58 //! FileModifiers to be ran, and for each one it can give
59 //! a restricted list of entities (in the model), else all
60 //! the model is considered
61 Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, const Standard_CString filename);
63 //! Same as above but with an already computed Graph
64 Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_HGraph)& hgraph, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, const Standard_CString filename);
67 Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
69 //! Returns the Protocol;
70 Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
72 //! Returns the File Name
73 Standard_EXPORT Standard_CString FileName() const;
75 //! Returns the object AppliedModifiers
76 Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers() const;
78 //! Returns the Graph, either given when created, else created
79 //! the first time it is queried
80 Standard_EXPORT const Interface_Graph& Graph();
82 //! Returns the count of recorded File Modifiers
83 Standard_EXPORT Standard_Integer NbModifiers() const;
85 //! Sets active the File Modifier n0 <numod>
86 //! Then, it prepares the list of entities to consider, if any
87 //! Returns False if <numod> out of range
88 Standard_EXPORT Standard_Boolean SetModifier (const Standard_Integer numod);
90 //! Returns the currently active File Modifier. Cast to be done
91 //! Null if not properly set : must be test IsNull after casting
92 Standard_EXPORT Handle(IFSelect_GeneralModifier) FileModifier() const;
94 //! Returns True if no modifier is currently set
95 Standard_EXPORT Standard_Boolean IsForNone() const;
97 //! Returns True if the current modifier is to be applied to
98 //! the whole model. Else, a restricted list of selected entities
99 //! is defined, it can be exploited by the File Modifier
100 Standard_EXPORT Standard_Boolean IsForAll() const;
102 //! Returns the total count of selected entities
103 Standard_EXPORT Standard_Integer NbEntities() const;
105 //! Starts an iteration on selected items. It takes into account
106 //! IsForAll/IsForNone, by really iterating on all selected items.
107 Standard_EXPORT void Start();
109 //! Returns True until the iteration has finished
110 Standard_EXPORT Standard_Boolean More() const;
112 //! Advances the iteration
113 Standard_EXPORT void Next();
115 //! Returns the current selected entity in the model
116 Standard_EXPORT Handle(Standard_Transient) Value() const;
118 //! Adds a Check to the CheckList. If it is empty, nothing is done
119 //! If it concerns an Entity from the Model (by SetEntity)
120 //! to which another Check is attached, it is merged to it.
121 //! Else, it is added or merged as to GlobalCheck.
122 Standard_EXPORT void AddCheck (const Handle(Interface_Check)& check);
124 //! Adds a Warning Message for an Entity from the Model
125 //! If <start> is not an Entity from the model (e.g. the
126 //! model itself) this message is added to Global Check.
127 Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
129 //! Adds a Fail Message for an Entity from the Model
130 //! If <start> is not an Entity from the model (e.g. the
131 //! model itself) this message is added to Global Check.
132 Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
134 //! Returns a Check given an Entity number (in the Model)
135 //! by default a Global Check. Creates it the first time.
136 //! It can then be acknowledged on the spot, in condition that the
137 //! caller works by reference ("Interface_Check& check = ...")
138 Standard_EXPORT Handle(Interface_Check) CCheck (const Standard_Integer num = 0);
140 //! Returns a Check attached to an Entity from the Model
141 //! It can then be acknowledged on the spot, in condition that the
142 //! caller works by reference ("Interface_Check& check = ...")
143 Standard_EXPORT Handle(Interface_Check) CCheck (const Handle(Standard_Transient)& start);
145 //! Returns the complete CheckList
146 Standard_EXPORT Interface_CheckIterator CheckList() const;
161 Handle(Interface_InterfaceModel) themodel;
162 Handle(Interface_Protocol) theproto;
163 TCollection_AsciiString thefile;
164 Handle(IFSelect_AppliedModifiers) theapply;
165 Handle(Interface_HGraph) thehgraf;
166 Interface_CheckIterator thecheck;
167 Standard_Integer thenumod;
168 Standard_Integer thenbent;
169 Standard_Integer thecurr;
170 Handle(IFSelect_GeneralModifier) themodif;
181 #endif // _IFSelect_ContextWrite_HeaderFile