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