0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / StdStorage / StdStorage_TypeData.hxx
CommitLineData
ec964372 1// Copyright (c) 2017 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#ifndef _StdStorage_TypeData_HeaderFile
15#define _StdStorage_TypeData_HeaderFile
16
17#include <Standard.hxx>
18#include <Standard_Type.hxx>
19
20#include <StdStorage_MapOfTypes.hxx>
21#include <Storage_Error.hxx>
22#include <TCollection_AsciiString.hxx>
25e59720 23#include <Standard_Transient.hxx>
ec964372 24#include <Standard_Integer.hxx>
25#include <Standard_Boolean.hxx>
26#include <StdObjMgt_MapOfInstantiators.hxx>
27#include <TColStd_HSequenceOfAsciiString.hxx>
28class Standard_NoSuchObject;
29class Storage_BaseDriver;
30class TCollection_AsciiString;
31
32class StdStorage_TypeData;
25e59720 33DEFINE_STANDARD_HANDLE(StdStorage_TypeData, Standard_Transient)
ec964372 34
35//! Storage type data section keeps association between
36//! persistent textual types and their numbers
37class StdStorage_TypeData
25e59720 38 : public Standard_Transient
ec964372 39{
40 friend class StdStorage_Data;
41
42public:
43
25e59720 44 DEFINE_STANDARD_RTTIEXT(StdStorage_TypeData, Standard_Transient)
ec964372 45
46 //! Reads the type data section from the container defined by theDriver.
47 //! Returns Standard_True in case of success. Otherwise, one need to get
48 //! an error code and description using ErrorStatus and ErrorStatusExtension
49 //! functions correspondingly.
50 Standard_EXPORT Standard_Boolean Read(Storage_BaseDriver& theDriver);
51
52 //! Writes the type data section to the container defined by theDriver.
53 //! Returns Standard_True in case of success. Otherwise, one need to get
54 //! an error code and description using ErrorStatus and ErrorStatusExtension
55 //! functions correspondingly.
56 Standard_EXPORT Standard_Boolean Write(Storage_BaseDriver& theDriver);
57
58 //! Returns the number of registered types
59 Standard_EXPORT Standard_Integer NumberOfTypes() const;
60
61 //! Add a type to the list in case of reading data
62 Standard_EXPORT void AddType (const TCollection_AsciiString& aTypeName, const Standard_Integer aTypeNum);
63
64 //! Add a type of the persistent object in case of writing data
65 Standard_EXPORT Standard_Integer AddType (const Handle(StdObjMgt_Persistent)& aPObj);
66
67 //! Returns the name of the type with number <aTypeNum>
68 Standard_EXPORT TCollection_AsciiString Type (const Standard_Integer aTypeNum) const;
69
70 //! Returns the name of the type with number <aTypeNum>
71 Standard_EXPORT Standard_Integer Type (const TCollection_AsciiString& aTypeName) const;
72
73 //! Returns a persistent object instantiator of <aTypeName>
74 Standard_EXPORT StdObjMgt_Persistent::Instantiator Instantiator(const Standard_Integer aTypeNum) const;
75
76 //! Checks if <aName> is a registered type
77 Standard_EXPORT Standard_Boolean IsType (const TCollection_AsciiString& aName) const;
78
79 //! Returns a sequence of all registered types
80 Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) Types() const;
81
82 //! Returns a status of the latest call to Read / Write functions
83 Standard_EXPORT Storage_Error ErrorStatus() const;
84
85 //! Returns an error message if any of the latest call to Read / Write functions
86 Standard_EXPORT TCollection_AsciiString ErrorStatusExtension() const;
87
88 //! Clears error status
89 Standard_EXPORT void ClearErrorStatus();
90
91 //! Unregisters all types
92 Standard_EXPORT void Clear();
93
94private:
95
96 Standard_EXPORT StdStorage_TypeData();
97
98 Standard_EXPORT void SetErrorStatus (const Storage_Error anError);
99
100 Standard_EXPORT void SetErrorStatusExtension (const TCollection_AsciiString& anErrorExt);
101
102 Standard_Integer myTypeId;
103 StdObjMgt_MapOfInstantiators myMapOfPInst;
104 StdStorage_MapOfTypes myPt;
105 Storage_Error myErrorStatus;
106 TCollection_AsciiString myErrorStatusExt;
107
108};
109
110#endif // _StdStorage_TypeData_HeaderFile