1 // Created on: 2000-08-21
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _ShapeProcess_Context_HeaderFile
17 #define _ShapeProcess_Context_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <TColStd_HSequenceOfHAsciiString.hxx>
23 #include <Standard_Integer.hxx>
24 #include <Standard_Transient.hxx>
25 #include <Standard_CString.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Real.hxx>
28 class Resource_Manager;
29 class Message_Messenger;
30 class Message_ProgressIndicator;
31 class TCollection_AsciiString;
34 class ShapeProcess_Context;
35 DEFINE_STANDARD_HANDLE(ShapeProcess_Context, Standard_Transient)
37 //! Provides convenient interface to resource file
38 //! Allows to load resource file and get values of
39 //! attributes starting from some scope, for example
40 //! if scope is defined as "ToV4" and requested parameter
41 //! is "exec.op", value of "ToV4.exec.op" parameter from
42 //! the resource file will be returned
43 class ShapeProcess_Context : public Standard_Transient
49 //! Creates an empty tool
50 Standard_EXPORT ShapeProcess_Context();
52 //! Creates a new tool and initialises by name of
53 //! resource file and (if specified) starting scope
54 //! Calls method Init()
55 Standard_EXPORT ShapeProcess_Context(const Standard_CString file, const Standard_CString scope = "");
57 //! Initialises a tool by loading resource file and
58 //! (if specified) sets starting scope
59 //! Returns False if resource file not found
60 Standard_EXPORT Standard_Boolean Init (const Standard_CString file, const Standard_CString scope = "");
62 //! Loading Resource_Manager object if this object not
63 //! equal internal static Resource_Manager object or
64 //! internal static Resource_Manager object is null
65 Standard_EXPORT Handle(Resource_Manager) LoadResourceManager (const Standard_CString file);
67 //! Returns internal Resource_Manager object
68 Standard_EXPORT const Handle(Resource_Manager)& ResourceManager() const;
70 //! Set a new (sub)scope
71 Standard_EXPORT void SetScope (const Standard_CString scope);
73 //! Go out of current scope
74 Standard_EXPORT void UnSetScope();
76 //! Returns True if parameter is defined in the resource file
77 Standard_EXPORT Standard_Boolean IsParamSet (const Standard_CString param) const;
79 Standard_EXPORT Standard_Boolean GetReal (const Standard_CString param, Standard_Real& val) const;
81 Standard_EXPORT Standard_Boolean GetInteger (const Standard_CString param, Standard_Integer& val) const;
83 Standard_EXPORT Standard_Boolean GetBoolean (const Standard_CString param, Standard_Boolean& val) const;
85 //! Get value of parameter as being of specific type
86 //! Returns False if parameter is not defined or has a wrong type
87 Standard_EXPORT Standard_Boolean GetString (const Standard_CString param, TCollection_AsciiString& val) const;
89 Standard_EXPORT Standard_Real RealVal (const Standard_CString param, const Standard_Real def) const;
91 Standard_EXPORT Standard_Integer IntegerVal (const Standard_CString param, const Standard_Integer def) const;
93 Standard_EXPORT Standard_Boolean BooleanVal (const Standard_CString param, const Standard_Boolean def) const;
95 //! Get value of parameter as being of specific type
96 //! If parameter is not defined or does not have expected
97 //! type, returns default value as specified
98 Standard_EXPORT Standard_CString StringVal (const Standard_CString param, const Standard_CString def) const;
100 //! Sets Messenger used for outputting messages.
101 Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger);
103 //! Returns Messenger used for outputting messages.
104 Standard_EXPORT Handle(Message_Messenger) Messenger() const;
106 //! Sets Progress Indicator.
107 Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& theProgress);
109 //! Returns Progress Indicator.
110 Standard_EXPORT Handle(Message_ProgressIndicator) Progress() const;
112 //! Sets trace level used for outputting messages
113 //! - 0: no trace at all
115 //! - 2: errors and warnings
116 //! - 3: all messages
117 //! Default is 1 : Errors traced
118 Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev);
120 //! Returns trace level used for outputting messages.
121 Standard_EXPORT Standard_Integer TraceLevel() const;
126 DEFINE_STANDARD_RTTIEXT(ShapeProcess_Context,Standard_Transient)
136 Handle(Resource_Manager) myRC;
137 Handle(TColStd_HSequenceOfHAsciiString) myScope;
138 Handle(Message_Messenger) myMessenger;
139 Handle(Message_ProgressIndicator) myProgress;
140 Standard_Integer myTraceLev;
151 #endif // _ShapeProcess_Context_HeaderFile