1 // Created on: 1992-12-18
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IGESData_FreeFormatEntity_HeaderFile
18 #define _IGESData_FreeFormatEntity_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TColStd_HSequenceOfInteger.hxx>
24 #include <IGESData_UndefinedEntity.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Interface_ParamType.hxx>
28 #include <Standard_CString.hxx>
29 #include <IGESData_HArray1OfIGESEntity.hxx>
30 class Standard_OutOfRange;
31 class Interface_InterfaceError;
32 class IGESData_IGESEntity;
33 class TCollection_HAsciiString;
34 class IGESData_IGESWriter;
37 class IGESData_FreeFormatEntity;
38 DEFINE_STANDARD_HANDLE(IGESData_FreeFormatEntity, IGESData_UndefinedEntity)
40 //! This class allows to create IGES Entities in a literal form :
41 //! their definition is free, but they are not recognized as
42 //! instances of specific classes.
44 //! This is a way to define test files without having to create
45 //! and fill specific classes of Entities, or creating an IGES
46 //! File ex nihilo, with respect for all format constraints
47 //! (such a way is very difficult to run and to master).
49 //! This class has the same content as an UndefinedEntity, only
50 //! it gives way to act on its content
51 class IGESData_FreeFormatEntity : public IGESData_UndefinedEntity
57 //! Creates a completely empty FreeFormatEntity
58 Standard_EXPORT IGESData_FreeFormatEntity();
60 //! Sets Type Number to a new Value, and Form Number to Zero
61 Standard_EXPORT void SetTypeNumber (const Standard_Integer typenum);
63 //! Sets Form Number to a new Value (to called after SetTypeNumber)
64 Standard_EXPORT void SetFormNumber (const Standard_Integer formnum);
66 //! Gives count of recorded parameters
67 Standard_EXPORT Standard_Integer NbParams() const;
69 //! Returns data of a Parameter : its type, and the entity if it
70 //! designates en entity ("ent") or its literal value else ("str")
71 //! Returned value (Boolean) : True if it is an Entity, False else
72 Standard_EXPORT Standard_Boolean ParamData (const Standard_Integer num, Interface_ParamType& ptype, Handle(IGESData_IGESEntity)& ent, Handle(TCollection_HAsciiString)& val) const;
74 //! Returns the ParamType of a Param, given its rank
75 //! Error if num is not between 1 and NbParams
76 Standard_EXPORT Interface_ParamType ParamType (const Standard_Integer num) const;
78 //! Returns True if a Parameter is recorded as an entity
79 //! Error if num is not between 1 and NbParams
80 Standard_EXPORT Standard_Boolean IsParamEntity (const Standard_Integer num) const;
82 //! Returns Entity corresponding to a Param, given its rank
83 //! Error if out of range or if Param num does not designate
85 Standard_EXPORT Handle(IGESData_IGESEntity) ParamEntity (const Standard_Integer num) const;
87 //! Returns True if <num> is noted as for a "Negative Pointer"
88 //! (see AddEntity for details). Senseful only if IsParamEntity
89 //! answers True for <num>, else returns False.
90 Standard_EXPORT Standard_Boolean IsNegativePointer (const Standard_Integer num) const;
92 //! Returns literal value of a Parameter, given its rank
93 //! Error if num is out of range, or if Parameter is not literal
94 Standard_EXPORT Handle(TCollection_HAsciiString) ParamValue (const Standard_Integer num) const;
96 //! Returns the complete list of Ramks of Parameters which have
97 //! been noted as Negative Pointers
98 //! Warning : It is returned as a Null Handle if none was noted
99 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) NegativePointers() const;
101 //! Adds a literal Parameter to the list (as such)
102 Standard_EXPORT void AddLiteral (const Interface_ParamType ptype, const Handle(TCollection_HAsciiString)& val);
104 //! Adds a literal Parameter to the list (builds an HAsciiString)
105 Standard_EXPORT void AddLiteral (const Interface_ParamType ptype, const Standard_CString val);
107 //! Adds a Parameter which references an Entity. If the Entity is
108 //! Null, the added parameter will define a "Null Pointer" (0)
109 //! If <negative> is given True, this will command Sending to File
110 //! (see IGESWriter) to produce a "Negative Pointer"
111 //! (Default is False)
112 Standard_EXPORT void AddEntity (const Interface_ParamType ptype, const Handle(IGESData_IGESEntity)& ent, const Standard_Boolean negative = Standard_False);
114 //! Adds a set of Entities, given as a HArray1OfIGESEntity
115 //! Causes creation of : an Integer Parameter which gives count
116 //! of Entities, then the list of Entities of the Array
117 //! Error if an Entity is not an IGESEntity
118 //! All these Entities will be interpreted as "Positive Pointers"
120 Standard_EXPORT void AddEntities (const Handle(IGESData_HArray1OfIGESEntity)& ents);
122 //! Adds a list of Ranks of Parameters to be noted as Negative
123 //! Pointers (this will be taken into account for Parameters
124 //! which are Entities)
125 Standard_EXPORT void AddNegativePointers (const Handle(TColStd_HSequenceOfInteger)& list);
127 //! Clears all information about Negative Pointers, hence every
128 //! Entity kind Parameter will be sent normally, as Positive
129 Standard_EXPORT void ClearNegativePointers();
131 //! WriteOwnParams is redefined for FreeFormatEntity to take
132 //! into account the supplementary information "Negative Pointer"
133 Standard_EXPORT virtual void WriteOwnParams (IGESData_IGESWriter& IW) const Standard_OVERRIDE;
138 DEFINE_STANDARD_RTTIEXT(IGESData_FreeFormatEntity,IGESData_UndefinedEntity)
148 Handle(TColStd_HSequenceOfInteger) thenegptrs;
159 #endif // _IGESData_FreeFormatEntity_HeaderFile