0029195: OCAF - ensure thread safety for different documents.
[occt.git] / src / CDF / CDF_Store.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-11-13
2// Created by: Jean-Louis Frenkel
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _CDF_Store_HeaderFile
18#define _CDF_Store_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <TCollection_ExtendedString.hxx>
26#include <PCDM_StoreStatus.hxx>
27#include <CDF_TryStoreStatus.hxx>
28#include <Standard_ExtString.hxx>
29#include <CDF_StoreSetNameStatus.hxx>
30#include <CDF_SubComponentStatus.hxx>
d9d03f10 31#include <TCollection_HExtendedString.hxx>
6d8f9f4a 32
33#include <Message_ProgressIndicator.hxx>
34
42cf5bc1 35class CDF_StoreList;
36class CDM_Document;
37class TCollection_ExtendedString;
38
39
40
41class CDF_Store
42{
43public:
44
45 DEFINE_STANDARD_ALLOC
46
47
48 //! creates a store list from the document of the current selection.
49 Standard_EXPORT CDF_Store(const Handle(CDM_Document)& aDocument);
50
42cf5bc1 51 //! returns the folder in which the current document will be stored.
d9d03f10 52 Standard_EXPORT Handle(TCollection_HExtendedString) Folder() const;
42cf5bc1 53
54 //! returns the name under which the current document will be stored
d9d03f10 55 Standard_EXPORT Handle(TCollection_HExtendedString) Name() const;
42cf5bc1 56
57 //! returns true if the current document is already stored
58 Standard_EXPORT Standard_Boolean IsStored() const;
59
60 Standard_EXPORT Standard_Boolean IsModified() const;
61
62 Standard_EXPORT Standard_Boolean CurrentIsConsistent() const;
63
64 Standard_EXPORT Standard_Boolean IsConsistent() const;
65
66 Standard_EXPORT Standard_Boolean HasAPreviousVersion() const;
67
d9d03f10 68 Standard_EXPORT Handle(TCollection_HExtendedString) PreviousVersion() const;
42cf5bc1 69
70 //! returns true if the currentdocument is the main one, ie the document
71 //! of the current selection.
72 Standard_EXPORT Standard_Boolean IsMainDocument() const;
73
74 //! defines the folder in which the document should be
75 //! stored. returns Standard_True if the Folder exists,
76 //! Standard_False otherwise.
77 Standard_EXPORT Standard_Boolean SetFolder (const TCollection_ExtendedString& aFolder);
78
79 //! defines the name under which the document should be stored.
80 Standard_EXPORT CDF_StoreSetNameStatus SetName (const Standard_ExtString aName);
81
82 Standard_EXPORT void SetComment (const Standard_ExtString aComment);
83
d9d03f10 84 Standard_EXPORT Handle(TCollection_HExtendedString) Comment() const;
42cf5bc1 85
86 //! defines the name under which the document should be stored.
87 //! uses for example after modification of the folder.
88 Standard_EXPORT CDF_StoreSetNameStatus RecheckName();
89
90 Standard_EXPORT Standard_Boolean SetPreviousVersion (const Standard_ExtString aPreviousVersion);
91
6d8f9f4a 92 Standard_EXPORT void Realize (const Handle(Message_ProgressIndicator)& theProgress = NULL);
42cf5bc1 93
94 //! returns the complete path of the created meta-data.
95 Standard_EXPORT Standard_ExtString Path() const;
96
97 //! returns the path of the previous store is the object
98 //! is already stored, otherwise an empty string;
d9d03f10 99 Standard_EXPORT Handle(TCollection_HExtendedString) MetaDataPath() const;
42cf5bc1 100
101 //! returns the description of the format of the main object.
d9d03f10 102 Standard_EXPORT Handle(TCollection_HExtendedString) Description() const;
42cf5bc1 103
104 Standard_EXPORT void SetCurrent (const Standard_ExtString aPresentation);
105
106 //! the two following methods can
107 //! be used just after Realize or Import -- method to know if
108 //! thes methods worked correctly, and if not why.
109 Standard_EXPORT void SetMain();
110
111 Standard_EXPORT PCDM_StoreStatus StoreStatus() const;
112
113 Standard_EXPORT Standard_ExtString AssociatedStatusText() const;
114
115 //! defines the name under which the document should be stored.
116 Standard_EXPORT CDF_StoreSetNameStatus SetName (const TCollection_ExtendedString& aName);
117
118 //! defines the folder in which the document should be
119 //! stored. returns Standard_True if the Folder exists,
120 //! Standard_False otherwise.
121 Standard_EXPORT Standard_Boolean SetFolder (const Standard_ExtString aFolder);
122
123
124
125
126protected:
127
128
129
130
131
132private:
133
134
135 Standard_EXPORT CDF_Store();
136
137 Standard_EXPORT void FindDefault();
138
139 Standard_EXPORT void Init();
140
141
142 Handle(CDF_StoreList) myList;
143 Handle(CDM_Document) myMainDocument;
144 Handle(CDM_Document) myCurrentDocument;
145 Standard_Boolean myHasSubComponents;
146 Standard_Boolean myIsMainDocument;
42cf5bc1 147 TCollection_ExtendedString myPath;
148 TCollection_ExtendedString myText;
149 PCDM_StoreStatus myStatus;
150
151
152};
153
154
155
156
157
158
159
160#endif // _CDF_Store_HeaderFile