Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-25 08:29:46

0001 // Created on: 1994-05-27
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-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_Transformer_HeaderFile
0018 #define _IFSelect_Transformer_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Transient.hxx>
0024 class Interface_Graph;
0025 class Interface_Protocol;
0026 class Interface_CheckIterator;
0027 class Interface_InterfaceModel;
0028 class TCollection_AsciiString;
0029 
0030 class IFSelect_Transformer;
0031 DEFINE_STANDARD_HANDLE(IFSelect_Transformer, Standard_Transient)
0032 
0033 //! A Transformer defines the way an InterfaceModel is transformed
0034 //! (without sending it to a file).
0035 //! In order to work, each type of Transformer defines it method
0036 //! Perform, it can be parametred as needed.
0037 //!
0038 //! It receives a Model (the data set) as input. It then can :
0039 //! - edit this Model on the spot
0040 //!   (i.e. alter its content: by editing entities, or adding/replacing some ...)
0041 //! - produce a copied Model, which detains the needed changes
0042 //!   (typically on the same type, but some or all entities being
0043 //!   rebuilt or converted; or converted from a protocol to another one)
0044 class IFSelect_Transformer : public Standard_Transient
0045 {
0046 
0047 public:
0048   //! Performs a Transformation (defined by each sub-class) :
0049   //! <G> gives the input data (especially the starting model) and
0050   //! can be used for queries (by Selections, etc...)
0051   //! <protocol> allows to work with General Services as necessary
0052   //! (it applies to input data)
0053   //! If the change corresponds to a conversion to a new protocol,
0054   //! see also the method ChangeProtocol
0055   //! <checks> stores produced checks messages if any
0056   //! <newmod> gives the result of the transformation :
0057   //! - if it is Null (i.e. has not been affected), the transformation
0058   //! has been made on the spot, it is assumed to cause no change
0059   //! to the graph of dependances
0060   //! - if it equates the starting Model, it has been transformed on
0061   //! the spot (possibiliy some entities were replaced inside it)
0062   //! - if it is new, it corresponds to a new data set which replaces
0063   //! the starting one
0064   //!
0065   //! <me> is mutable to allow results for ChangeProtocol to be
0066   //! memorized if needed, and to store information useful for
0067   //! the method Updated
0068   //!
0069   //! Returns True if Done, False if an Error occurred:
0070   //! in this case, if a new data set has been produced, the transformation is ignored,
0071   //! else data may be corrupted.
0072   Standard_EXPORT virtual Standard_Boolean Perform(const Interface_Graph&            G,
0073                                                    const Handle(Interface_Protocol)& protocol,
0074                                                    Interface_CheckIterator&          checks,
0075                                                    Handle(Interface_InterfaceModel)& newmod) = 0;
0076 
0077   //! This methods allows to declare that the Protocol applied to
0078   //! the new Model has changed. It applies to the last call to
0079   //! Perform.
0080   //!
0081   //! Returns True if the Protocol has changed, False else.
0082   //! The provided default keeps the starting Protocol. This method
0083   //! should be redefined as required by the effect of Perform.
0084   Standard_EXPORT virtual Standard_Boolean ChangeProtocol(
0085     Handle(Interface_Protocol)& newproto) const;
0086 
0087   //! This method allows to know what happened to a starting
0088   //! entity after the last Perform. If <entfrom> (from starting
0089   //! model) has one and only one known item which corresponds in
0090   //! the new produced model, this method must return True and
0091   //! fill the argument <entto>. Else, it returns False.
0092   Standard_EXPORT virtual Standard_Boolean Updated(const Handle(Standard_Transient)& entfrom,
0093                                                    Handle(Standard_Transient)& entto) const = 0;
0094 
0095   //! Returns a text which defines the way a Transformer works
0096   //! (to identify the transformation it performs)
0097   Standard_EXPORT virtual TCollection_AsciiString Label() const = 0;
0098 
0099   DEFINE_STANDARD_RTTIEXT(IFSelect_Transformer, Standard_Transient)
0100 };
0101 
0102 #endif // _IFSelect_Transformer_HeaderFile