Back to home page

EIC code displayed by LXR

 
 

    


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

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