Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-02 08:22:45

0001 // Created on: 1996-01-26
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IFSelect_ContextWrite_HeaderFile
0018 #define _IFSelect_ContextWrite_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Interface_CheckIterator.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_CString.hxx>
0027 class Interface_InterfaceModel;
0028 class Interface_Protocol;
0029 class IFSelect_AppliedModifiers;
0030 class Interface_HGraph;
0031 class IFSelect_GeneralModifier;
0032 class Interface_Graph;
0033 class Standard_Transient;
0034 class Interface_Check;
0035 
0036 //! This class gathers various information used by File Modifiers
0037 //! apart from the writer object, which is specific of the norm
0038 //! and of the physical format
0039 //!
0040 //! These information are controlled by an object AppliedModifiers
0041 //! (if it is not defined, no modification is allowed on writing)
0042 //!
0043 //! Furthermore, in return, ContextModif can record Checks, either
0044 //! one for all, or one for each Entity. It supports trace too.
0045 class IFSelect_ContextWrite
0046 {
0047 public:
0048   DEFINE_STANDARD_ALLOC
0049 
0050   //! Prepares a ContextWrite with these information :
0051   //! - the model which is to be written
0052   //! - the protocol to be used
0053   //! - the filename
0054   //! - an object AppliedModifiers to work. It gives a list of
0055   //! FileModifiers to be ran, and for each one it can give
0056   //! a restricted list of entities (in the model), else all
0057   //! the model is considered
0058   Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_InterfaceModel)&  model,
0059                                         const Handle(Interface_Protocol)&        proto,
0060                                         const Handle(IFSelect_AppliedModifiers)& applieds,
0061                                         const Standard_CString                   filename);
0062 
0063   //! Same as above but with an already computed Graph
0064   Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_HGraph)&          hgraph,
0065                                         const Handle(Interface_Protocol)&        proto,
0066                                         const Handle(IFSelect_AppliedModifiers)& applieds,
0067                                         const Standard_CString                   filename);
0068 
0069   //! Returns the Model
0070   Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
0071 
0072   //! Returns the Protocol;
0073   Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
0074 
0075   //! Returns the File Name
0076   Standard_EXPORT Standard_CString FileName() const;
0077 
0078   //! Returns the object AppliedModifiers
0079   Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers() const;
0080 
0081   //! Returns the Graph, either given when created, else created
0082   //! the first time it is queried
0083   Standard_EXPORT const Interface_Graph& Graph();
0084 
0085   //! Returns the count of recorded File Modifiers
0086   Standard_EXPORT Standard_Integer NbModifiers() const;
0087 
0088   //! Sets active the File Modifier n0 <numod>
0089   //! Then, it prepares the list of entities to consider, if any
0090   //! Returns False if <numod> out of range
0091   Standard_EXPORT Standard_Boolean SetModifier(const Standard_Integer numod);
0092 
0093   //! Returns the currently active File Modifier. Cast to be done
0094   //! Null if not properly set : must be test IsNull after casting
0095   Standard_EXPORT Handle(IFSelect_GeneralModifier) FileModifier() const;
0096 
0097   //! Returns True if no modifier is currently set
0098   Standard_EXPORT Standard_Boolean IsForNone() const;
0099 
0100   //! Returns True if the current modifier is to be applied to
0101   //! the whole model. Else, a restricted list of selected entities
0102   //! is defined, it can be exploited by the File Modifier
0103   Standard_EXPORT Standard_Boolean IsForAll() const;
0104 
0105   //! Returns the total count of selected entities
0106   Standard_EXPORT Standard_Integer NbEntities() const;
0107 
0108   //! Starts an iteration on selected items. It takes into account
0109   //! IsForAll/IsForNone, by really iterating on all selected items.
0110   Standard_EXPORT void Start();
0111 
0112   //! Returns True until the iteration has finished
0113   Standard_EXPORT Standard_Boolean More() const;
0114 
0115   //! Advances the iteration
0116   Standard_EXPORT void Next();
0117 
0118   //! Returns the current selected entity in the model
0119   Standard_EXPORT Handle(Standard_Transient) Value() const;
0120 
0121   //! Adds a Check to the CheckList. If it is empty, nothing is done
0122   //! If it concerns an Entity from the Model (by SetEntity)
0123   //! to which another Check is attached, it is merged to it.
0124   //! Else, it is added or merged as to GlobalCheck.
0125   Standard_EXPORT void AddCheck(const Handle(Interface_Check)& check);
0126 
0127   //! Adds a Warning Message for an Entity from the Model
0128   //! If <start> is not an Entity from the model (e.g. the
0129   //! model itself) this message is added to Global Check.
0130   Standard_EXPORT void AddWarning(const Handle(Standard_Transient)& start,
0131                                   const Standard_CString            mess,
0132                                   const Standard_CString            orig = "");
0133 
0134   //! Adds a Fail Message for an Entity from the Model
0135   //! If <start> is not an Entity from the model (e.g. the
0136   //! model itself) this message is added to Global Check.
0137   Standard_EXPORT void AddFail(const Handle(Standard_Transient)& start,
0138                                const Standard_CString            mess,
0139                                const Standard_CString            orig = "");
0140 
0141   //! Returns a Check given an Entity number (in the Model)
0142   //! by default a Global Check. Creates it the first time.
0143   //! It can then be acknowledged on the spot, in condition that the
0144   //! caller works by reference ("Interface_Check& check = ...")
0145   Standard_EXPORT Handle(Interface_Check) CCheck(const Standard_Integer num = 0);
0146 
0147   //! Returns a Check attached to an Entity from the Model
0148   //! It can then be acknowledged on the spot, in condition that the
0149   //! caller works by reference ("Interface_Check& check = ...")
0150   Standard_EXPORT Handle(Interface_Check) CCheck(const Handle(Standard_Transient)& start);
0151 
0152   //! Returns the complete CheckList
0153   Standard_EXPORT Interface_CheckIterator CheckList() const;
0154 
0155 protected:
0156 private:
0157   Handle(Interface_InterfaceModel)  themodel;
0158   Handle(Interface_Protocol)        theproto;
0159   TCollection_AsciiString           thefile;
0160   Handle(IFSelect_AppliedModifiers) theapply;
0161   Handle(Interface_HGraph)          thehgraf;
0162   Interface_CheckIterator           thecheck;
0163   Standard_Integer                  thenumod;
0164   Standard_Integer                  thenbent;
0165   Standard_Integer                  thecurr;
0166   Handle(IFSelect_GeneralModifier)  themodif;
0167 };
0168 
0169 #endif // _IFSelect_ContextWrite_HeaderFile