Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:58:28

0001 // Created on: 1992-10-29
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 _Interface_ParamSet_HeaderFile
0018 #define _Interface_ParamSet_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_PCharacter.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <Standard_Transient.hxx>
0026 #include <Interface_ParamType.hxx>
0027 class Interface_ParamList;
0028 class Interface_FileParameter;
0029 
0030 //! Defines an ordered set of FileParameters, in a way to be
0031 //! efficient as in memory requirement or in speed
0032 class Interface_ParamSet : public Standard_Transient
0033 {
0034 
0035 public:
0036   //! Creates an empty ParamSet, beginning at number "nst" and of
0037   //! initial reservation "nres" : the "nres" first parameters
0038   //! which follow "ndeb" (included) will be put in an Array
0039   //! (a ParamList). The remainders are set in Next(s) ParamSet(s)
0040   Standard_EXPORT Interface_ParamSet(const int nres, const int nst = 1);
0041 
0042   //! Adds a parameter defined as its Value (CString and length) and
0043   //! Type. Optional EntityNumber (for FileReaderData) can be given
0044   //! Allows a better memory management than Appending a
0045   //! complete FileParameter
0046   //! If <lnval> < 0, <val> is assumed to be managed elsewhere : its
0047   //! address is stored as such. Else, <val> is copied in a locally
0048   //! (quickly) managed Page of Characters
0049   //! Returns new count of recorded Parameters
0050   Standard_EXPORT int Append(const char* const         val,
0051                              const int                 lnval,
0052                              const Interface_ParamType typ,
0053                              const int                 nument);
0054 
0055   //! Adds a parameter at the end of the ParamSet (transparent
0056   //! about reservation and "Next")
0057   //! Returns new count of recorded Parameters
0058   Standard_EXPORT int Append(const Interface_FileParameter& FP);
0059 
0060   //! Returns the total count of parameters (including nexts)
0061   Standard_EXPORT int NbParams() const;
0062 
0063   //! Returns a parameter identified by its number
0064   Standard_EXPORT const Interface_FileParameter& Param(const int num) const;
0065 
0066   //! Same as above, but in order to be modified on place
0067   Standard_EXPORT Interface_FileParameter& ChangeParam(const int num);
0068 
0069   //! Changes a parameter identified by its number
0070   Standard_EXPORT void SetParam(const int num, const Interface_FileParameter& FP);
0071 
0072   //! Builds and returns the sub-list corresponding to parameters,
0073   //! from "num" included, with count "nb"
0074   //! If <num> and <nb> are zero, returns the whole list
0075   Standard_EXPORT occ::handle<Interface_ParamList> Params(const int num, const int nb) const;
0076 
0077   //! Destructor (waiting for transparent memory management)
0078   Standard_EXPORT void Destroy();
0079 
0080   ~Interface_ParamSet() override { Destroy(); }
0081 
0082   DEFINE_STANDARD_RTTIEXT(Interface_ParamSet, Standard_Transient)
0083 
0084 private:
0085   Standard_PCharacter              theval;
0086   int                              thelnval;
0087   int                              thelnres;
0088   int                              thenbpar;
0089   int                              themxpar;
0090   occ::handle<Interface_ParamList> thelist;
0091   occ::handle<Interface_ParamSet>  thenext;
0092 };
0093 
0094 #endif // _Interface_ParamSet_HeaderFile