Warnings on vc14 were eliminated
[occt.git] / src / IFSelect / IFSelect_ContextWrite.hxx
CommitLineData
42cf5bc1 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
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _IFSelect_ContextWrite_HeaderFile
18#define _IFSelect_ContextWrite_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
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>
29class Interface_InterfaceModel;
30class Interface_Protocol;
31class IFSelect_AppliedModifiers;
32class Interface_HGraph;
33class IFSelect_GeneralModifier;
34class Standard_NoSuchObject;
35class Interface_Graph;
36class Standard_Transient;
37class Interface_Check;
38class Interface_CheckIterator;
39
40
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
44//!
45//! These informations are controlled by an object AppliedModifiers
46//! (if it is not defined, no modification is allowed on writing)
47//!
48//! Furthermore, in return, ContextModif can record Checks, either
49//! one for all, or one for each Entity. It supports trace too.
50class IFSelect_ContextWrite
51{
52public:
53
54 DEFINE_STANDARD_ALLOC
55
56
57 //! Prepares a ContextWrite with these informations :
58 //! - the model which is to be written
59 //! - the protocol to be used
60 //! - the filename
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);
66
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);
69
70 //! Returns the Model
71 Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
72
73 //! Returns the Protocol;
74 Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
75
76 //! Returns the File Name
77 Standard_EXPORT Standard_CString FileName() const;
78
79 //! Returns the object AppliedModifiers
80 Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers() const;
81
82 //! Returns the Graph, either given when created, else created
83 //! the first time it is queried
84 Standard_EXPORT const Interface_Graph& Graph();
85
86 //! Returns the count of recorded File Modifiers
87 Standard_EXPORT Standard_Integer NbModifiers() const;
88
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);
93
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;
97
98 //! Returns True if no modifier is currently set
99 Standard_EXPORT Standard_Boolean IsForNone() const;
100
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;
105
106 //! Returns the total count of selected entities
107 Standard_EXPORT Standard_Integer NbEntities() const;
108
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();
112
113 //! Returns True until the iteration has finished
114 Standard_EXPORT Standard_Boolean More() const;
115
116 //! Advances the iteration
117 Standard_EXPORT void Next();
118
119 //! Returns the current selected entity in the model
120 Standard_EXPORT Handle(Standard_Transient) Value() const;
121
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);
127
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 = "");
132
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 = "");
137
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);
143
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);
148
149 //! Returns the complete CheckList
150 Standard_EXPORT Interface_CheckIterator CheckList() const;
151
152
153
154
155protected:
156
157
158
159
160
161private:
162
163
164
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;
175
176
177};
178
179
180
181
182
183
184
185#endif // _IFSelect_ContextWrite_HeaderFile