Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0030 class ShapeProcess_Context;
0031 DEFINE_STANDARD_HANDLE(ShapeProcess_Context, Standard_Transient)
0032 
0033 //! Provides convenient interface to resource file
0034 //! Allows to load resource file and get values of
0035 //! attributes starting from some scope, for example
0036 //! if scope is defined as "ToV4" and requested parameter
0037 //! is "exec.op", value of "ToV4.exec.op" parameter from
0038 //! the resource file will be returned
0039 class ShapeProcess_Context : public Standard_Transient
0040 {
0041 
0042 public:
0043 
0044   
0045   //! Creates an empty tool
0046   Standard_EXPORT ShapeProcess_Context();
0047   
0048   //! Creates a new tool and initialises by name of
0049   //! resource file and (if specified) starting scope
0050   //! Calls method Init()
0051   Standard_EXPORT ShapeProcess_Context(const Standard_CString file, const Standard_CString scope = "");
0052   
0053   //! Initialises a tool by loading resource file and
0054   //! (if specified) sets starting scope
0055   //! Returns False if resource file not found
0056   Standard_EXPORT Standard_Boolean Init (const Standard_CString file, const Standard_CString scope = "");
0057   
0058   //! Loading Resource_Manager object if this object not
0059   //! equal internal static Resource_Manager object or
0060   //! internal static Resource_Manager object is null
0061   Standard_EXPORT Handle(Resource_Manager) LoadResourceManager (const Standard_CString file);
0062   
0063   //! Returns internal Resource_Manager object
0064   Standard_EXPORT const Handle(Resource_Manager)& ResourceManager() const;
0065   
0066   //! Set a new (sub)scope
0067   Standard_EXPORT void SetScope (const Standard_CString scope);
0068   
0069   //! Go out of current scope
0070   Standard_EXPORT void UnSetScope();
0071   
0072   //! Returns True if parameter is defined in the resource file
0073   Standard_EXPORT Standard_Boolean IsParamSet (const Standard_CString param) const;
0074   
0075   Standard_EXPORT Standard_Boolean GetReal (const Standard_CString param, Standard_Real& val) const;
0076   
0077   Standard_EXPORT Standard_Boolean GetInteger (const Standard_CString param, Standard_Integer& val) const;
0078   
0079   Standard_EXPORT Standard_Boolean GetBoolean (const Standard_CString param, Standard_Boolean& val) const;
0080   
0081   //! Get value of parameter as being of specific type
0082   //! Returns False if parameter is not defined or has a wrong type
0083   Standard_EXPORT Standard_Boolean GetString (const Standard_CString param, TCollection_AsciiString& val) const;
0084   
0085   Standard_EXPORT Standard_Real RealVal (const Standard_CString param, const Standard_Real def) const;
0086   
0087   Standard_EXPORT Standard_Integer IntegerVal (const Standard_CString param, const Standard_Integer def) const;
0088   
0089   Standard_EXPORT Standard_Boolean BooleanVal (const Standard_CString param, const Standard_Boolean def) const;
0090   
0091   //! Get value of parameter as being of specific type
0092   //! If parameter is not defined or does not have expected
0093   //! type, returns default value as specified
0094   Standard_EXPORT Standard_CString StringVal (const Standard_CString param, const Standard_CString def) const;
0095   
0096   //! Sets Messenger used for outputting messages.
0097   Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger);
0098   
0099   //! Returns Messenger used for outputting messages.
0100   Standard_EXPORT Handle(Message_Messenger) Messenger() const;
0101   
0102   //! Sets trace level used for outputting messages
0103   //! - 0: no trace at all
0104   //! - 1: errors
0105   //! - 2: errors and warnings
0106   //! - 3: all messages
0107   //! Default is 1 : Errors traced
0108   Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev);
0109   
0110   //! Returns trace level used for outputting messages.
0111   Standard_EXPORT Standard_Integer TraceLevel() const;
0112 
0113 
0114 
0115 
0116   DEFINE_STANDARD_RTTIEXT(ShapeProcess_Context,Standard_Transient)
0117 
0118 protected:
0119 
0120 
0121 
0122 
0123 private:
0124 
0125 
0126   Handle(Resource_Manager) myRC;
0127   Handle(TColStd_HSequenceOfHAsciiString) myScope;
0128   Handle(Message_Messenger) myMessenger;
0129   Standard_Integer myTraceLev;
0130 
0131 
0132 };
0133 
0134 
0135 
0136 
0137 
0138 
0139 
0140 #endif // _ShapeProcess_Context_HeaderFile