Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:19:19

0001 // Created on: 2004-11-22
0002 // Created by: Pavel TELKOV
0003 // Copyright (c) 2004-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_Assistant_HeaderFile
0019 #define TObj_Assistant_HeaderFile
0020 
0021 #include <Standard_Transient.hxx>
0022 #include <NCollection_Sequence.hxx>
0023 #include <NCollection_IndexedMap.hxx>
0024 
0025 class TObj_Model;
0026 
0027 //! This class provides interface to the static data
0028 //! to be used during save or load models.
0029 //!
0030 //! Static data:
0031 //! 1. DataMap of Modeller name - handle to model to be used in loading of references
0032 //! 2. Indexed map of Standard_Type to be used during save or load of object type
0033 //! 3. Handle to the current model - model that is loaded at the current moment
0034 
0035 class TObj_Assistant
0036 {
0037 public:
0038   /**
0039    * Interface for DataMap of Modeller name
0040    */
0041 
0042   //! Finds model by name
0043   static Standard_EXPORT occ::handle<TObj_Model> FindModel(const char* const theName);
0044 
0045   //! Binds model to the map
0046   static Standard_EXPORT void BindModel(const occ::handle<TObj_Model>& theModel);
0047 
0048   //! Clears all records from the model map
0049   static Standard_EXPORT void ClearModelMap();
0050 
0051 public:
0052   /**
0053    * Interface for Map of Standard Types
0054    */
0055 
0056   //! Finds Standard_Type by index;
0057   //! returns NULL handle if not found
0058   static Standard_EXPORT occ::handle<Standard_Type> FindType(const int theTypeIndex);
0059 
0060   //! Rinds index by Standard_Type;
0061   //! returns 0 if not found
0062   static Standard_EXPORT int FindTypeIndex(const occ::handle<Standard_Type>& theType);
0063 
0064   //! Binds Standard_Type to the map;
0065   //! returns index of bound type
0066   static Standard_EXPORT int BindType(const occ::handle<Standard_Type>& theType);
0067 
0068   //! Clears map of types
0069   static Standard_EXPORT void ClearTypeMap();
0070 
0071 public:
0072   /**
0073    * Interface to the current model
0074    */
0075 
0076   //! Sets current model
0077   static Standard_EXPORT void SetCurrentModel(const occ::handle<TObj_Model>& theModel);
0078 
0079   //! Returns current model
0080   static Standard_EXPORT occ::handle<TObj_Model> GetCurrentModel();
0081 
0082   //! Unsets current model
0083   static Standard_EXPORT void UnSetCurrentModel();
0084 
0085 public:
0086   //! Returns the version of application which wrote the currently read document.
0087   //! Returns 0 if it has not been set yet for the current document.
0088   static Standard_EXPORT int GetAppVersion();
0089 
0090 private:
0091   //! Method for taking fields for map of models
0092   static Standard_EXPORT NCollection_Sequence<occ::handle<Standard_Transient>>& getModels();
0093 
0094   //! Method for taking fields for map types
0095   static Standard_EXPORT NCollection_IndexedMap<occ::handle<Standard_Transient>>& getTypes();
0096 
0097   //! Method for taking fields for the Current model
0098   static Standard_EXPORT occ::handle<TObj_Model>& getCurrentModel();
0099 
0100   //! Returns application version
0101   static Standard_EXPORT int& getVersion();
0102 };
0103 
0104 #endif
0105 
0106 #ifdef _MSC_VER
0107 #pragma once
0108 #endif