Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 09:05:24

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 prepares
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 occ::handle<TObj_Model>& theModel)
0037       : myModel(theModel),
0038         myToFix(false)
0039   {
0040   }
0041 
0042   //! Sets flag allowing fixing inconsistencies
0043   void SetToFix(const bool theToFix) { myToFix = theToFix; }
0044 
0045   //! Returns true if it is allowed to fix inconsistencies
0046   bool IsToFix() const { return myToFix; }
0047 
0048   //! Returns the checked model
0049   const occ::handle<TObj_Model>& GetModel() const { return myModel; }
0050 
0051   //! Empty virtual destructor
0052   ~TObj_CheckModel() override = default;
0053 
0054   //! Performs all checks. Descendants should call parent method before
0055   //! doing own checks.
0056   //! This implementation checks OCAF references and back references
0057   //! between objects of the model.
0058   //! Returns true if no inconsistencies found.
0059   virtual Standard_EXPORT bool Perform();
0060 
0061 private:
0062   //! Check References (and back references in model).
0063   //! This method just tries to find object to that this reference is indicate and
0064   //! test if that object is not null or not deleted. Also it test if that object has back
0065   //! reference to correct object (object that has forward reference).
0066   Standard_EXPORT bool checkReferences();
0067 
0068 private:
0069   occ::handle<TObj_Model> myModel;
0070   bool                    myToFix;
0071 
0072 public:
0073   //! Declaration of CASCADE RTTI
0074   DEFINE_STANDARD_RTTIEXT(TObj_CheckModel, Message_Algorithm)
0075 };
0076 
0077 //! Definition of HANDLE object using Standard_DefineHandle.hxx
0078 #endif
0079 
0080 #ifdef _MSC_VER
0081 #pragma once
0082 #endif