0024023: Revamp the OCCT Handle -- automatic
[occt.git] / src / TObj / TObj_Assistant.hxx
CommitLineData
b311480e 1// Created on: 2004-11-22
2// Created by: Pavel TELKOV
973c2be1 3// Copyright (c) 2004-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16// The original implementation Copyright: (C) RINA S.p.A
17
18#ifndef TObj_Assistant_HeaderFile
19#define TObj_Assistant_HeaderFile
20
21#include <TObj_Common.hxx>
b7c077b9 22#include <TColStd_SequenceOfTransient.hxx>
23#include <TColStd_SequenceOfAsciiString.hxx>
24#include <TColStd_IndexedMapOfTransient.hxx>
7fd59977 25
7fd59977 26
27//! This class provides interface to the static data
28//! to be used during save or load models.
29//!
30//! Static data:
31//! 1. DataMap of Modeller name - handle to model to be used in loading of references
32//! 2. Indexed map of Standard_Type to be used during save or load of object type
33//! 3. Handle to the current model - model that is loaded at the current moment
34
35class TObj_Assistant
36{
37public:
38 /**
39 * Interface for DataMap of Modeller name
40 */
41
42 //! Finds model by name
43 static Standard_EXPORT Handle(TObj_Model)
44 FindModel (const Standard_CString theName);
45
46 //! Binds model to the map
47 static Standard_EXPORT void
48 BindModel (const Handle(TObj_Model) theModel);
49
50 //! Clears all records from the model map
51 static Standard_EXPORT void
52 ClearModelMap ();
53
54public:
55 /**
56 * Interface for Map of Standard Types
57 */
58
59 //! Finds Standard_Type by index;
60 //! returns NULL handle if not found
61 static Standard_EXPORT Handle(Standard_Type)
62 FindType (const Standard_Integer theTypeIndex);
63
64 //! Rinds index by Standard_Type;
65 //! returns 0 if not found
66 static Standard_EXPORT Standard_Integer
67 FindTypeIndex (const Handle(Standard_Type)& theType);
68
69 //! Binds Standard_Type to the map;
70 //! returns index of bound type
71 static Standard_EXPORT Standard_Integer
72 BindType (const Handle(Standard_Type)& theType);
73
74 //! Clears map of types
75 static Standard_EXPORT void
76 ClearTypeMap ();
77
78public:
79 /**
80 * Interface to the current model
81 */
82
83 //! Sets current model
84 static Standard_EXPORT void
85 SetCurrentModel (const Handle(TObj_Model)& theModel);
86
87 //! Returns current model
88 static Standard_EXPORT Handle(TObj_Model)
89 GetCurrentModel();
90
91 //! Unsets current model
92 static Standard_EXPORT void
93 UnSetCurrentModel ();
94
95public:
96
97 //! Returns the version of application which wrote the currently read document.
98 //! Returns 0 if it has not been set yet for the current document.
99 static Standard_EXPORT Standard_Integer GetAppVersion();
100
101private:
102
103 //! Method for taking fields for map of models
104 static Standard_EXPORT TColStd_SequenceOfTransient& getModels();
105
106 //! Method for taking fields for map types
107 static Standard_EXPORT TColStd_IndexedMapOfTransient& getTypes();
108
109 //! Method for taking fields for the Current model
110 static Standard_EXPORT Handle(TObj_Model)& getCurrentModel();
111
112 //! Returns application version
113 static Standard_EXPORT Standard_Integer& getVersion();
114};
115
116#endif
117
118#ifdef _MSC_VER
119#pragma once
120#endif