1 // Created on: 1992-02-11
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _StepData_FileRecognizer_HeaderFile
18 #define _StepData_FileRecognizer_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <Standard_Transient.hxx>
25 class Standard_Transient;
26 class Standard_NoSuchObject;
27 class TCollection_AsciiString;
30 class StepData_FileRecognizer;
31 DEFINE_STANDARD_HANDLE(StepData_FileRecognizer, Standard_Transient)
34 class StepData_FileRecognizer : public Standard_Transient
40 //! Evaluates if recognition has a result, returns it if yes
41 //! In case of success, Returns True and puts result in "res"
42 //! In case of Failure, simply Returns False
43 //! Works by calling deferred method Eval, and in case of failure,
44 //! looks for Added Recognizers to work
45 Standard_EXPORT Standard_Boolean Evaluate (const TCollection_AsciiString& akey, Handle(Standard_Transient)& res);
47 //! Returns result of last recognition (call of Evaluate)
48 Standard_EXPORT Handle(Standard_Transient) Result() const;
50 //! Adds a new Recognizer to the Compound, at the end
51 //! Several calls to Add work by adding in the order of calls :
52 //! Hence, when Eval has failed to recognize, Evaluate will call
53 //! Evaluate from the first added Recognizer if there is one,
54 //! and to the second if there is still no result, and so on
55 Standard_EXPORT void Add (const Handle(StepData_FileRecognizer)& reco);
60 DEFINE_STANDARD_RTTI(StepData_FileRecognizer,Standard_Transient)
65 //! Assumes that no result has yet been recognized
66 Standard_EXPORT StepData_FileRecognizer();
68 //! Records the result of the recognition. Called by specific
69 //! method Eval to record a result : after calling it, Eval has
70 //! finished and can return
71 Standard_EXPORT void SetOK (const Handle(Standard_Transient)& aresult);
73 //! Records that recognition gives no result
74 Standard_EXPORT void SetKO();
76 //! THIS METHOD DEFINES THE RECOGNITION PROTOCOL, it is proper to
77 //! each precise type of Recognizer
78 //! For a suitable type of akey, it calls SetOK(result) where
79 //! result is an empty result of appropriate type, then returns
80 Standard_EXPORT virtual void Eval (const TCollection_AsciiString& akey) = 0;
87 Handle(Standard_Transient) theres;
88 Standard_Boolean hasnext;
89 Handle(StepData_FileRecognizer) thenext;
100 #endif // _StepData_FileRecognizer_HeaderFile