1 // Created on: 1992-10-29
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Interface_ParamSet_HeaderFile
18 #define _Interface_ParamSet_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_PCharacter.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Transient.hxx>
26 #include <Standard_CString.hxx>
27 #include <Interface_ParamType.hxx>
28 class Interface_ParamList;
29 class Interface_FileParameter;
30
31
32 class Interface_ParamSet;
33 DEFINE_STANDARD_HANDLE(Interface_ParamSet, Standard_Transient)
34
35 //! Defines an ordered set of FileParameters, in a way to be
36 //! efficient as in memory requirement or in speed
37 class Interface_ParamSet : public Standard_Transient
38 {
39
40 public:
41
42
43 //! Creates an empty ParamSet, beginning at number "nst" and of
44 //! initial reservation "nres" : the "nres" first parameters
45 //! which follow "ndeb" (included) will be put in an Array
46 //! (a ParamList). The remainders are set in Next(s) ParamSet(s)
47 Standard_EXPORT Interface_ParamSet(const Standard_Integer nres, const Standard_Integer nst = 1);
48
49 //! Adds a parameter defined as its Value (CString and length) and
50 //! Type. Optional EntityNumber (for FileReaderData) can be given
51 //! Allows a better memory management than Appending a
52 //! complete FileParameter
53 //! If <lnval> < 0, <val> is assumed to be managed elsewhere : its
54 //! address is stored as such. Else, <val> is copied in a locally
55 //! (quickly) managed Page of Characters
56 //! Returns new count of recorded Parameters
57 Standard_EXPORT Standard_Integer Append (const Standard_CString val, const Standard_Integer lnval, const Interface_ParamType typ, const Standard_Integer nument);
58
59 //! Adds a parameter at the end of the ParamSet (transparent
60 //! about reservation and "Next")
61 //! Returns new count of recorded Parameters
62 Standard_EXPORT Standard_Integer Append (const Interface_FileParameter& FP);
63
64 //! Returns the total count of parameters (including nexts)
65 Standard_EXPORT Standard_Integer NbParams() const;
66
67 //! Returns a parameter identified by its number
68 Standard_EXPORT const Interface_FileParameter& Param (const Standard_Integer num) const;
69
70 //! Same as above, but in order to be modified on place
71 Standard_EXPORT Interface_FileParameter& ChangeParam (const Standard_Integer num);
72
73 //! Changes a parameter identified by its number
74 Standard_EXPORT void SetParam (const Standard_Integer num, const Interface_FileParameter& FP);
75
76 //! Builds and returns the sub-list corresponding to parameters,
77 //! from "num" included, with count "nb"
78 //! If <num> and <nb> are zero, returns the whole list
79 Standard_EXPORT Handle(Interface_ParamList) Params (const Standard_Integer num, const Standard_Integer nb) const;
80
81 //! Destructor (waiting for transparent memory management)
82 Standard_EXPORT void Destroy();
~Interface_ParamSet()83 ~Interface_ParamSet()
84 {
85 Destroy();
86 }
87
88
89
90 DEFINE_STANDARD_RTTIEXT(Interface_ParamSet,Standard_Transient)
91
92 protected:
93
94
95
96
97 private:
98
99
100 Standard_PCharacter theval;
101 Standard_Integer thelnval;
102 Standard_Integer thelnres;
103 Standard_Integer thenbpar;
104 Standard_Integer themxpar;
105 Handle(Interface_ParamList) thelist;
106 Handle(Interface_ParamSet) thenext;
107
108
109 };
110
111
112
113
114
115
116
117 #endif // _Interface_ParamSet_HeaderFile
118