Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:17:52

0001 // Created on: 1992-04-06
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1992-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 _IGESData_FileRecognizer_HeaderFile
0018 #define _IGESData_FileRecognizer_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Transient.hxx>
0024 class IGESData_IGESEntity;
0025 class Standard_NoSuchObject;
0026 class IGESData_IGESType;
0027 
0028 class IGESData_FileRecognizer : public Standard_Transient
0029 {
0030 
0031 public:
0032   //! Evaluates if recognition has a result, returns it if yes
0033   //! In case of success, Returns True and puts result in "res"
0034   //! In case of Failure, simply Returns False
0035   //! Works by calling deferred method Eval, and in case of failure,
0036   //! looks for Added Recognizers to work
0037   Standard_EXPORT bool Evaluate(const IGESData_IGESType&          akey,
0038                                 occ::handle<IGESData_IGESEntity>& res);
0039 
0040   //! Returns result of last recognition (call of Evaluate)
0041   Standard_EXPORT occ::handle<IGESData_IGESEntity> Result() const;
0042 
0043   //! Adds a new Recognizer to the Compound, at the end
0044   //! Several calls to Add work by adding in the order of calls :
0045   //! Hence, when Eval has failed to recognize, Evaluate will call
0046   //! Evaluate from the first added Recognizer if there is one,
0047   //! and to the second if there is still no result, and so on
0048   Standard_EXPORT void Add(const occ::handle<IGESData_FileRecognizer>& reco);
0049 
0050   DEFINE_STANDARD_RTTI_INLINE(IGESData_FileRecognizer, Standard_Transient)
0051 
0052 protected:
0053   //! Assumes that no result has yet been recognized
0054   Standard_EXPORT IGESData_FileRecognizer();
0055 
0056   //! Records the result of the recognition. Called by specific
0057   //! method Eval to record a result : after calling it, Eval has
0058   //! finished and can return
0059   Standard_EXPORT void SetOK(const occ::handle<IGESData_IGESEntity>& aresult);
0060 
0061   //! Records that recognition gives no result
0062   Standard_EXPORT void SetKO();
0063 
0064   //! THIS METHOD DEFINES THE RECOGNITION PROTOCOL, it is proper to
0065   //! each precise type of Recognizer
0066   //! For a suitable type of akey, it calls SetOK(result) where
0067   //! result is an empty result of appropriate type, then returns
0068   Standard_EXPORT virtual void Eval(const IGESData_IGESType& akey) = 0;
0069 
0070 private:
0071   occ::handle<IGESData_IGESEntity>     theres;
0072   bool                                 hasnext;
0073   occ::handle<IGESData_FileRecognizer> thenext;
0074 };
0075 
0076 #endif // _IGESData_FileRecognizer_HeaderFile