0024023: Revamp the OCCT Handle -- general
[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
c04c30b3 26class TObj_Model;
7fd59977 27
28//! This class provides interface to the static data
29//! to be used during save or load models.
30//!
31//! Static data:
32//! 1. DataMap of Modeller name - handle to model to be used in loading of references
33//! 2. Indexed map of Standard_Type to be used during save or load of object type
34//! 3. Handle to the current model - model that is loaded at the current moment
35
36class TObj_Assistant
37{
38public:
39 /**
40 * Interface for DataMap of Modeller name
41 */
42
43 //! Finds model by name
44 static Standard_EXPORT Handle(TObj_Model)
45 FindModel (const Standard_CString theName);
46
47 //! Binds model to the map
48 static Standard_EXPORT void
49 BindModel (const Handle(TObj_Model) theModel);
50
51 //! Clears all records from the model map
52 static Standard_EXPORT void
53 ClearModelMap ();
54
55public:
56 /**
57 * Interface for Map of Standard Types
58 */
59
60 //! Finds Standard_Type by index;
61 //! returns NULL handle if not found
62 static Standard_EXPORT Handle(Standard_Type)
63 FindType (const Standard_Integer theTypeIndex);
64
65 //! Rinds index by Standard_Type;
66 //! returns 0 if not found
67 static Standard_EXPORT Standard_Integer
68 FindTypeIndex (const Handle(Standard_Type)& theType);
69
70 //! Binds Standard_Type to the map;
71 //! returns index of bound type
72 static Standard_EXPORT Standard_Integer
73 BindType (const Handle(Standard_Type)& theType);
74
75 //! Clears map of types
76 static Standard_EXPORT void
77 ClearTypeMap ();
78
79public:
80 /**
81 * Interface to the current model
82 */
83
84 //! Sets current model
85 static Standard_EXPORT void
86 SetCurrentModel (const Handle(TObj_Model)& theModel);
87
88 //! Returns current model
89 static Standard_EXPORT Handle(TObj_Model)
90 GetCurrentModel();
91
92 //! Unsets current model
93 static Standard_EXPORT void
94 UnSetCurrentModel ();
95
96public:
97
98 //! Returns the version of application which wrote the currently read document.
99 //! Returns 0 if it has not been set yet for the current document.
100 static Standard_EXPORT Standard_Integer GetAppVersion();
101
102private:
103
104 //! Method for taking fields for map of models
105 static Standard_EXPORT TColStd_SequenceOfTransient& getModels();
106
107 //! Method for taking fields for map types
108 static Standard_EXPORT TColStd_IndexedMapOfTransient& getTypes();
109
110 //! Method for taking fields for the Current model
111 static Standard_EXPORT Handle(TObj_Model)& getCurrentModel();
112
113 //! Returns application version
114 static Standard_EXPORT Standard_Integer& getVersion();
115};
116
117#endif
118
119#ifdef _MSC_VER
120#pragma once
121#endif