1 // Created on: 1992-11-10
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-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 _IGESData_DirChecker_HeaderFile
18 #define _IGESData_DirChecker_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Integer.hxx>
25 #include <IGESData_DefType.hxx>
26 class Interface_Check;
27 class IGESData_IGESEntity;
30 //! This class centralizes general Checks upon an IGES Entity's
31 //! Directory Part. That is : such field Ignored or Required,
32 //! or Required with a given Value (for an Integer field)
33 //! More precise checks can be performed as necessary, by each
34 //! Entity (method OwnCheck).
36 //! Each class of Entity defines its DirChecker (method DirChecker)
37 //! and the DirChecker is able to perform its Checks on an Entity
39 //! A Required Value or presence of a field causes a Fail Message
40 //! if criterium is not satisfied
41 //! An Ignored field causes a Correction Message if the field is
43 class IGESData_DirChecker
50 //! Returns a DirChecker, with no criterium at all to be checked
51 Standard_EXPORT IGESData_DirChecker();
53 //! Returns a DirChecker, with no criterium except Required Type
54 Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype);
56 //! Returns a DirChecker, with no criterium except Required values
57 //! for Type and Form numbers
58 Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype, const Standard_Integer aform);
60 //! Returns a DirChecker, with no criterium except Required values
61 //! for Type number (atype), and Required Range for Form number
62 //! (which must be between aform1 and aform2 included)
63 Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype, const Standard_Integer aform1, const Standard_Integer aform2);
65 //! Returns True if at least one criterium has already been set
66 //! Allows user to store a DirChecker (static variable) then ask
67 //! if it has been set before setting it
68 Standard_EXPORT Standard_Boolean IsSet() const;
70 //! Sets a DirChecker with most current criteria, that is :
71 //! Structure Ignored ( worths call Structure(crit = DefVoid) )
72 Standard_EXPORT void SetDefault();
74 //! Sets Structure criterium.
75 //! If crit is DefVoid, Ignored : should not be defined
76 //! If crit is DefReference, Required : must be defined
77 //! Other values are not taken in account
78 Standard_EXPORT void Structure (const IGESData_DefType crit);
80 //! Sets LineFont criterium
81 //! If crit is DefVoid, Ignored : should not be defined
82 //! If crit is DefAny, Required : must be defined (value or ref)
83 //! If crit is DefValue, Required as a Value (error if Reference)
84 //! Other values are not taken in account
85 Standard_EXPORT void LineFont (const IGESData_DefType crit);
87 //! Sets LineWeight criterium
88 //! If crit is DefVoid, Ignored : should not be defined
89 //! If crit is DefValue, Required
90 //! Other values are not taken in account
91 Standard_EXPORT void LineWeight (const IGESData_DefType crit);
93 //! Sets Color criterium
94 //! If crit is DefVoid, Ignored : should not be defined
95 //! If crit is DefAny, Required : must be defined (value or ref)
96 //! Other values are not taken in account
97 Standard_EXPORT void Color (const IGESData_DefType crit);
99 //! Sets Graphics data (LineFont, LineWeight, Color, Level, View)
100 //! to be ignored according value of Hierarchy status :
101 //! If hierarchy is not given, they are Ignored any way
102 //! (that is, they should not be defined)
103 //! If hierarchy is given, Graphics are Ignored if the Hierarchy
104 //! status has the value given in argument "hierarchy"
105 Standard_EXPORT void GraphicsIgnored (const Standard_Integer hierarchy = -1);
107 //! Sets Blank Status to be ignored
108 //! (should not be defined, or its value should be 0)
109 Standard_EXPORT void BlankStatusIgnored();
111 //! Sets Blank Status to be required at a given value
112 Standard_EXPORT void BlankStatusRequired (const Standard_Integer val);
114 //! Sets Subordinate Status to be ignored
115 //! (should not be defined, or its value should be 0)
116 Standard_EXPORT void SubordinateStatusIgnored();
118 //! Sets Subordinate Status to be required at a given value
119 Standard_EXPORT void SubordinateStatusRequired (const Standard_Integer val);
121 //! Sets Blank Status to be ignored
122 //! (should not be defined, or its value should be 0)
123 Standard_EXPORT void UseFlagIgnored();
125 //! Sets Blank Status to be required at a given value
126 //! Give -1 to demand UseFlag not zero (but no precise value req.)
127 Standard_EXPORT void UseFlagRequired (const Standard_Integer val);
129 //! Sets Hierarchy Status to be ignored
130 //! (should not be defined, or its value should be 0)
131 Standard_EXPORT void HierarchyStatusIgnored();
133 //! Sets Hierarchy Status to be required at a given value
134 Standard_EXPORT void HierarchyStatusRequired (const Standard_Integer val);
136 //! Performs the Checks on an IGESEntity, according to the
137 //! recorded criteria
138 //! In addition, does minimal Checks, such as admitted range for
139 //! Status, or presence of Error status in some data (Color, ...)
140 Standard_EXPORT void Check (Handle(Interface_Check)& ach, const Handle(IGESData_IGESEntity)& ent) const;
142 //! Performs a Check only on Values of Type Number and Form Number
143 //! This allows to do a check on an Entity not yet completely
144 //! filled but of which Type and Form Number have been already set
145 Standard_EXPORT void CheckTypeAndForm (Handle(Interface_Check)& ach, const Handle(IGESData_IGESEntity)& ent) const;
147 //! Corrects the Directory Entry of an IGES Entity as far as it is
148 //! possible according recorded criteria without any ambiguity :
149 //! - if a numeric Status is required a given value, this value is
151 //! - if an item is required to be Void, or if it recorded as
152 //! Erroneous, it is cleared (set to Void)
153 //! - Type Number is enforced
154 //! - finally Form Number is enforced only if one and only Value
155 //! is admitted (no range, see Constructors of DirChecker)
156 Standard_EXPORT Standard_Boolean Correct (const Handle(IGESData_IGESEntity)& ent) const;
171 Standard_Boolean isitset;
172 Standard_Integer thetype;
173 Standard_Integer theform1;
174 Standard_Integer theform2;
175 IGESData_DefType thestructure;
176 IGESData_DefType thelinefont;
177 IGESData_DefType thelineweig;
178 IGESData_DefType thecolor;
179 Standard_Integer thegraphier;
180 Standard_Integer theblankst;
181 Standard_Integer thesubordst;
182 Standard_Integer theuseflag;
183 Standard_Integer thehierst;
194 #endif // _IGESData_DirChecker_HeaderFile