Warnings on vc14 were eliminated
[occt.git] / src / Interface / Interface_UndefinedContent.hxx
1 // Created on: 1992-02-04
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_UndefinedContent_HeaderFile
18 #define _Interface_UndefinedContent_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Integer.hxx>
24 #include <TColStd_HArray1OfInteger.hxx>
25 #include <Interface_HArray1OfHAsciiString.hxx>
26 #include <Interface_EntityList.hxx>
27 #include <MMgt_TShared.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Interface_ParamType.hxx>
30 class Standard_OutOfRange;
31 class Standard_NoSuchObject;
32 class Interface_InterfaceMismatch;
33 class Interface_InterfaceError;
34 class Standard_Transient;
35 class TCollection_HAsciiString;
36 class Interface_EntityList;
37 class Interface_CopyTool;
38
39
40 class Interface_UndefinedContent;
41 DEFINE_STANDARD_HANDLE(Interface_UndefinedContent, MMgt_TShared)
42
43 //! Defines resources for an "Undefined Entity" : such an Entity
44 //! is used to describe an Entity which complies with the Norm,
45 //! but of an Unknown Type : hence it is kept under a literal
46 //! form (avoiding to loose data). UndefinedContent offers a way
47 //! to store a list of Parameters, as literals or references to
48 //! other Entities
49 //!
50 //! Each Interface must provide one "UndefinedEntity", which must
51 //! have same basic description as all its types of entities :
52 //! the best way would be double inheritance : on the Entity Root
53 //! of the Norm and on an general "UndefinedEntity"
54 //!
55 //! While it is not possible to do so, the UndefinedEntity of each
56 //! Interface can define its own UndefinedEntity by INCLUDING
57 //! (in a field) this UndefinedContent
58 //!
59 //! Hence, for that UndefinedEntity, define a Constructor which
60 //! creates this UndefinedContent, plus access methods to it
61 //! (or to its data, calling methods defined here).
62 //!
63 //! Finally, the Protocols of each norm have to Create and
64 //! Recognize Unknown Entities of this norm
65 class Interface_UndefinedContent : public MMgt_TShared
66 {
67
68 public:
69
70   
71   //! Defines an empty UndefinedContent
72   Standard_EXPORT Interface_UndefinedContent();
73   
74   //! Gives count of recorded parameters
75   Standard_EXPORT Standard_Integer NbParams() const;
76   
77   //! Gives count of Literal Parameters
78   Standard_EXPORT Standard_Integer NbLiterals() const;
79   
80   //! Returns data of a Parameter : its type, and the entity if it
81   //! designates en entity ("ent") or its literal value else ("str")
82   //! Returned value (Boolean) : True if it is an Entity, False else
83   Standard_EXPORT Standard_Boolean ParamData (const Standard_Integer num, Interface_ParamType& ptype, Handle(Standard_Transient)& ent, Handle(TCollection_HAsciiString)& val) const;
84   
85   //! Returns the ParamType of a Param, given its rank
86   //! Error if num is not between 1 and NbParams
87   Standard_EXPORT Interface_ParamType ParamType (const Standard_Integer num) const;
88   
89   //! Returns True if a Parameter is recorded as an entity
90   //! Error if num is not between 1 and NbParams
91   Standard_EXPORT Standard_Boolean IsParamEntity (const Standard_Integer num) const;
92   
93   //! Returns Entity corresponding to a Param, given its rank
94   Standard_EXPORT Handle(Standard_Transient) ParamEntity (const Standard_Integer num) const;
95   
96   //! Returns litteral value of a Parameter, given its rank
97   Standard_EXPORT Handle(TCollection_HAsciiString) ParamValue (const Standard_Integer num) const;
98   
99   //! Manages reservation for parameters (internal use)
100   //! (nb : total count of parameters, nblit : count of literals)
101   Standard_EXPORT void Reservate (const Standard_Integer nb, const Standard_Integer nblit);
102   
103   //! Adds a literal Parameter to the list
104   Standard_EXPORT void AddLiteral (const Interface_ParamType ptype, const Handle(TCollection_HAsciiString)& val);
105   
106   //! Adds a Parameter which references an Entity
107   Standard_EXPORT void AddEntity (const Interface_ParamType ptype, const Handle(Standard_Transient)& ent);
108   
109   //! Removes a Parameter given its rank
110   Standard_EXPORT void RemoveParam (const Standard_Integer num);
111   
112   //! Sets a new value for the Parameter <num>, to a literal value
113   //! (if it referenced formerly an Entity, this Entity is removed)
114   Standard_EXPORT void SetLiteral (const Standard_Integer num, const Interface_ParamType ptype, const Handle(TCollection_HAsciiString)& val);
115   
116   //! Sets a new value for the Parameter <num>, to reference an
117   //! Entity. To simply change the Entity, see the variant below
118   Standard_EXPORT void SetEntity (const Standard_Integer num, const Interface_ParamType ptype, const Handle(Standard_Transient)& ent);
119   
120   //! Changes the Entity referenced by the Parameter <num>
121   //! (with same ParamType)
122   Standard_EXPORT void SetEntity (const Standard_Integer num, const Handle(Standard_Transient)& ent);
123   
124   //! Returns globally the list of param entities. Note that it can
125   //! be used as shared entity list for the UndefinedEntity
126   Standard_EXPORT Interface_EntityList EntityList() const;
127   
128   //! Copies contents of undefined entities; deigned to be called by
129   //! GetFromAnother method from Undefined entity of each Interface
130   //! (the basic operation is the same regardless the norm)
131   Standard_EXPORT void GetFromAnother (const Handle(Interface_UndefinedContent)& other, Interface_CopyTool& TC);
132
133
134
135
136   DEFINE_STANDARD_RTTIEXT(Interface_UndefinedContent,MMgt_TShared)
137
138 protected:
139
140
141
142
143 private:
144
145
146   Standard_Integer thenbparams;
147   Standard_Integer thenbstr;
148   Handle(TColStd_HArray1OfInteger) theparams;
149   Handle(Interface_HArray1OfHAsciiString) thevalues;
150   Interface_EntityList theentities;
151
152
153 };
154
155
156
157
158
159
160
161 #endif // _Interface_UndefinedContent_HeaderFile