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
9 -- under the terms of the GNU Lesser General Public 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 class ContextWrite from IFSelect
19 ---Purpose : This class gathers various informations used by File Modifiers
20 -- apart from the writer object, which is specific of the norm
21 -- and of the physical format
23 -- These informations are controlled by an object AppliedModifiers
24 -- (if it is not defined, no modification is allowed on writing)
26 -- Furthermore, in return, ContextModif can record Checks, either
27 -- one for all, or one for each Entity. It supports trace too.
29 uses Transient, CString, AsciiString from TCollection,
30 InterfaceModel, EntityIterator, Graph, HGraph,
31 Protocol from Interface, Check, CheckIterator, GeneralModifier,
38 Create (model : InterfaceModel; proto : Protocol;
39 applieds : mutable AppliedModifiers; filename : CString)
41 ---Purpose : Prepares a ContextWrite with these informations :
42 -- - the model which is to be written
43 -- - the protocol to be used
45 -- - an object AppliedModifiers to work. It gives a list of
46 -- FileModifiers to be ran, and for each one it can give
47 -- a restricted list of entities (in the model), else all
48 -- the model is considered
50 Create (hgraph : HGraph; proto : Protocol;
51 applieds : mutable AppliedModifiers; filename : CString)
53 ---Purpose : Same as above but with an already computed Graph
55 Model (me) returns InterfaceModel;
56 ---Purpose : Returns the Model
58 Protocol (me) returns Protocol;
59 ---Purpose : Returns the Protocol;
61 FileName (me) returns CString;
62 ---Purpose : Returns the File Name
64 AppliedModifiers (me) returns mutable AppliedModifiers;
65 ---Purpose : Returns the object AppliedModifiers
67 Graph (me : in out) returns Graph;
68 ---Purpose : Returns the Graph, either given when created, else created
69 -- the first time it is queried
70 ---C++ : return const &
73 -- -- Control when running -- --
75 NbModifiers (me) returns Integer;
76 ---Purpose : Returns the count of recorded File Modifiers
78 SetModifier (me : in out; numod : Integer) returns Boolean;
79 ---Purpose : Sets active the File Modifier n0 <numod>
80 -- Then, it prepares the list of entities to consider, if any
81 -- Returns False if <numod> out of range
83 FileModifier (me) returns mutable GeneralModifier;
84 ---Purpose : Returns the currently active File Modifier. Cast to be done
85 -- Null if not properly set : must be test IsNull after casting
87 IsForNone (me) returns Boolean;
88 ---Purpose : Returns True if no modifier is currently set
90 IsForAll (me) returns Boolean;
91 ---Purpose : Returns True if the current modifier is to be applied to
92 -- the whole model. Else, a restricted list of selected entities
93 -- is defined, it can be exploited by the File Modifier
95 NbEntities (me) returns Integer;
96 ---Purpose : Returns the total count of selected entities
99 ---Purpose : Starts an iteration on selected items. It takes into account
100 -- IsForAll/IsForNone, by really iterating on all selected items.
102 More (me) returns Boolean;
103 ---Purpose : Returns True until the iteration has finished
106 ---Purpose : Advances the iteration
108 Value (me) returns Transient raises NoSuchObject;
109 ---Purpose : Returns the current selected entity in the model
112 -- -- Trace and Check -- --
114 AddCheck (me : in out; check : Check) is static;
115 ---Purpose : Adds a Check to the CheckList. If it is empty, nothing is done
116 -- If it concerns an Entity from the Model (by SetEntity)
117 -- to which another Check is attached, it is merged to it.
118 -- Else, it is added or merged as to GlobalCheck.
120 AddWarning (me : in out; start : Transient; mess : CString; orig : CString = "");
121 ---Purpose : Adds a Warning Message for an Entity from the Model
122 -- If <start> is not an Entity from the model (e.g. the
123 -- model itself) this message is added to Global Check.
125 AddFail (me : in out; start : Transient; mess : CString; orig : CString = "");
126 ---Purpose : Adds a Fail Message for an Entity from the Model
127 -- If <start> is not an Entity from the model (e.g. the
128 -- model itself) this message is added to Global Check.
130 CCheck (me : in out; num : Integer = 0) returns Check;
131 ---Purpose : Returns a Check given an Entity number (in the Model)
132 -- by default a Global Check. Creates it the first time.
133 -- It can then be acknowledged on the spot, in condition that the
134 -- caller works by reference ("Interface_Check& check = ...")
136 CCheck (me : in out; start : Transient) returns Check;
137 ---Purpose : Returns a Check attached to an Entity from the Model
138 -- It can then be acknowledged on the spot, in condition that the
139 -- caller works by reference ("Interface_Check& check = ...")
141 CheckList (me) returns CheckIterator is static;
142 ---Purpose : Returns the complete CheckList
146 themodel : InterfaceModel;
148 thefile : AsciiString;
149 theapply : AppliedModifiers;
151 thecheck : CheckIterator;
155 themodif : GeneralModifier;