1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
19 #ifndef _Storage_Macros_HeaderFile
20 #define _Storage_Macros_HeaderFile 1
21 #include <Storage_SolveMode.hxx>
24 #define Storage_DECLARE_SCHEMA_METHODS(schema) public: \
25 Standard_EXPORT Handle(Storage_CallBack) CallBackSelection(const TCollection_AsciiString&) const; \
26 Standard_EXPORT Handle(Storage_CallBack) AddTypeSelection(const Handle(Standard_Persistent)&) const; \
27 Standard_EXPORT const TColStd_SequenceOfAsciiString& SchemaKnownTypes() const;
31 #define Storage_BEGIN_READ_SELECTION(schema) \
33 Standard_EXPORT Handle(Storage_Schema) Create##schema() { return new schema; } \
35 Handle(Storage_CallBack) schema::CallBackSelection(const TCollection_AsciiString& rt) const \
37 Handle(Standard_Persistent) p; \
38 Handle(Storage_CallBack) cback;
40 #define Storage_READ_SELECTION(schema,classe,callback) if (strcmp(rt.ToCString(),#classe) == 0) { \
41 cback = new callback ; \
45 #define Storage_END_READ_SELECTION(schema) cback = ResolveUnknownType(rt,p,Storage_WriteSolve); \
51 #define Storage_BEGIN_SCHEMA_TYPES(schema) const TColStd_SequenceOfAsciiString& schema::SchemaKnownTypes() const \
53 static TColStd_SequenceOfAsciiString aSeq; \
54 static Standard_Boolean jsuidjaalai = Standard_False; \
56 jsuidjaalai = Standard_True;
58 #define Storage_SCHEMA_TYPES(classe) aSeq.Append(#classe);
59 #define Storage_END_SCHEMA_TYPES(schema) } return aSeq; \
65 #define Storage_BEGIN_ADD_TYPES(schema) Handle(Storage_CallBack) schema::AddTypeSelection(const Handle(Standard_Persistent)& p) const \
67 Handle(Storage_CallBack) cback; \
69 const Handle(Standard_Type)& t = p->DynamicType(); \
70 static TCollection_AsciiString theTypeName;\
71 theTypeName = t->Name(); \
72 if (HasTypeBinding(theTypeName)) { \
73 cback = TypeBinding(theTypeName); \
78 #define Storage_ADD_TYPES(schema,classe,callback) if (t == classe##_Type_()) { \
79 cback = new callback ; \
80 BindType(theTypeName,cback); \
85 #define Storage_END_ADD_TYPES(schema) cback = ResolveUnknownType(theTypeName,p,Storage_AddSolve); \
86 if (!cback.IsNull()) { \