Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-26 08:17:19

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