b311480e |
1 | // Copyright (c) 1998-1999 Matra Datavision |
2 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
3 | // |
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. |
8 | // |
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. |
11 | // |
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. |
18 | |
7fd59977 |
19 | #ifndef _Storage_Macros_HeaderFile |
20 | #define _Storage_Macros_HeaderFile 1 |
21 | #include <Storage_SolveMode.hxx> |
22 | |
23 | // PROTOTYPES |
7fd59977 |
24 | #define Storage_DECLARE_SCHEMA_METHODS(schema) public: \ |
b311480e |
25 | Standard_EXPORT Handle(Storage_CallBack) CallBackSelection(const TCollection_AsciiString&) const; \ |
7fd59977 |
26 | Standard_EXPORT Handle(Storage_CallBack) AddTypeSelection(const Handle(Standard_Persistent)&) const; \ |
27 | Standard_EXPORT const TColStd_SequenceOfAsciiString& SchemaKnownTypes() const; |
28 | |
29 | // Read_TypeSelection |
30 | // |
31 | #define Storage_BEGIN_READ_SELECTION(schema) \ |
7fd59977 |
32 | Handle(Storage_CallBack) schema::CallBackSelection(const TCollection_AsciiString& rt) const \ |
33 | { \ |
34 | Handle(Standard_Persistent) p; \ |
35 | Handle(Storage_CallBack) cback; |
36 | |
37 | #define Storage_READ_SELECTION(schema,classe,callback) if (strcmp(rt.ToCString(),#classe) == 0) { \ |
38 | cback = new callback ; \ |
39 | return cback; \ |
40 | } |
41 | |
42 | #define Storage_END_READ_SELECTION(schema) cback = ResolveUnknownType(rt,p,Storage_WriteSolve); \ |
43 | return cback; \ |
44 | } |
45 | |
46 | // SchemaKnownTypes |
47 | // |
48 | #define Storage_BEGIN_SCHEMA_TYPES(schema) const TColStd_SequenceOfAsciiString& schema::SchemaKnownTypes() const \ |
49 | { \ |
50 | static TColStd_SequenceOfAsciiString aSeq; \ |
51 | static Standard_Boolean jsuidjaalai = Standard_False; \ |
52 | if (!jsuidjaalai) { \ |
53 | jsuidjaalai = Standard_True; |
54 | |
55 | #define Storage_SCHEMA_TYPES(classe) aSeq.Append(#classe); |
56 | #define Storage_END_SCHEMA_TYPES(schema) } return aSeq; \ |
57 | } |
58 | |
59 | // ADD_TypeSelection |
60 | // |
61 | |
62 | #define Storage_BEGIN_ADD_TYPES(schema) Handle(Storage_CallBack) schema::AddTypeSelection(const Handle(Standard_Persistent)& p) const \ |
63 | { \ |
64 | Handle(Storage_CallBack) cback; \ |
65 | if (!p.IsNull()) { \ |
66 | const Handle(Standard_Type)& t = p->DynamicType(); \ |
67 | static TCollection_AsciiString theTypeName;\ |
68 | theTypeName = t->Name(); \ |
69 | if (HasTypeBinding(theTypeName)) { \ |
70 | cback = TypeBinding(theTypeName); \ |
71 | cback->Add(p,this); \ |
72 | return cback; \ |
73 | } |
74 | |
75 | #define Storage_ADD_TYPES(schema,classe,callback) if (t == classe##_Type_()) { \ |
76 | cback = new callback ; \ |
77 | BindType(theTypeName,cback); \ |
78 | cback->Add(p,this); \ |
79 | return cback; \ |
80 | } |
81 | |
82 | #define Storage_END_ADD_TYPES(schema) cback = ResolveUnknownType(theTypeName,p,Storage_AddSolve); \ |
83 | if (!cback.IsNull()) { \ |
84 | cback->Add(p,this); \ |
85 | } \ |
86 | return cback; \ |
87 | } \ |
88 | return cback; \ |
89 | } |
90 | #endif |