Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1992-10-28
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 _Interface_CheckIterator_HeaderFile
0018 #define _Interface_CheckIterator_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Interface_HSequenceOfCheck.hxx>
0025 #include <TColStd_HSequenceOfInteger.hxx>
0026 #include <TCollection_AsciiString.hxx>
0027 #include <Standard_CString.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <Interface_CheckStatus.hxx>
0030 #include <TColStd_HSequenceOfTransient.hxx>
0031 class Interface_InterfaceModel;
0032 class Interface_IntVal;
0033 class Interface_Check;
0034 class Standard_Transient;
0035 
0036 // resolve name collisions with X11 headers
0037 #ifdef Status
0038   #undef Status
0039 #endif
0040 
0041 //! Result of a Check operation (especially from InterfaceModel)
0042 class Interface_CheckIterator
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Creates an empty CheckIterator
0048   Standard_EXPORT Interface_CheckIterator();
0049 
0050   //! Creates a CheckIterator with a name (displayed by Print as a
0051   //! title)
0052   Standard_EXPORT Interface_CheckIterator(const Standard_CString name);
0053 
0054   //! Sets / Changes the name
0055   Standard_EXPORT void SetName(const Standard_CString name);
0056 
0057   //! Returns the recorded name (can be empty)
0058   Standard_EXPORT Standard_CString Name() const;
0059 
0060   //! Defines a Model, used to locate entities (not required, if it
0061   //! is absent, entities are simply less documented)
0062   Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model);
0063 
0064   //! Returns the stored model (can be a null handle)
0065   Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
0066 
0067   //! Clears the list of checks
0068   Standard_EXPORT void Clear();
0069 
0070   //! Merges another CheckIterator into <me>, i.e. adds each of its
0071   //! Checks. Content of <other> remains unchanged.
0072   //! Takes also the Model but not the Name
0073   Standard_EXPORT void Merge(Interface_CheckIterator& other);
0074 
0075   //! Adds a Check to the list to be iterated
0076   //! This Check is Accompanied by Entity Number in the Model
0077   //! (0 for Global Check or Entity unknown in the Model), if 0 and
0078   //! Model is recorded in <me>, it is computed
0079   Standard_EXPORT void Add(const Handle(Interface_Check)& ach, const Standard_Integer num = 0);
0080 
0081   //! Returns the Check which was attached to an Entity given its
0082   //! Number in the Model. <num>=0 is for the Global Check.
0083   //! If no Check was recorded for this Number, returns an empty
0084   //! Check.
0085   //! Remark : Works apart from the iteration methods (no interference)
0086   Standard_EXPORT const Handle(Interface_Check)& Check(const Standard_Integer num) const;
0087 
0088   //! Returns the Check attached to an Entity
0089   //! If no Check was recorded for this Entity, returns an empty
0090   //! Check.
0091   //! Remark : Works apart from the iteration methods (no interference)
0092   Standard_EXPORT const Handle(Interface_Check)& Check(const Handle(Standard_Transient)& ent) const;
0093 
0094   //! Returns the Check bound to an Entity Number (0 : Global)
0095   //! in order to be consulted or completed on the spot
0096   //! I.e. returns the Check if is already exists, or adds it then
0097   //! returns the new empty Check
0098   Standard_EXPORT Handle(Interface_Check)& CCheck(const Standard_Integer num);
0099 
0100   //! Returns the Check bound to an Entity, in order to be consulted
0101   //! or completed on the spot
0102   //! I.e. returns the Check if is already exists, or adds it then
0103   //! returns the new empty Check
0104   Standard_EXPORT Handle(Interface_Check)& CCheck(const Handle(Standard_Transient)& ent);
0105 
0106   //! Returns True if : no Fail has been recorded if <failsonly> is
0107   //! True, no Check at all if <failsonly> is False
0108   Standard_EXPORT Standard_Boolean IsEmpty(const Standard_Boolean failsonly) const;
0109 
0110   //! Returns worst status among : OK, Warning, Fail
0111   Standard_EXPORT Interface_CheckStatus Status() const;
0112 
0113   //! Tells if this check list complies with a given status :
0114   //! OK (i.e. empty),  Warning (at least one Warning, but no Fail),
0115   //! Fail (at least one), Message (not OK), NoFail, Any
0116   Standard_EXPORT Standard_Boolean Complies(const Interface_CheckStatus status) const;
0117 
0118   //! Returns a CheckIterator which contains the checks which comply
0119   //! with a given status
0120   //! Each check is added completely (no split Warning/Fail)
0121   Standard_EXPORT Interface_CheckIterator Extract(const Interface_CheckStatus status) const;
0122 
0123   //! Returns a CheckIterator which contains the check which comply
0124   //! with a message, plus some conditions as follows :
0125   //! <incl> = 0 : <mess> exactly matches one of the messages
0126   //! <incl> < 0 : <mess> is contained by one of the messages
0127   //! <incl> > 0 : <mess> contains one of the messages
0128   //! For <status> : for CheckWarning and CheckFail, considers only
0129   //! resp. Warning or Check messages. for CheckAny, considers all
0130   //! other values are ignored (answer will be false)
0131   //! Each Check which complies is entirely taken
0132   Standard_EXPORT Interface_CheckIterator Extract(const Standard_CString      mess,
0133                                                   const Standard_Integer      incl,
0134                                                   const Interface_CheckStatus status) const;
0135 
0136   //! Removes the messages of all Checks, under these conditions :
0137   //! <incl> = 0 : <mess> exactly matches one of the messages
0138   //! <incl> < 0 : <mess> is contained by one of the messages
0139   //! <incl> > 0 : <mess> contains one of the messages
0140   //! For <status> : for CheckWarning and CheckFail, considers only
0141   //! resp. Warning or Check messages. for CheckAny, considers all
0142   //! other values are ignored (nothing is done)
0143   //! Returns True if at least one message has been removed, False else
0144   Standard_EXPORT Standard_Boolean Remove(const Standard_CString      mess,
0145                                           const Standard_Integer      incl,
0146                                           const Interface_CheckStatus status);
0147 
0148   //! Returns the list of entities concerned by a Check
0149   //! Only fails if <failsonly> is True, else all non-empty checks
0150   //! If <global> is true, adds the model for a global check
0151   //! Else, global check is ignored
0152   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Checkeds(
0153     const Standard_Boolean failsonly,
0154     const Standard_Boolean global) const;
0155 
0156   //! Starts Iteration. Thus, it is possible to restart it
0157   //! Remark : an iteration may be done with a const Iterator
0158   //! While its content is modified (through a pointer), this allows
0159   //! to give it as a const argument to a function
0160   Standard_EXPORT void Start() const;
0161 
0162   //! Returns True if there are more Checks to get
0163   Standard_EXPORT Standard_Boolean More() const;
0164 
0165   //! Sets Iteration to next Item
0166   Standard_EXPORT void Next() const;
0167 
0168   //! Returns Check currently Iterated
0169   //! It brings all other information (status, messages, ...)
0170   //! The Number of the Entity in the Model is given by Number below
0171   Standard_EXPORT const Handle(Interface_Check)& Value() const;
0172 
0173   //! Returns Number of Entity for the Check currently iterated
0174   //! or 0 for GlobalCheck
0175   Standard_EXPORT Standard_Integer Number() const;
0176 
0177   //! Prints the list of Checks with their attached Numbers
0178   //! If <failsonly> is True, prints only Fail messages
0179   //! If <failsonly> is False, prints all messages
0180   //! If <final> = 0 (D), prints also original messages if different
0181   //! If <final> < 0, prints only original messages
0182   //! If <final> > 0, prints only final messages
0183   //! It uses the recorded Model if it is defined
0184   //! Remark : Works apart from the iteration methods (no interference)
0185   Standard_EXPORT void Print(Standard_OStream&      S,
0186                              const Standard_Boolean failsonly,
0187                              const Standard_Integer final = 0) const;
0188 
0189   //! Works as Print without a model, but for entities which have
0190   //! no attached number (Number not positive), tries to compute
0191   //! this Number from <model> and displays "original" or "computed"
0192   Standard_EXPORT void Print(Standard_OStream&                       S,
0193                              const Handle(Interface_InterfaceModel)& model,
0194                              const Standard_Boolean                  failsonly,
0195                              const Standard_Integer                  final = 0) const;
0196 
0197   //! Clears data of iteration
0198   Standard_EXPORT void Destroy();
0199 
0200   ~Interface_CheckIterator() { Destroy(); }
0201 
0202 protected:
0203 private:
0204   Handle(Interface_HSequenceOfCheck) thelist;
0205   Handle(TColStd_HSequenceOfInteger) thenums;
0206   Handle(Interface_InterfaceModel)   themod;
0207   TCollection_AsciiString            thename;
0208   Handle(Interface_IntVal)           thecurr;
0209 };
0210 
0211 #endif // _Interface_CheckIterator_HeaderFile