Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-22 08:30:02

0001 // Created on: 1992-10-26
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_ParamCursor_HeaderFile
0018 #define _IGESData_ParamCursor_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Boolean.hxx>
0025 
0026 //! Auxiliary class for ParamReader.
0027 //! It stores commands for a ParamReader to manage the current
0028 //! parameter number. Used by methods Read... from ParamReader.
0029 //! It allows to define the following commands :
0030 //! - read a parameter specified by a precise Number (basic case)
0031 //! - read a parameter then set Current Number to follow its number
0032 //! - read the current parameter (with Current Number) then
0033 //! advance Current Number by one
0034 //! - idem with several : read "nb" parameters from one specified,
0035 //! included, with or without setting Current Number to follow
0036 //! last parameter read
0037 //! - read several parameter from the current one, then advance
0038 //! Current Number to follow the last one read
0039 //! - Read several parameters (as above) but in interlaced lists,
0040 //! i.e. from complex items (each one including successively for
0041 //! instance, an Integer, a Real, an Entity ...)
0042 //!
0043 //! If commands to advance Current Number are not set, it must be
0044 //! set by the user (with method SetCurrent from ParamReader)
0045 //! ParamReader offers methods which create most useful cases
0046 class IGESData_ParamCursor
0047 {
0048 public:
0049   DEFINE_STANDARD_ALLOC
0050 
0051   //! Creates a Cursor to read a precise parameter of ParamReader,
0052   //! identified by its number, then set Current Number to "num + 1"
0053   //! (this constructor allows to simply give a Number to a method
0054   //! Read... from ParamReader, which will be translated into a
0055   //! ParamCursor by compiler)
0056   Standard_EXPORT IGESData_ParamCursor(const Standard_Integer num);
0057 
0058   //! Creates a Cursor to read a list of parameters (count "nb")
0059   //! starting from a precise one (number "num") included, then
0060   //! set Current Number of ParamNumber to the first following one
0061   //! ("num + nb")
0062   //! If size is given, it means that each parameter is made of more
0063   //! than one term. One term is the normal (default) case : for
0064   //! instance, a Parameter comprises one Integer, or one Entity ...
0065   //! Size gives the complete size of each Item if it is complex.
0066   //! To be used ONLY IF it is constant
0067   Standard_EXPORT IGESData_ParamCursor(const Standard_Integer num,
0068                                        const Standard_Integer nb,
0069                                        const Standard_Integer size = 1);
0070 
0071   //! Defines the size of a term to read in the item : this commands
0072   //! ParamReader to read "size" parameters for each item, then
0073   //! skip the remainder of the item to the same term of next Item
0074   //! (that is, skip "item size" - "term size")
0075   //!
0076   //! In addition, Offset from beginning of Item is managed :
0077   //! After being created, and for the first call to SetTerm, the
0078   //! part of Item to be read begins exactly as the Item begins
0079   //! But after a SetTerm, the next read will add an offset which is
0080   //! the size of former term.
0081   //!
0082   //! autoadv commands Advance management. If it is True (default),
0083   //! the last SetTerm (Item size has been covered) calls SetAdvance
0084   //! If it is False, SetAdvance must be called directly if necessary
0085   //!
0086   //! Error if a SetTerm overpasses the size of the Item
0087   Standard_EXPORT void SetTerm(const Standard_Integer size,
0088                                const Standard_Boolean autoadv = Standard_True);
0089 
0090   //! Defines a term of one Parameter (very current case)
0091   Standard_EXPORT void SetOne(const Standard_Boolean autoadv = Standard_True);
0092 
0093   //! Defines a term of two Parameters for a XY (current case)
0094   Standard_EXPORT void SetXY(const Standard_Boolean autoadv = Standard_True);
0095 
0096   //! Defines a term of three Parameters for XYZ (current case)
0097   Standard_EXPORT void SetXYZ(const Standard_Boolean autoadv = Standard_True);
0098 
0099   //! Changes command to advance current cursor after reading
0100   //! parameters. If "advance" True, sets advance, if "False",
0101   //! resets it. ParamCursor is created by default with True.
0102   Standard_EXPORT void SetAdvance(const Standard_Boolean advance);
0103 
0104   //! Returns (included) starting number for reading parameters
0105   Standard_Integer Start() const;
0106 
0107   //! Returns (excluded) upper limit number for reading parameters
0108   Standard_Integer Limit() const;
0109 
0110   //! Returns required count of items to be read
0111   Standard_Integer Count() const;
0112 
0113   //! Returns length of item (count of parameters per item)
0114   Standard_Integer ItemSize() const;
0115 
0116   //! Returns length of current term (count of parameters) in item
0117   Standard_Integer TermSize() const;
0118 
0119   //! Returns offset from which current term must be read in item
0120   Standard_Integer Offset() const;
0121 
0122   //! Returns True if Advance command has been set
0123   Standard_Boolean Advance() const;
0124 
0125 protected:
0126 private:
0127   Standard_Integer thestart;
0128   Standard_Integer thelimit;
0129   Standard_Integer thecount;
0130   Standard_Integer theisize;
0131   Standard_Integer theoffst;
0132   Standard_Integer thetsize;
0133   Standard_Boolean theadv;
0134 };
0135 
0136 #include <IGESData_ParamCursor.lxx>
0137 
0138 #endif // _IGESData_ParamCursor_HeaderFile