Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:07

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