0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / StdStorage / StdStorage.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_HeaderFile
15#define _StdStorage_HeaderFile
16
17#include <Standard_Macro.hxx>
18#include <Storage_Error.hxx>
19class StdStorage_Data;
20class Storage_BaseDriver;
21class TCollection_AsciiString;
22
23//! StdStorage package is used to write and read persistent objects.
24//! These objects are read and written by a retrieval or storage
25//! algorithm (compatible with legacy Storage_Schema) in a container
26//! (disk, memory, network ...). Drivers (FSD_File objects) assign a physical
27//! container for data to be stored or retrieved.
28//! The standard procedure for an application in reading a container is
29//! to call one of the Read functions providing either a file path or a driver
30//! opened for reading. Thes function update the instance of the StdStorage_Data
31//! class which contains the data being read.
32//! The standard procedure for an application in writing a container is the following:
33//! - open the driver in writing mode,
34//! - create an instance of the StdStorage_Data class, then
35//! add the persistent data to write with the function AddRoot,
36//! - call the function Write from the storage, setting the driver and the
37//! Storage_Data instance as parameters,
38//! - close the driver.
39class StdStorage
40{
41
42public:
43
44 //! Returns the version of Storage's read/write routines
45 Standard_EXPORT static TCollection_AsciiString Version();
46
47 //! Returns the data read from a file located at theFileName.
48 //! The storage format is compartible with legacy persistent one.
49 //! These data are aggregated in a StdStorage_Data object which may be
50 //! browsed in order to extract the root objects from the container.
51 //! Note: - theData object will be created if it is null or cleared otherwise.
52 Standard_EXPORT static Storage_Error Read(const TCollection_AsciiString& theFileName,
53 Handle(StdStorage_Data)& theData);
54
55 //! Returns the data read from the container defined by theDriver.
56 //! The storage format is compartible with legacy persistent one.
57 //! These data are aggregated in a StdStorage_Data object which may be
58 //! browsed in order to extract the root objects from the container.
59 //! Note: - theData object will be created if it is null or cleared otherwise.
39c8dc70 60 Standard_EXPORT static Storage_Error Read(const Handle(Storage_BaseDriver)& theDriver,
ec964372 61 Handle(StdStorage_Data)& theData);
62
63 //! Writes the data aggregated in theData object into the container defined by
64 //! theDriver. The storage format is compartible with legacy persistent one.
65 //! Note: - theData may aggregate several root objects to be stored together.
66 //! - createion date specified in the srorage header will be overwritten.
39c8dc70 67 Standard_EXPORT static Storage_Error Write(const Handle(Storage_BaseDriver)& theDriver,
ec964372 68 const Handle(StdStorage_Data)& theData);
69
70};
71
72#endif // _StdStorage_HeaderFile