Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:53

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 
0037 //! This class gathers various information used by File Modifiers
0038 //! apart from the writer object, which is specific of the norm
0039 //! and of the physical format
0040 //!
0041 //! These information are controlled by an object AppliedModifiers
0042 //! (if it is not defined, no modification is allowed on writing)
0043 //!
0044 //! Furthermore, in return, ContextModif can record Checks, either
0045 //! one for all, or one for each Entity. It supports trace too.
0046 class IFSelect_ContextWrite 
0047 {
0048 public:
0049 
0050   DEFINE_STANDARD_ALLOC
0051 
0052   
0053   //! Prepares a ContextWrite with these information :
0054   //! - the model which is to be written
0055   //! - the protocol to be used
0056   //! - the filename
0057   //! - an object AppliedModifiers to work. It gives a list of
0058   //! FileModifiers to be ran, and for each one it can give
0059   //! a restricted list of entities (in the model), else all
0060   //! the model is considered
0061   Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, 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, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, const Standard_CString filename);
0065   
0066   //! Returns the Model
0067   Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
0068   
0069   //! Returns the Protocol;
0070   Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
0071   
0072   //! Returns the File Name
0073   Standard_EXPORT Standard_CString FileName() const;
0074   
0075   //! Returns the object AppliedModifiers
0076   Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers() const;
0077   
0078   //! Returns the Graph, either given when created, else created
0079   //! the first time it is queried
0080   Standard_EXPORT const Interface_Graph& Graph();
0081   
0082   //! Returns the count of recorded File Modifiers
0083   Standard_EXPORT Standard_Integer NbModifiers() const;
0084   
0085   //! Sets active the File Modifier n0 <numod>
0086   //! Then, it prepares the list of entities to consider, if any
0087   //! Returns False if <numod> out of range
0088   Standard_EXPORT Standard_Boolean SetModifier (const Standard_Integer numod);
0089   
0090   //! Returns the currently active File Modifier. Cast to be done
0091   //! Null if not properly set : must be test IsNull after casting
0092   Standard_EXPORT Handle(IFSelect_GeneralModifier) FileModifier() const;
0093   
0094   //! Returns True if no modifier is currently set
0095   Standard_EXPORT Standard_Boolean IsForNone() const;
0096   
0097   //! Returns True if the current modifier is to be applied to
0098   //! the whole model. Else, a restricted list of selected entities
0099   //! is defined, it can be exploited by the File Modifier
0100   Standard_EXPORT Standard_Boolean IsForAll() const;
0101   
0102   //! Returns the total count of selected entities
0103   Standard_EXPORT Standard_Integer NbEntities() const;
0104   
0105   //! Starts an iteration on selected items. It takes into account
0106   //! IsForAll/IsForNone, by really iterating on all selected items.
0107   Standard_EXPORT void Start();
0108   
0109   //! Returns True until the iteration has finished
0110   Standard_EXPORT Standard_Boolean More() const;
0111   
0112   //! Advances the iteration
0113   Standard_EXPORT void Next();
0114   
0115   //! Returns the current selected entity in the model
0116   Standard_EXPORT Handle(Standard_Transient) Value() const;
0117   
0118   //! Adds a Check to the CheckList. If it is empty, nothing is done
0119   //! If it concerns an Entity from the Model (by SetEntity)
0120   //! to which another Check is attached, it is merged to it.
0121   //! Else, it is added or merged as to GlobalCheck.
0122   Standard_EXPORT void AddCheck (const Handle(Interface_Check)& check);
0123   
0124   //! Adds a Warning Message for an Entity from the Model
0125   //! If <start> is not an Entity from the model (e.g. the
0126   //! model itself) this message is added to Global Check.
0127   Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
0128   
0129   //! Adds a Fail Message for an Entity from the Model
0130   //! If <start> is not an Entity from the model (e.g. the
0131   //! model itself) this message is added to Global Check.
0132   Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
0133   
0134   //! Returns a Check given an Entity number (in the Model)
0135   //! by default a Global Check. Creates it the first time.
0136   //! It can then be acknowledged on the spot, in condition that the
0137   //! caller works by reference ("Interface_Check& check = ...")
0138   Standard_EXPORT Handle(Interface_Check) CCheck (const Standard_Integer num = 0);
0139   
0140   //! Returns a Check attached to an Entity from the Model
0141   //! It can then be acknowledged on the spot, in condition that the
0142   //! caller works by reference ("Interface_Check& check = ...")
0143   Standard_EXPORT Handle(Interface_Check) CCheck (const Handle(Standard_Transient)& start);
0144   
0145   //! Returns the complete CheckList
0146   Standard_EXPORT Interface_CheckIterator CheckList() const;
0147 
0148 
0149 
0150 
0151 protected:
0152 
0153 
0154 
0155 
0156 
0157 private:
0158 
0159 
0160 
0161   Handle(Interface_InterfaceModel) themodel;
0162   Handle(Interface_Protocol) theproto;
0163   TCollection_AsciiString thefile;
0164   Handle(IFSelect_AppliedModifiers) theapply;
0165   Handle(Interface_HGraph) thehgraf;
0166   Interface_CheckIterator thecheck;
0167   Standard_Integer thenumod;
0168   Standard_Integer thenbent;
0169   Standard_Integer thecurr;
0170   Handle(IFSelect_GeneralModifier) themodif;
0171 
0172 
0173 };
0174 
0175 
0176 
0177 
0178 
0179 
0180 
0181 #endif // _IFSelect_ContextWrite_HeaderFile