Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2000-08-21
0002 // Created by: Andrey BETENEV
0003 // Copyright (c) 2000-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _ShapeProcess_Context_HeaderFile
0017 #define _ShapeProcess_Context_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TColStd_HSequenceOfHAsciiString.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <Standard_Transient.hxx>
0025 class Resource_Manager;
0026 class Message_Messenger;
0027 class TCollection_AsciiString;
0028 
0029 class ShapeProcess_Context;
0030 DEFINE_STANDARD_HANDLE(ShapeProcess_Context, Standard_Transient)
0031 
0032 //! Provides convenient interface to resource file
0033 //! Allows to load resource file and get values of
0034 //! attributes starting from some scope, for example
0035 //! if scope is defined as "ToV4" and requested parameter
0036 //! is "exec.op", value of "ToV4.exec.op" parameter from
0037 //! the resource file will be returned
0038 class ShapeProcess_Context : public Standard_Transient
0039 {
0040 
0041 public:
0042   //! Creates an empty tool
0043   Standard_EXPORT ShapeProcess_Context();
0044 
0045   //! Creates a new tool and initialises by name of
0046   //! resource file and (if specified) starting scope
0047   //! Calls method Init()
0048   Standard_EXPORT ShapeProcess_Context(const Standard_CString file,
0049                                        const Standard_CString scope = "");
0050 
0051   //! Initialises a tool by loading resource file and
0052   //! (if specified) sets starting scope
0053   //! Returns False if resource file not found
0054   Standard_EXPORT Standard_Boolean Init(const Standard_CString file,
0055                                         const Standard_CString scope = "");
0056 
0057   //! Loading Resource_Manager object if this object not
0058   //! equal internal static Resource_Manager object or
0059   //! internal static Resource_Manager object is null
0060   Standard_EXPORT Handle(Resource_Manager) LoadResourceManager(const Standard_CString file);
0061 
0062   //! Returns internal Resource_Manager object
0063   Standard_EXPORT const Handle(Resource_Manager)& ResourceManager() const;
0064 
0065   //! Set a new (sub)scope
0066   Standard_EXPORT void SetScope(const Standard_CString scope);
0067 
0068   //! Go out of current scope
0069   Standard_EXPORT void UnSetScope();
0070 
0071   //! Returns True if parameter is defined in the resource file
0072   Standard_EXPORT Standard_Boolean IsParamSet(const Standard_CString param) const;
0073 
0074   Standard_EXPORT Standard_Boolean GetReal(const Standard_CString param, Standard_Real& val) const;
0075 
0076   Standard_EXPORT Standard_Boolean GetInteger(const Standard_CString param,
0077                                               Standard_Integer&      val) const;
0078 
0079   Standard_EXPORT Standard_Boolean GetBoolean(const Standard_CString param,
0080                                               Standard_Boolean&      val) const;
0081 
0082   //! Get value of parameter as being of specific type
0083   //! Returns False if parameter is not defined or has a wrong type
0084   Standard_EXPORT Standard_Boolean GetString(const Standard_CString   param,
0085                                              TCollection_AsciiString& val) const;
0086 
0087   Standard_EXPORT Standard_Real RealVal(const Standard_CString param,
0088                                         const Standard_Real    def) const;
0089 
0090   Standard_EXPORT Standard_Integer IntegerVal(const Standard_CString param,
0091                                               const Standard_Integer def) const;
0092 
0093   Standard_EXPORT Standard_Boolean BooleanVal(const Standard_CString param,
0094                                               const Standard_Boolean def) const;
0095 
0096   //! Get value of parameter as being of specific type
0097   //! If parameter is not defined or does not have expected
0098   //! type, returns default value as specified
0099   Standard_EXPORT Standard_CString StringVal(const Standard_CString param,
0100                                              const Standard_CString def) const;
0101 
0102   //! Sets Messenger used for outputting messages.
0103   Standard_EXPORT void SetMessenger(const Handle(Message_Messenger)& messenger);
0104 
0105   //! Returns Messenger used for outputting messages.
0106   Standard_EXPORT Handle(Message_Messenger) Messenger() const;
0107 
0108   //! Sets trace level used for outputting messages
0109   //! - 0: no trace at all
0110   //! - 1: errors
0111   //! - 2: errors and warnings
0112   //! - 3: all messages
0113   //! Default is 1 : Errors traced
0114   Standard_EXPORT void SetTraceLevel(const Standard_Integer tracelev);
0115 
0116   //! Returns trace level used for outputting messages.
0117   Standard_EXPORT Standard_Integer TraceLevel() const;
0118 
0119   DEFINE_STANDARD_RTTIEXT(ShapeProcess_Context, Standard_Transient)
0120 
0121 protected:
0122 private:
0123   Handle(Resource_Manager)                myRC;
0124   Handle(TColStd_HSequenceOfHAsciiString) myScope;
0125   Handle(Message_Messenger)               myMessenger;
0126   Standard_Integer                        myTraceLev;
0127 };
0128 
0129 #endif // _ShapeProcess_Context_HeaderFile