Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:22

0001 // Created on: 2007-04-17
0002 // Created by: Michael Sazonov
0003 // Copyright (c) 2007-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 // The original implementation Copyright: (C) RINA S.p.A
0017 
0018 #ifndef TObj_CheckModel_HeaderFile
0019 #define TObj_CheckModel_HeaderFile
0020 
0021 #include <TObj_Model.hxx>
0022 #include <Message_Algorithm.hxx>
0023 
0024 /**
0025  * This class provides consistency check of the TObj model.
0026  * It collects all inconsistencies in the status bits and prepaires
0027  * messages to be sent using SendStatusMessages (SendMessages) method.
0028  * It supports also the fix mode, in which some inconsistencies are
0029  * corrected.
0030  */
0031 
0032 class TObj_CheckModel: public Message_Algorithm
0033 {
0034 public:
0035   //! Initialize checker by model
0036   TObj_CheckModel(const Handle(TObj_Model)& theModel)
0037     : myModel (theModel),
0038       myToFix (Standard_False)
0039   {}
0040 
0041   //! Sets flag allowing fixing inconsistencies
0042   void SetToFix(const Standard_Boolean theToFix)
0043   { myToFix = theToFix; }
0044 
0045   //! Returns true if it is allowed to fix inconsistencies
0046   Standard_Boolean IsToFix() const
0047   { return myToFix; }
0048 
0049   //! Returns the checked model
0050   const Handle(TObj_Model)& GetModel() const
0051   { return myModel; }
0052 
0053   //! Empty virtual destructor
0054   virtual ~TObj_CheckModel () {}
0055 
0056   //! Performs all checks. Descendants should call parent method before
0057   //! doing own checks.
0058   //! This implementation checks OCAF references and back references
0059   //! between objects of the model.
0060   //! Returns true if no inconsistencies found.
0061   virtual Standard_EXPORT Standard_Boolean Perform();
0062 
0063 private:
0064   //! Check References (and back references in model).
0065   //! This method just tries to find object to that this reference is indicate and
0066   //! test if that object is not null or not deleted. Also it test if that object has back 
0067   //! reference to correct object (object that has forward reference).
0068   Standard_EXPORT Standard_Boolean checkReferences();
0069 
0070 private:
0071   Handle(TObj_Model) myModel;
0072   Standard_Boolean       myToFix;
0073 
0074  public:
0075   //! Declaration of CASCADE RTTI
0076   DEFINE_STANDARD_RTTIEXT(TObj_CheckModel,Message_Algorithm)
0077 };
0078 
0079 //! Definition of HANDLE object using Standard_DefineHandle.hxx
0080 DEFINE_STANDARD_HANDLE (TObj_CheckModel,Message_Algorithm)
0081 
0082 #endif
0083 
0084 #ifdef _MSC_VER
0085 #pragma once
0086 #endif