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