Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:58

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 
0027 //! Auxiliary class for ParamReader.
0028 //! It stores commands for a ParamReader to manage the current
0029 //! parameter number. Used by methods Read... from ParamReader.
0030 //! It allows to define the following commands :
0031 //! - read a parameter specified by a precise Number (basic case)
0032 //! - read a parameter then set Current Number to follow its number
0033 //! - read the current parameter (with Current Number) then
0034 //! advance Current Number by one
0035 //! - idem with several : read "nb" parameters from one specified,
0036 //! included, with or without setting Current Number to follow
0037 //! last parameter read
0038 //! - read several parameter from the current one, then advance
0039 //! Current Number to follow the last one read
0040 //! - Read several parameters (as above) but in interlaced lists,
0041 //! i.e. from complex items (each one including successively for
0042 //! instance, an Integer, a Real, an Entity ...)
0043 //!
0044 //! If commands to advance Current Number are not set, it must be
0045 //! set by the user (with method SetCurrent from ParamReader)
0046 //! ParamReader offers methods which create most useful cases
0047 class IGESData_ParamCursor 
0048 {
0049 public:
0050 
0051   DEFINE_STANDARD_ALLOC
0052 
0053   
0054   //! Creates a Cursor to read a precise parameter of ParamReader,
0055   //! identified by its number, then set Current Number to "num + 1"
0056   //! (this constructor allows to simply give a Number to a method
0057   //! Read... from ParamReader, which will be translated into a
0058   //! ParamCursor by compiler)
0059   Standard_EXPORT IGESData_ParamCursor(const Standard_Integer num);
0060   
0061   //! Creates a Cursor to read a list of parameters (count "nb")
0062   //! starting from a precise one (number "num") included, then
0063   //! set Current Number of ParamNumber to the first following one
0064   //! ("num + nb")
0065   //! If size is given, it means that each parameter is made of more
0066   //! than one term. One term is the normal (default) case : for
0067   //! instance, a Parameter comprises one Integer, or one Entity ...
0068   //! Size gives the complete size of each Item if it is complex.
0069   //! To be used ONLY IF it is constant
0070   Standard_EXPORT IGESData_ParamCursor(const Standard_Integer num, const Standard_Integer nb, const Standard_Integer size = 1);
0071   
0072   //! Defines the size of a term to read in the item : this commands
0073   //! ParamReader to read "size" parameters for each item, then
0074   //! skip the remainder of the item to the same term of next Item
0075   //! (that is, skip "item size" - "term size")
0076   //!
0077   //! In addition, Offset from beginning of Item is managed :
0078   //! After being created, and for the first call to SetTerm, the
0079   //! part of Item to be read begins exactly as the Item begins
0080   //! But after a SetTerm, the next read will add an offset which is
0081   //! the size of former term.
0082   //!
0083   //! autoadv commands Advance management. If it is True (default),
0084   //! the last SetTerm (Item size has been covered) calls SetAdvance
0085   //! If it is False, SetAdvance must be called directly if necessary
0086   //!
0087   //! Error if a SetTerm overpasses the size of the Item
0088   Standard_EXPORT void SetTerm (const Standard_Integer size, 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 
0126 
0127 
0128 protected:
0129 
0130 
0131 
0132 
0133 
0134 private:
0135 
0136 
0137 
0138   Standard_Integer thestart;
0139   Standard_Integer thelimit;
0140   Standard_Integer thecount;
0141   Standard_Integer theisize;
0142   Standard_Integer theoffst;
0143   Standard_Integer thetsize;
0144   Standard_Boolean theadv;
0145 
0146 
0147 };
0148 
0149 
0150 #include <IGESData_ParamCursor.lxx>
0151 
0152 
0153 
0154 
0155 
0156 #endif // _IGESData_ParamCursor_HeaderFile