Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:16:41

0001 // Created on: 1994-05-02
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-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 _IFSelect_AppliedModifiers_HeaderFile
0018 #define _IFSelect_AppliedModifiers_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <IFSelect_GeneralModifier.hxx>
0023 #include <NCollection_Sequence.hxx>
0024 #include <Interface_IntList.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <NCollection_HSequence.hxx>
0028 class IFSelect_GeneralModifier;
0029 
0030 //! This class allows to memorize and access to the modifiers
0031 //! which are to be applied to a file. To each modifier, is bound
0032 //! a list of integers (optional) : if this list is absent,
0033 //! the modifier applies to all the file. Else, it applies to the
0034 //! entities designated by these numbers in the produced file.
0035 //!
0036 //! To record a modifier, and a possible list of entity numbers to be applied on:
0037 //! AddModif (amodifier);
0038 //! loop on  AddNum (anumber);
0039 //!
0040 //! To query it,  Count gives the count of recorded modifiers, then for each one:
0041 //! Item (numodif, amodifier, entcount);
0042 //! IsForAll ()  -> can be called, if True, applies on the whole file
0043 //!
0044 //! for (i = 1; i <= entcount; i ++)
0045 //! nument = ItemNum (i);  -> return an entity number
0046 class IFSelect_AppliedModifiers : public Standard_Transient
0047 {
0048 public:
0049   //! Creates an AppliedModifiers, ready to record up to <nbmax>
0050   //! modifiers, on a model of <nbent> entities
0051   Standard_EXPORT IFSelect_AppliedModifiers(const int nbmax, const int nbent);
0052 
0053   //! Records a modifier. By default, it is to apply on all a
0054   //! produced file. Further calls to AddNum will restrict this.
0055   //! Returns True if done, False if too many modifiers are already
0056   //! recorded
0057   Standard_EXPORT bool AddModif(const occ::handle<IFSelect_GeneralModifier>& modif);
0058 
0059   //! Adds a number of entity of the output file to be applied on.
0060   //! If a sequence of AddNum is called after AddModif, this
0061   //! Modifier will be applied on the list of designated entities.
0062   //! Else, it will be applied on all the file
0063   //! Returns True if done, False if no modifier has yet been added
0064   Standard_EXPORT bool AddNum(const int nument);
0065 
0066   //! Returns the count of recorded modifiers
0067   Standard_EXPORT int Count() const;
0068 
0069   //! Returns the description for applied modifier n0 <num> :
0070   //! the modifier itself, and the count of entities to be applied
0071   //! on. If no specific list of number has been defined, returns
0072   //! the total count of entities of the file
0073   //! If this count is zero, then the modifier applies to all
0074   //! the file (see below). Else, the numbers are then queried by
0075   //! calls to ItemNum between 1 and <entcount>
0076   //! Returns True if OK, False if <num> is out of range
0077   Standard_EXPORT bool Item(const int                              num,
0078                             occ::handle<IFSelect_GeneralModifier>& modif,
0079                             int&                                   entcount);
0080 
0081   //! Returns a numero of entity to be applied on, given its rank
0082   //! in the list. If no list is defined (i.e. for all the file),
0083   //! returns <nument> itself, to give all the entities of the file
0084   //! Returns 0 if <nument> out of range
0085   Standard_EXPORT int ItemNum(const int nument) const;
0086 
0087   //! Returns the list of entities to be applied on (see Item)
0088   //! as a HSequence (IsForAll produces the complete list of all
0089   //! the entity numbers of the file
0090   Standard_EXPORT occ::handle<NCollection_HSequence<int>> ItemList() const;
0091 
0092   //! Returns True if the applied modifier queried by last call to
0093   //! Item is to be applied to all the produced file.
0094   //! Else, <entcount> returned by Item gives the count of entity
0095   //! numbers, each one is queried by ItemNum
0096   Standard_EXPORT bool IsForAll() const;
0097 
0098   DEFINE_STANDARD_RTTIEXT(IFSelect_AppliedModifiers, Standard_Transient)
0099 
0100 private:
0101   NCollection_Sequence<occ::handle<IFSelect_GeneralModifier>> themodifs;
0102   Interface_IntList                                           thelists;
0103   int                                                         thenbent;
0104   int                                                         theentcnt;
0105 };
0106 
0107 #endif // _IFSelect_AppliedModifiers_HeaderFile