0027104: DownCast() cannot return null for mismatched handle
[occt.git] / src / StdObjMgt / StdObjMgt_Persistent.hxx
1 // Copyright (c) 2015 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 _StdObjMgt_Persistent_HeaderFile
15 #define _StdObjMgt_Persistent_HeaderFile
16
17
18 #include <Standard.hxx>
19 #include <Standard_Handle.hxx>
20 #include <Standard_Transient.hxx>
21
22 class StdObjMgt_ReadData;
23 class TDF_Attribute;
24
25
26 //! Root class for a temporary object that reads data from a file and then
27 //! creates transient object using the data.
28 class StdObjMgt_Persistent : public Standard_Transient
29 {
30 public:
31   //! Create a derived class instance.
32   typedef Handle(StdObjMgt_Persistent) (*Instantiator)();
33
34   //! Read persistent data from a file.
35   Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData) = 0;
36
37   //! Import transient attribuite from the persistent data
38   //! (to be overriden by attribute classes;
39   //! returns a null handle by default for non-attribute classes).
40   Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
41 };
42
43 #endif // _StdObjMgt_Persistent_HeaderFile