Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:17:10

0001 // Copyright (c) 1998-1999 Matra Datavision
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _Storage_Macros_HeaderFile
0016 #define _Storage_Macros_HeaderFile 1
0017 #include <Storage_SolveMode.hxx>
0018 
0019 // PROTOTYPES
0020 #define Storage_DECLARE_SCHEMA_METHODS(schema)                                                     \
0021 public:                                                                                            \
0022   Standard_EXPORT Handle(Storage_CallBack) CallBackSelection(const TCollection_AsciiString&)       \
0023     const;                                                                                         \
0024   Standard_EXPORT Handle(Storage_CallBack) AddTypeSelection(const Handle(Standard_Persistent)&)    \
0025     const;                                                                                         \
0026   Standard_EXPORT const TColStd_SequenceOfAsciiString& SchemaKnownTypes() const;
0027 
0028 // Read_TypeSelection
0029 //
0030 #define Storage_BEGIN_READ_SELECTION(schema)                                                       \
0031   Handle(Storage_CallBack) schema::CallBackSelection(const TCollection_AsciiString& rt) const      \
0032   {                                                                                                \
0033     Handle(Standard_Persistent) p;                                                                 \
0034     Handle(Storage_CallBack)    cback;
0035 
0036 #define Storage_READ_SELECTION(schema, classe, callback)                                           \
0037   if (strcmp(rt.ToCString(), #classe) == 0)                                                        \
0038   {                                                                                                \
0039     cback = new callback;                                                                          \
0040     return cback;                                                                                  \
0041   }
0042 
0043 #define Storage_END_READ_SELECTION(schema)                                                         \
0044   cback = ResolveUnknownType(rt, p, Storage_WriteSolve);                                           \
0045   return cback;                                                                                    \
0046   }
0047 
0048 // SchemaKnownTypes
0049 //
0050 #define Storage_BEGIN_SCHEMA_TYPES(schema)                                                         \
0051   const TColStd_SequenceOfAsciiString& schema::SchemaKnownTypes() const                            \
0052   {                                                                                                \
0053     static TColStd_SequenceOfAsciiString aSeq;                                                     \
0054     static Standard_Boolean              jsuidjaalai = Standard_False;                             \
0055     if (!jsuidjaalai)                                                                              \
0056     {                                                                                              \
0057       jsuidjaalai = Standard_True;
0058 
0059 #define Storage_SCHEMA_TYPES(classe) aSeq.Append(#classe);
0060 #define Storage_END_SCHEMA_TYPES(schema)                                                           \
0061   }                                                                                                \
0062   return aSeq;                                                                                     \
0063   }
0064 
0065 // ADD_TypeSelection
0066 //
0067 
0068 #define Storage_BEGIN_ADD_TYPES(schema)                                                            \
0069   Handle(Storage_CallBack) schema::AddTypeSelection(const Handle(Standard_Persistent)& p) const    \
0070   {                                                                                                \
0071     Handle(Storage_CallBack) cback;                                                                \
0072     if (!p.IsNull())                                                                               \
0073     {                                                                                              \
0074       const Handle(Standard_Type)&   t = p->DynamicType();                                         \
0075       static TCollection_AsciiString theTypeName;                                                  \
0076       theTypeName = t->Name();                                                                     \
0077       if (HasTypeBinding(theTypeName))                                                             \
0078       {                                                                                            \
0079         cback = TypeBinding(theTypeName);                                                          \
0080         cback->Add(p, this);                                                                       \
0081         return cback;                                                                              \
0082       }
0083 
0084 #define Storage_ADD_TYPES(schema, classe, callback)                                                \
0085   if (t == STANDARD_TYPE(classe))                                                                  \
0086   {                                                                                                \
0087     cback = new callback;                                                                          \
0088     BindType(theTypeName, cback);                                                                  \
0089     cback->Add(p, this);                                                                           \
0090     return cback;                                                                                  \
0091   }
0092 
0093 #define Storage_END_ADD_TYPES(schema)                                                              \
0094   cback = ResolveUnknownType(theTypeName, p, Storage_AddSolve);                                    \
0095   if (!cback.IsNull())                                                                             \
0096   {                                                                                                \
0097     cback->Add(p, this);                                                                           \
0098   }                                                                                                \
0099   return cback;                                                                                    \
0100   }                                                                                                \
0101   return cback;                                                                                    \
0102   }
0103 #endif