|
||||
File indexing completed on 2025-01-18 10:03:58
0001 // Created on: 1992-04-07 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 _IGESData_IGESWriter_HeaderFile 0018 #define _IGESData_IGESWriter_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <TColStd_HSequenceOfHAsciiString.hxx> 0025 #include <IGESData_Array1OfDirPart.hxx> 0026 #include <TColStd_Array1OfInteger.hxx> 0027 #include <Standard_Integer.hxx> 0028 #include <IGESData_ReadStage.hxx> 0029 #include <Interface_LineBuffer.hxx> 0030 #include <Interface_FloatWriter.hxx> 0031 #include <Standard_CString.hxx> 0032 #include <Standard_OStream.hxx> 0033 0034 class IGESData_IGESModel; 0035 class IGESData_Protocol; 0036 class IGESData_GlobalSection; 0037 class IGESData_IGESEntity; 0038 class TCollection_HAsciiString; 0039 class gp_XY; 0040 class gp_XYZ; 0041 0042 //! manages atomic file writing, under control of IGESModel : 0043 //! prepare text to be sent then sends it 0044 //! takes into account distinction between successive Sections 0045 class IGESData_IGESWriter 0046 { 0047 public: 0048 0049 DEFINE_STANDARD_ALLOC 0050 0051 0052 //! Creates an IGESWriter, empty ready to work 0053 //! (see the methods SendModel and Print) 0054 Standard_EXPORT IGESData_IGESWriter(const Handle(IGESData_IGESModel)& amodel); 0055 0056 //! Default constructor (not used) to satisfy the compiler 0057 Standard_EXPORT IGESData_IGESWriter(); 0058 0059 //! Constructor by copy (not used) to satisfy the compiler 0060 Standard_EXPORT IGESData_IGESWriter(const IGESData_IGESWriter& other); 0061 0062 //! Returns the embedded FloatWriter, which controls sending Reals 0063 //! Use this method to access FloatWriter in order to consult or 0064 //! change its options (MainFormat, FormatForRange,ZeroSuppress), 0065 //! because it is returned as the address of its field 0066 Standard_EXPORT Interface_FloatWriter& FloatWriter(); 0067 0068 //! Returns the write mode, in order to be read and/or changed 0069 //! Write Mode controls the way final print works 0070 //! 0 (D) : Normal IGES, 10 : FNES 0071 Standard_EXPORT Standard_Integer& WriteMode(); 0072 0073 //! Sends an additional Starting Line : this is the way used to 0074 //! send comments in an IGES File (at beginning of the file). 0075 //! If the line is more than 72 char.s long, it is splited into 0076 //! as many lines as required to send it completely 0077 Standard_EXPORT void SendStartLine (const Standard_CString startline); 0078 0079 //! Sends the complete IGESModel (Global Section, Entities as 0080 //! Directory Entries & Parameter Lists, etc...) 0081 //! i.e. fills a list of texts. Once filled, it can be sent by 0082 //! method Print 0083 Standard_EXPORT void SendModel (const Handle(IGESData_Protocol)& protocol); 0084 0085 //! declares sending of S section (only a declaration) 0086 //! error if state is not initial 0087 Standard_EXPORT void SectionS(); 0088 0089 //! prepares sending of header, from a GlobalSection (stores it) 0090 //! error if SectionS was not called just before 0091 //! takes in account special characters (Separator, EndMark) 0092 Standard_EXPORT void SectionG (const IGESData_GlobalSection& header); 0093 0094 //! prepares sending of list of entities, as Sections D (directory 0095 //! list) and P (Parameters lists, one per entity) 0096 //! Entities will be then processed, one after the other 0097 //! error if SectionG has not be called just before 0098 Standard_EXPORT void SectionsDP(); 0099 0100 //! declares sending of T section (only a declaration) 0101 //! error if does not follow Entities sending 0102 Standard_EXPORT void SectionT(); 0103 0104 //! translates directory part of an Entity into a literal DirPart 0105 //! Some infos are computed after sending parameters 0106 //! Error if not in sections DP or Stage not "Dir" 0107 Standard_EXPORT void DirPart (const Handle(IGESData_IGESEntity)& anent); 0108 0109 //! sends own parameters of the entity, by sending firstly its 0110 //! type, then calling specific method WriteOwnParams 0111 //! Error if not in sections DP or Stage not "Own" 0112 Standard_EXPORT void OwnParams (const Handle(IGESData_IGESEntity)& anent); 0113 0114 //! sends associativity list, as complement of parameters list 0115 //! error if not in sections DP or Stage not "Associativity" 0116 Standard_EXPORT void Associativities (const Handle(IGESData_IGESEntity)& anent); 0117 0118 //! sends property list, as complement of parameters list 0119 //! error if not in sections DP or Stage not "Property" 0120 Standard_EXPORT void Properties (const Handle(IGESData_IGESEntity)& anent); 0121 0122 //! declares end of sending an entity (ends param list by ';') 0123 Standard_EXPORT void EndEntity(); 0124 0125 //! sends a void parameter, that is null text 0126 Standard_EXPORT void SendVoid(); 0127 0128 //! sends an Integer parameter 0129 Standard_EXPORT void Send (const Standard_Integer val); 0130 0131 //! sends a Boolean parameter as an Integer value 0(False)/1(True) 0132 Standard_EXPORT void SendBoolean (const Standard_Boolean val); 0133 0134 //! sends a Real parameter. Works with FloatWriter 0135 Standard_EXPORT void Send (const Standard_Real val); 0136 0137 //! sends a Text parameter under Hollerith form 0138 Standard_EXPORT void Send (const Handle(TCollection_HAsciiString)& val); 0139 0140 //! sends a Reference to an Entity (if its Number is N, its 0141 //! pointer is 2*N-1) 0142 //! If <val> is Null, "0" will be sent 0143 //! If <negative> is True, "Pointer" is sent as negative 0144 Standard_EXPORT void Send (const Handle(IGESData_IGESEntity)& val, const Standard_Boolean negative = Standard_False); 0145 0146 //! Helper method to avoid ambiguity of calls to above methods Send() for 0147 //! classes derived from IGESData_IGESEntity, for VC++ 10 and 11 compillers 0148 template <class T> 0149 void Send (const Handle(T)& val, Standard_Boolean negative = Standard_False, 0150 typename opencascade::std::enable_if<opencascade::std::is_base_of<IGESData_IGESEntity, T>::value>::type * = 0) 0151 { 0152 Send ((const Handle(IGESData_IGESEntity)&)val, negative); 0153 } 0154 0155 //! sends a parameter under its exact form given as a string 0156 Standard_EXPORT void SendString (const Handle(TCollection_HAsciiString)& val); 0157 0158 //! Sends a XY, interpreted as a couple of 2 Reals (X & Y) 0159 Standard_EXPORT void Send (const gp_XY& val); 0160 0161 //! Sends a XYZ, interpreted as a couple of 2 Reals (X , Y & Z) 0162 Standard_EXPORT void Send (const gp_XYZ& val); 0163 0164 //! Returns the list of strings for a section given its rank 0165 //! 1 : Start (if not empty) 2 : Global 3 or 4 : Parameters 0166 //! RQ: no string list for Directory section 0167 //! An empty section gives a null handle 0168 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) SectionStrings (const Standard_Integer numsec) const; 0169 0170 //! Writes result on an output defined as an OStream 0171 //! resolves stored infos at this time; in particular, numbers of 0172 //! lines used to address P-section from D-section and final totals 0173 //! Takes WriteMode into account 0174 Standard_EXPORT Standard_Boolean Print (Standard_OStream& S) const; 0175 0176 private: 0177 0178 //! Basic action of adding a string to current parameter list as a 0179 //! line; manages size limit (64 or 72 according Sestion G or P) 0180 //! <more>, if precised, requires that <more> characters will 0181 //! remain free on the current line once this AddString done 0182 Standard_EXPORT void AddString (const Handle(TCollection_HAsciiString)& val, const Standard_Integer more = 0); 0183 0184 //! Basic action of adding a string to current parameter list as a 0185 //! line. Manages size limit (64 or 72 according Sestion G or P) 0186 //! <val> is the string and <lnval> its length. If <lnval> is not 0187 //! given, it is computed by strlen(val). 0188 //! <more>, if precised, requires that <more> characters will 0189 //! remain free on the current line once this AddString done 0190 Standard_EXPORT void AddString (const Standard_CString val, const Standard_Integer lnval = 0, const Standard_Integer more = 0); 0191 0192 //! Adds a string defined as a single character (for instance, the 0193 //! parameter separator). Manages size limit 0194 //! <more>, if precised, requires that <more> characters will 0195 //! remain free on the current line once this AddString done 0196 Standard_EXPORT void AddChar (const Standard_Character val, const Standard_Integer more = 0); 0197 0198 0199 private: 0200 0201 Handle(IGESData_IGESModel) themodel; 0202 Handle(TColStd_HSequenceOfHAsciiString) thestar; 0203 Handle(TColStd_HSequenceOfHAsciiString) thehead; 0204 Standard_Character thesep; 0205 Standard_Character theendm; 0206 IGESData_Array1OfDirPart thedirs; 0207 TColStd_Array1OfInteger thepnum; 0208 Handle(TColStd_HSequenceOfHAsciiString) thepars; 0209 Standard_Integer thesect; 0210 IGESData_ReadStage thestep; 0211 Interface_LineBuffer thecurr; 0212 Standard_Integer themodew; 0213 Interface_FloatWriter thefloatw; 0214 }; 0215 0216 #endif // _IGESData_IGESWriter_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |