]> OCCT Git - occt-wok.git/commitdiff
Initial revision
authorcas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
committercas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
src/CSFDBSchema/CSFDBSchema.cxx [new file with mode: 0755]
src/CSFDBSchema/CSFDBSchema_Template.edl [new file with mode: 0755]
src/CSFDBSchema/FILES [new file with mode: 0755]

diff --git a/src/CSFDBSchema/CSFDBSchema.cxx b/src/CSFDBSchema/CSFDBSchema.cxx
new file mode 100755 (executable)
index 0000000..3dd1c18
--- /dev/null
@@ -0,0 +1,1085 @@
+// CLE : extracteur de schema pour la CSFDB (1996 : v1)
+//
+
+#include <stdio.h>
+
+#include <EDL_API.hxx>
+#include <WOKTools_Messages.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <MS_MetaSchema.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <WOKTools_MapOfHAsciiString.hxx>
+#include <WOKTools_MapIteratorOfMapOfHAsciiString.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_Package.hxx>
+#include <MS.hxx>
+#include <MS_Schema.hxx>
+#include <MS_Error.hxx>
+#include <MS_Field.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_Field.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Enum.hxx>
+#include <MS_Alias.hxx>
+#include <MS_PrimType.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+extern "C" {
+
+  Handle(TColStd_HSequenceOfHAsciiString) Standard_EXPORT CSFDBSchema_TemplatesUsed();
+  
+  void Standard_EXPORT CSFDBSchema_Extract(const Handle(MS_MetaSchema)& ams,
+                          const Handle(TCollection_HAsciiString)& aname,
+                          const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+                          const Handle(TCollection_HAsciiString)& outdir,
+                          const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+                          const Standard_CString);
+  
+}
+
+WOKTools_MapOfHAsciiString AddMap,RemoveMap;
+
+// Standard Extractor API : list the EDL files used by this program
+//
+Handle(TColStd_HSequenceOfHAsciiString) CSFDBSchema_TemplatesUsed()
+{
+  Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+  
+  result->Append(new TCollection_HAsciiString("CSFDBSchema_Template.edl"));
+
+  return result;
+}
+
+// write the content of a variable into a file
+//
+void CSFDBSchema_WriteFile(const Handle(EDL_API)& api,
+                          const Handle(TCollection_HAsciiString)& aFileName,
+                          const Standard_CString var)
+{
+  // ...now we write the result
+  //
+  api->OpenFile("HTFile",aFileName->ToCString());
+  api->WriteFile("HTFile",var);
+  api->CloseFile("HTFile");
+}
+
+Handle(EDL_API)&  CSFDBSchema_LoadTemplate(const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+                                          const Handle(TCollection_HAsciiString)& outdir,
+                                          const Standard_CString DBMS)
+{
+  static Handle(EDL_API)  api = new EDL_API;
+  static Standard_Boolean alreadyLoaded = Standard_False;
+
+  api->ClearVariables();
+
+  if (!alreadyLoaded) {
+    alreadyLoaded = Standard_True;
+
+    for(Standard_Integer i = 1; i <= edlsfullpath->Length(); i++) {
+      api->AddIncludeDirectory(edlsfullpath->Value(i)->ToCString());
+    }
+
+    if (api->Execute("CSFDBSchema_Template.edl") != EDL_NORMAL) {
+      ErrorMsg << "CSFDBSchema" << "unable to load : CSBDBSchema_Template.edl" << endm;
+      Standard_NoSuchObject::Raise();
+    } 
+  }
+  
+  // full path of the destination directory
+  //
+  api->AddVariable("%FullPath",outdir->ToCString());
+
+  // DBMS extraction type
+  //
+  api->AddVariable("%CPPEXTDBMS",DBMS);
+
+  return api;
+}
+
+// Build the schema's header file (<schema>.hxx)
+//
+void CSFDBSchema_BuildHeader(const Handle(MS_MetaSchema)& aMeta,
+                            const Handle(EDL_API)& api,
+                            const Handle(TColStd_HSequenceOfHAsciiString)& classList,
+                            const Handle(TCollection_HAsciiString)& schName,
+                            const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+  Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+  Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString(api->GetVariableValue("%FullPath"));
+  Handle(TCollection_HAsciiString) proto  = new TCollection_HAsciiString;
+  Standard_Integer                 i;
+  Handle(MS_StdClass)              c;
+
+  
+  aFileName->AssignCat(schName);
+  aFileName->AssignCat(".hxx");
+
+  api->OpenFile("HTFile",aFileName->ToCString());
+
+  // common includes for schemas
+  //
+  api->AddVariable("%Type","Storage_Schema");
+  api->Apply("%SHeaderInc","CSFDBInclude");
+  api->WriteFile("HTFile","%SHeaderInc");
+  api->AddVariable("%Type","Storage_BaseDriver");
+  api->Apply("%SHeaderInc","CSFDBInclude");
+  api->WriteFile("HTFile","%SHeaderInc");
+  api->AddVariable("%Type","Storage_CallBack");
+  api->Apply("%SHeaderInc","CSFDBInclude");
+  api->WriteFile("HTFile","%SHeaderInc");
+  api->AddVariable("%Type","Storage_Macros");
+  api->Apply("%SHeaderInc","CSFDBInclude");
+  api->WriteFile("HTFile","%SHeaderInc");
+
+  Handle(MS_Type)                  tmpType;
+
+  for (i = 1; i<= classList->Length(); i++) {
+    tmpType = aMeta->GetType(classList->Value(i));
+    c = *((Handle(MS_StdClass)*)&tmpType);
+
+    if (c->IsPersistent()) {
+      api->AddVariable("%Type",classList->Value(i)->ToCString());
+      api->Apply("%SHeaderInc","CSFDBHandleDeclaration");
+      api->WriteFile("HTFile","%SHeaderInc");
+    } 
+    else { 
+      api->AddVariable("%Type",classList->Value(i)->ToCString());
+      api->Apply("%SHeaderInc","CSFDBClassDeclaration");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+  }
+
+  api->Apply("%SHeaderInc","CSFDBSchemaClassProto");
+  api->WriteFile("HTFile","%SHeaderInc");
+  api->CloseFile("HTFile");
+
+  outfile->Append(aFileName);
+}
+
+
+void CSFDBSchema_BuildAddTypeSelection(const Handle(MS_MetaSchema)& aMeta,
+                                      const Handle(EDL_API)& api,
+                                      const Handle(TColStd_HSequenceOfHAsciiString)& classList)
+{
+  Standard_Integer                 i;
+  Handle(MS_StdClass)              c;
+
+  api->Apply("%SHeaderInc","CSFDBADDTSBegin");
+  api->WriteFile("HTFile","%SHeaderInc");
+
+  for (i = 1; i<= classList->Length(); i++) {
+    c = Handle(MS_StdClass)::DownCast(aMeta->GetType(classList->Value(i)));
+
+    if (c->IsPersistent()) {
+      api->AddVariable("%Type",classList->Value(i)->ToCString());
+      api->Apply("%SHeaderInc","CSFDBADDTSPart");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+  }
+
+  api->Apply("%SHeaderInc","CSFDBADDTSEnd");
+  api->WriteFile("HTFile","%SHeaderInc");
+}
+
+void CSFDBSchema_BuildSchemaTypeList(const Handle(MS_MetaSchema)& aMeta,
+                                    const Handle(EDL_API)& api,
+                                    const Handle(TColStd_HSequenceOfHAsciiString)& classList)
+{
+  Standard_Integer                 i;
+  Handle(MS_StdClass)              c;
+
+  api->Apply("%SHeaderInc","CSFDBTypeListBegin");
+  api->WriteFile("HTFile","%SHeaderInc");
+
+  for (i = 1; i<= classList->Length(); i++) {
+    c = Handle(MS_StdClass)::DownCast(aMeta->GetType(classList->Value(i)));
+
+    if (c->IsPersistent()) {
+      api->AddVariable("%Type",classList->Value(i)->ToCString());
+      api->Apply("%SHeaderInc","CSFDBTypeListPart");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+  }
+
+  api->Apply("%SHeaderInc","CSFDBTypeListEnd");
+  api->WriteFile("HTFile","%SHeaderInc");
+}
+
+void CSFDBSchema_BuildReadTypeSelection(const Handle(MS_MetaSchema)& aMeta,
+                                       const Handle(EDL_API)& api,
+                                       const Handle(TColStd_HSequenceOfHAsciiString)& classList)
+{
+  Standard_Integer                 i;
+  Handle(MS_StdClass)              c;
+
+  api->Apply("%SHeaderInc","CSFDBREADTSBegin");
+  api->WriteFile("HTFile","%SHeaderInc");
+
+  for (i = 1; i<= classList->Length(); i++) {
+    c = Handle(MS_StdClass)::DownCast(aMeta->GetType(classList->Value(i)));
+
+    if (c->IsPersistent() && !c->Deferred()) {
+      api->AddVariable("%Type",classList->Value(i)->ToCString());
+      api->Apply("%SHeaderInc","CSFDBREADTSPart");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+  }
+
+  api->Apply("%SHeaderInc","CSFDBREADTSEnd");
+  api->WriteFile("HTFile","%SHeaderInc");
+}
+
+Handle(TCollection_HAsciiString) CSFDBSchema_IsVArray(const Handle(MS_MetaSchema)& aMeta,
+                                                     const Handle(MS_StdClass)& aClass)
+{
+  Handle(TCollection_HAsciiString) result;
+
+  if (!aClass->GetMyCreator().IsNull()) {
+    Handle(MS_InstClass)             anInst = aClass->GetMyCreator();
+    Handle(TCollection_HAsciiString) aGen   = anInst->GenClass();
+    
+    if (aGen->IsSameString(MS::GetVArrayRootName())) {
+      result = anInst->InstTypes()->Value(1);
+    }
+  }
+
+  return result;
+}
+
+Handle(TCollection_HAsciiString) CSFDBSchema_BuildConvertFunction(const Handle(MS_MetaSchema)& aMeta,
+                                                                 const Handle(EDL_API)& api,
+                                                                 const Handle(MS_Type)& aType,
+                                                                 const Standard_Boolean forDBC)
+{
+  Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+
+  if (aType->IsKind(STANDARD_TYPE(MS_Enum))) {
+    if (forDBC) api->Apply("%Result","CSFDBDBCRenum");
+    else api->Apply("%Result","CSFDBREADenum");
+    result = api->GetVariableValue("%Result");
+  }
+  else if (aType->IsKind(STANDARD_TYPE(MS_PrimType))) {
+    Handle(TCollection_HAsciiString) tname = aType->FullName();
+
+    if (strcmp(tname->ToCString(),"Standard_Real") == 0) {
+      if (forDBC) api->Apply("%Result","CSFDBDBCRfloat");
+      else api->Apply("%Result","CSFDBREADfloat");
+      result = api->GetVariableValue("%Result");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Character") == 0) {
+      if (forDBC) api->Apply("%Result","CSFDBDBCRchar");
+      else api->Apply("%Result","CSFDBREADchar");
+      result = api->GetVariableValue("%Result");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Integer") == 0) {
+      if (forDBC) api->Apply("%Result","CSFDBDBCRint");
+      else api->Apply("%Result","CSFDBREADint");
+      result = api->GetVariableValue("%Result");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Byte") == 0) {
+      if (forDBC) api->Apply("%Result","CSFDBDBCRchar");
+      else api->Apply("%Result","CSFDBREADchar");
+      result = api->GetVariableValue("%Result");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_ShortReal") == 0) {
+      if (forDBC) api->Apply("%Result","CSFDBDBCRshortreal");
+      else api->Apply("%Result","CSFDBREADshortreal");
+      result = api->GetVariableValue("%Result");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Boolean") == 0) {
+      if (forDBC) api->Apply("%Result","CSFDBDBCRboolean");
+      else api->Apply("%Result","CSFDBREADboolean");
+      result = api->GetVariableValue("%Result");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_ExtCharacter") == 0) {
+      if (forDBC) api->Apply("%Result","CSFDBDBCRextchar");
+      else api->Apply("%Result","CSFDBREADextchar");
+      result = api->GetVariableValue("%Result");
+    }
+    else {
+      ErrorMsg << "CSFDBSchema" << "unknown primitive type :" << tname->ToCString() << endm;
+      Standard_NoSuchObject::Raise();
+    }
+  }
+
+  return result;
+}
+
+Handle(TCollection_HAsciiString) CSFDBSchema_BuildDriverFunction(const Handle(MS_MetaSchema)& aMeta,
+                                                                const Handle(EDL_API)& api,
+                                                                const Handle(MS_Type)& aType,
+                                                                const Standard_Boolean forDBC)
+{
+  Handle(TCollection_HAsciiString) result;
+
+  if (aType->IsKind(STANDARD_TYPE(MS_Enum))) {
+    result = new TCollection_HAsciiString("PutInteger");
+  }
+  else if (aType->IsKind(STANDARD_TYPE(MS_PrimType))) {
+    Handle(TCollection_HAsciiString) tname = aType->FullName();
+
+    if (strcmp(tname->ToCString(),"Standard_Real") == 0) {
+      result = new TCollection_HAsciiString("PutReal");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Character") == 0) {
+      result = new TCollection_HAsciiString("PutCharacter");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Integer") == 0) {
+      result = new TCollection_HAsciiString("PutInteger");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Byte") == 0) {
+      result = new TCollection_HAsciiString("PutCharacter");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_ShortReal") == 0) {
+      result = new TCollection_HAsciiString("PutShortReal");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_Boolean") == 0) {
+      result = new TCollection_HAsciiString("PutBoolean");
+    }
+    else if (strcmp(tname->ToCString(),"Standard_ExtCharacter") == 0) {
+      result = new TCollection_HAsciiString("PutExtCharacter");
+    }
+    else {
+      ErrorMsg << "CSFDBSchema" << "unknown primitive type :" << tname->ToCString() << endm;
+      Standard_NoSuchObject::Raise();
+    }
+  }
+
+  return result;
+}
+
+void CSFDBSchema_BuildDBCMethod(const Handle(MS_MetaSchema)& aMeta,
+                               const Handle(EDL_API)& api,
+                               const Handle(MS_Type)& ftype,
+                               const Handle(TCollection_HAsciiString)& madd,
+                               const Handle(TCollection_HAsciiString)& mwrite,
+                               const Handle(TCollection_HAsciiString)& mread,
+                               const Handle(TCollection_HAsciiString)& aClass)
+{
+  Standard_Boolean buildAbbmet = Standard_False;
+
+  if (ftype->IsKind(STANDARD_TYPE(MS_Class))) {
+      Handle(MS_StdClass) fclass = *((Handle(MS_StdClass)*)&ftype);
+    
+    if (fclass->IsPersistent()) {
+      buildAbbmet = Standard_True;
+      api->Apply("%Result","CSFDBPADDDBC");
+      madd->AssignCat(api->GetVariableValue("%Result"));
+      api->Apply("%Result","CSFDBDBCWpersistent");
+      mwrite->AssignCat(api->GetVariableValue("%Result"));
+      api->Apply("%Result","CSFDBDBCPparameter");
+      mread->AssignCat(api->GetVariableValue("%Result"));
+    }
+    else {
+      if (AddMap.Contains(ftype->FullName())) {
+       api->Apply("%Result","CSFDBSADDDBC");
+       madd->AssignCat(api->GetVariableValue("%Result"));
+       buildAbbmet = Standard_True;
+      }
+      api->Apply("%Result","CSFDBDBCWstorable");
+      mwrite->AssignCat(api->GetVariableValue("%Result"));
+      api->Apply("%Result","CSFDBDBCSparameter");
+      mread->AssignCat(api->GetVariableValue("%Result"));
+    }
+  }
+  else {
+    api->AddVariable("%DriverFunction",CSFDBSchema_BuildDriverFunction(aMeta,api,ftype,Standard_True)->ToCString());
+    api->Apply("%Result","CSFDBDBCWprim");
+    mwrite->AssignCat(api->GetVariableValue("%Result"));
+    api->AddVariable("%Result",CSFDBSchema_BuildConvertFunction(aMeta,api,ftype,Standard_True)->ToCString());
+    mread->AssignCat(api->GetVariableValue("%Result"));
+  }
+
+  api->AddVariable("%Type",aClass->ToCString());
+
+  if (buildAbbmet) {
+    api->AddVariable("%Body",madd->ToCString());
+    api->Apply("%ADDmet","CSFDBSADD");
+  }
+  else {
+    api->AddVariable("%ADDmet","");
+  }
+
+  api->AddVariable("%Body",mwrite->ToCString());
+  api->Apply("%WRITEmet","CSFDBWRITEDBC");
+  
+  api->AddVariable("%Body",mread->ToCString());
+  api->Apply("%READmet","CSFDBREADDBC");
+}
+
+void CSFDBSchema_BuildFieldMethod(const Handle(MS_MetaSchema)& aMeta,
+                                 const Handle(EDL_API)& api,
+                                 const Handle(MS_Type)& ftype,
+                                 const Handle(TColStd_HSequenceOfInteger)& dimension,
+                                 const Handle(TCollection_HAsciiString)& madd,
+                                 const Handle(TCollection_HAsciiString)& mwrite,
+                                 const Handle(TCollection_HAsciiString)& mread)
+{
+  if (dimension->Length() > 0) {
+    Standard_Integer                 i;
+    Handle(TCollection_HAsciiString) sdim = new TCollection_HAsciiString;
+    Handle(TCollection_HAsciiString) stmp = new TCollection_HAsciiString;
+    Handle(TCollection_HAsciiString) svar = new TCollection_HAsciiString;
+    Handle(TCollection_HAsciiString) sforr = new TCollection_HAsciiString;
+    Handle(TCollection_HAsciiString) sforw = new TCollection_HAsciiString;
+    char                             num[30],len[30];
+
+    for(i = 1; i <= dimension->Length(); i++) {      
+      sprintf(num,"%d",i);
+      sprintf(len,"%d",dimension->Value(i));
+      api->AddVariable("%Length",len);
+      stmp->Clear();
+      stmp->AssignCat(api->GetVariableValue("%NameField"));
+      stmp->AssignCat(api->GetVariableValue("%Field"));
+      stmp->AssignCat(num);
+
+      if (i != 1) {
+       svar->AssignCat(",");
+       sdim->AssignCat(",");
+      }
+      svar->AssignCat(stmp);
+      svar->AssignCat(" = 0");
+
+      api->AddVariable("%Var",stmp->ToCString());
+      api->Apply("%ForResult","CSFDBforWrite");
+      sforw->AssignCat(api->GetVariableValue("%ForResult"));
+      api->Apply("%ForResult","CSFDBforRead");
+      sforr->AssignCat(api->GetVariableValue("%ForResult"));
+
+      sdim->AssignCat(stmp);
+    }
+    
+    api->AddVariable("%VDim",sdim->ToCString());
+    api->AddVariable("%ForW",sforw->ToCString());
+    api->AddVariable("%ForR",sforr->ToCString());
+    api->AddVariable("%LocalVar",svar->ToCString());
+  }
+
+  if (ftype->IsKind(STANDARD_TYPE(MS_Class))) {
+    Handle(MS_StdClass) fclass = *((Handle(MS_StdClass)*)&ftype);
+    
+    if (fclass->IsPersistent()) {
+      if (dimension->Length() > 0) {
+       api->Apply("%Body","CSFDBCallAddTypeSelectionArray");   
+       api->Apply("%Result","CSFDBREADARRAYcpp");
+       madd->AssignCat(api->GetVariableValue("%Result"));
+       api->Apply("%Body","CSFDBCallWritePersistentArray");
+       api->Apply("%Result","CSFDBWRITEARRAYcpp");
+       mwrite->AssignCat(api->GetVariableValue("%Result"));
+       api->Apply("%Body","CSFDBReadPersistentArray");
+       api->Apply("%Result","CSFDBREADARRAYcpp");
+       mread->AssignCat(api->GetVariableValue("%Result"));
+      }
+      else {
+       api->Apply("%Result","CSFDBCallAddTypeSelection");
+       madd->AssignCat(api->GetVariableValue("%Result"));
+       api->Apply("%Result","CSFDBCallWritePersistent");
+       mwrite->AssignCat(api->GetVariableValue("%Result"));
+       api->Apply("%Result","CSFDBPparameter");
+       mread->AssignCat(api->GetVariableValue("%Result"));
+      }
+    }
+    else {
+      if (dimension->Length() > 0) {
+       if (AddMap.Contains(ftype->FullName())) {
+         api->Apply("%Body","CSFDBCallAddArray");      
+         api->Apply("%Result","CSFDBREADARRAYcpp");
+         madd->AssignCat(api->GetVariableValue("%Result"));
+       }
+
+       api->Apply("%Body","CSFDBCallWriteStorableArray");
+       api->Apply("%Result","CSFDBWRITEARRAYcpp");
+       mwrite->AssignCat(api->GetVariableValue("%Result"));
+       api->Apply("%Body","CSFDBReadStorableArray");
+       api->Apply("%Result","CSFDBREADARRAYcpp");
+       mread->AssignCat(api->GetVariableValue("%Result"));
+      }
+      else {
+       if (AddMap.Contains(ftype->FullName())) {
+         api->Apply("%Result","CSFDBCallAdd");
+         madd->AssignCat(api->GetVariableValue("%Result"));
+       }
+       api->Apply("%Result","CSFDBCallWRITE");
+       mwrite->AssignCat(api->GetVariableValue("%Result"));
+       api->Apply("%Result","CSFDBSparameter");
+       mread->AssignCat(api->GetVariableValue("%Result"));
+      }
+    }
+  }
+  else {
+    if (dimension->Length() > 0) {
+      api->AddVariable("%DriverFunction",CSFDBSchema_BuildDriverFunction(aMeta,api,ftype,Standard_False)->ToCString());
+      api->Apply("%Body","CSFDBCallWritePrimitiveArray");
+      api->Apply("%Result","CSFDBWRITEARRAYcpp");
+      mwrite->AssignCat(api->GetVariableValue("%Result"));
+      api->AddVariable("%Convert",CSFDBSchema_BuildConvertFunction(aMeta,api,ftype,Standard_False)->ToCString());
+
+      // warning for enums: we can do f << enum  but not f >> enum
+      //                    so here is the trick.
+      if (ftype->IsKind(STANDARD_TYPE(MS_Enum))) {
+       api->Apply("%Body","CSFDBReadEnumArray");
+      }
+      else {
+       api->Apply("%Body","CSFDBReadPrimitiveArray");
+      }
+      api->Apply("%Result","CSFDBREADARRAYcpp");
+      mread->AssignCat(api->GetVariableValue("%Result"));
+    }
+    else {
+      api->AddVariable("%DriverFunction",CSFDBSchema_BuildDriverFunction(aMeta,api,ftype,Standard_False)->ToCString());
+      api->Apply("%Result","CSFDBCallWritePrimitive");
+      mwrite->AssignCat(api->GetVariableValue("%Result"));
+      api->AddVariable("%Convert",CSFDBSchema_BuildConvertFunction(aMeta,api,ftype,Standard_False)->ToCString());
+      // CLE
+      if (strcmp(ftype->FullName()->ToCString(),"Standard_Byte") == 0) {
+       api->AddVariable("%FType","Standard_Character");
+      }
+      else {
+       api->AddVariable("%FType",ftype->FullName()->ToCString());
+      }
+      // ENDCLE
+      // warning for enums: we can do f << enum  but not f >> enum
+      //                    so here is the trick.
+      if (ftype->IsKind(STANDARD_TYPE(MS_Enum))) {
+       api->Apply("%Result","CSFDBenumeration");
+      }
+      else {
+       api->Apply("%Result","CSFDBprimitive");
+      }
+      mread->AssignCat(api->GetVariableValue("%Result"));
+    }
+  }
+}
+
+// construction du cxx des classes CallBack
+//
+void CSFDBSchema_BuildMethodsBody(const Handle(MS_MetaSchema)& aMeta,
+                                 const Handle(EDL_API)& api,
+                                 const Handle(TCollection_HAsciiString)& aClass)
+{
+  Handle(MS_StdClass)                     c,cinh,fclass;
+  Handle(TCollection_HAsciiString)        madd = new TCollection_HAsciiString;
+  Handle(TCollection_HAsciiString)        mwrite = new TCollection_HAsciiString;
+  Handle(TCollection_HAsciiString)        mread = new TCollection_HAsciiString;
+  Handle(TCollection_HAsciiString)        dbcitem;
+  Handle(TCollection_HAsciiString)        casting = new TCollection_HAsciiString;
+  Handle(TColStd_HSequenceOfHAsciiString) inh;
+  Handle(MS_HSequenceOfField)             fields;
+  Standard_Integer                        i,j;
+  Standard_Boolean                        isPersistent,needComma = Standard_False;
+  Handle(MS_Type)                         ftype;
+
+  ftype        = aMeta->GetType(aClass);
+  c            = *((Handle(MS_StdClass)*)&ftype);
+  inh          = c->GetFullInheritsNames();
+  isPersistent = c->IsPersistent();
+
+  if (isPersistent) {
+    api->AddVariable("%TCall","->");
+    api->AddVariable("%Cast","");
+  }
+  else {
+    casting->AssignCat("(");
+    casting->AssignCat(aClass);
+    casting->AssignCat("&)");
+    api->AddVariable("%Cast",casting->ToCString());
+    api->AddVariable("%TCall",".");
+  }
+
+  dbcitem = CSFDBSchema_IsVArray(aMeta,c);
+  api->AddVariable("%NameField",c->FullName()->ToCString());
+
+  // DBC VARRAY FIELD
+  //
+  if (!dbcitem.IsNull()) {
+    ftype     = aMeta->GetType(dbcitem);
+
+    if (ftype->IsKind(STANDARD_TYPE(MS_Alias))) {
+      Handle(MS_Alias) alias = *((Handle(MS_Alias)*)&ftype);
+
+      ftype = aMeta->GetType(alias->DeepType());
+    }
+    
+    api->AddVariable("%Type",ftype->FullName()->ToCString());  
+
+    CSFDBSchema_BuildDBCMethod(aMeta,api,ftype,madd,mwrite,mread,aClass);
+  }
+  // NORMAL FIELD
+  //
+  else {
+    Handle(MS_Type) tmpType;
+
+    for (i = inh->Length(); i >= 1; i--) {
+      tmpType = aMeta->GetType(inh->Value(i));
+      cinh   = *((Handle(MS_StdClass)*)&tmpType);
+      fields = cinh->GetFields();
+      api->AddVariable("%NameField",inh->Value(i)->ToCString());
+
+      for (j = 1; j <= fields->Length(); j++) {
+       if (needComma) {
+         api->Apply("%Result","CSFDBComma");
+         mwrite->AssignCat(api->GetVariableValue("%Result"));
+       }      
+       
+       needComma = Standard_True;
+       ftype     = aMeta->GetType(fields->Value(j)->TYpe());
+
+       if (ftype->IsKind(STANDARD_TYPE(MS_Alias))) {
+         Handle(MS_Alias) alias = *((Handle(MS_Alias)*)&ftype);
+         
+         ftype = aMeta->GetType(alias->DeepType());
+       }
+
+       api->AddVariable("%Type",fields->Value(j)->TYpe()->ToCString());        
+       api->AddVariable("%Field",fields->Value(j)->Name()->ToCString());
+
+       CSFDBSchema_BuildFieldMethod(aMeta,api,ftype,fields->Value(j)->Dimensions(),madd,mwrite,mread); 
+      }
+    }
+        
+    fields = c->GetFields();
+
+    api->AddVariable("%NameField",c->FullName()->ToCString());
+    
+    for (j = 1; j <= fields->Length(); j++) {
+      if (needComma) {
+       api->Apply("%Result","CSFDBComma");
+       mwrite->AssignCat(api->GetVariableValue("%Result"));
+      }
+      
+      needComma = Standard_True;
+      ftype     = aMeta->GetType(fields->Value(j)->TYpe());
+
+      if (ftype->IsKind(STANDARD_TYPE(MS_Alias))) {
+       Handle(MS_Alias) alias = *((Handle(MS_Alias)*)&ftype);
+       
+       ftype = aMeta->GetType(alias->DeepType());
+      }
+
+      api->AddVariable("%Field",fields->Value(j)->Name()->ToCString());
+      api->AddVariable("%Type",fields->Value(j)->TYpe()->ToCString()); 
+
+      CSFDBSchema_BuildFieldMethod(aMeta,api,ftype,fields->Value(j)->Dimensions(),madd,mwrite,mread);
+    }
+    api->AddVariable("%Type",aClass->ToCString());
+
+    if (isPersistent) {
+      // Methode Add
+      //
+      api->AddVariable("%Body",madd->ToCString());
+      api->Apply("%ADDmet","CSFDBPADD");
+
+      // Methode Write
+      //
+      api->AddVariable("%Body",mwrite->ToCString());
+      api->Apply("%WRITEmet","CSFDBPWRITE");
+
+      // Methode Read
+      //
+      api->AddVariable("%Body",mread->ToCString());
+      api->Apply("%READmet","CSFDBPREAD");
+    }
+    else {
+      if (AddMap.Contains(aClass)) {
+       api->AddVariable("%Body",madd->ToCString());
+       api->Apply("%ADDmet","CSFDBSADD");
+      }
+      else {
+       api->AddVariable("%ADDmet","");
+      }
+
+      api->AddVariable("%Body",mwrite->ToCString());
+      api->Apply("%WRITEmet","CSFDBSWRITE");
+      api->AddVariable("%Body",mread->ToCString());
+      api->Apply("%READmet","CSFDBSREAD");
+    }   
+  }
+
+  if (isPersistent) {
+    if (!c->Deferred()) {
+      api->Apply("%SHeaderInc","CSFDBNEWOBJECT");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+    else {
+      api->Apply("%SHeaderInc","CSFDBNEWOBJECTDeferred");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+  }
+
+  api->WriteFile("HTFile","%ADDmet");
+  api->WriteFile("HTFile","%WRITEmet");
+  api->WriteFile("HTFile","%READmet");
+}
+
+void CSFDBSchema_BuildCodeBody(const Handle(MS_MetaSchema)& aMeta,
+                              const Handle(EDL_API)& api,
+                              const Handle(TColStd_HSequenceOfHAsciiString)& classList,
+                              const Handle(TCollection_HAsciiString)& schName,
+                              const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+  Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+  Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString(api->GetVariableValue("%FullPath"));
+  Handle(TCollection_HAsciiString) proto  = new TCollection_HAsciiString;
+  Standard_Integer                 i,fileNum = 0,j;
+  Handle(MS_StdClass)              c;
+  Handle(MS_Type)                  tmpType;
+  
+  
+  aFileName->AssignCat(schName);
+  aFileName->AssignCat(".cxx");
+  
+  api->OpenFile("HTFile",aFileName->ToCString());
+
+  api->AddVariable("%Type",schName->ToCString());
+  api->Apply("%SHeaderInc","CSFDBInclude");
+  api->WriteFile("HTFile","%SHeaderInc");
+  api->AddVariable("%Type","Storage_StreamUnknownTypeError");
+  api->Apply("%SHeaderInc","CSFDBInclude");
+  api->WriteFile("HTFile","%SHeaderInc");
+  api->AddVariable("%Type","TColStd_SequenceOfAsciiString");
+  api->Apply("%SHeaderInc","CSFDBInclude");
+  api->WriteFile("HTFile","%SHeaderInc");
+
+  for (i = 1; i <= classList->Length(); i++) {
+    tmpType = aMeta->GetType(classList->Value(i));
+    c = *((Handle(MS_StdClass)*)&tmpType);
+    
+    api->AddVariable("%Type",classList->Value(i)->ToCString());
+
+    if (c->IsPersistent()) {
+      api->Apply("%SHeaderInc","CSFDBDerivatedInclude");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+  }
+  
+  api->AddVariable("%Schema",schName->ToCString());
+  api->Apply("%SHeaderInc","CSFDBTypeMgt");
+  api->WriteFile("HTFile","%SHeaderInc");
+
+  CSFDBSchema_BuildAddTypeSelection(aMeta,api,classList);
+  CSFDBSchema_BuildReadTypeSelection(aMeta,api,classList);
+  CSFDBSchema_BuildSchemaTypeList(aMeta,api,classList);
+
+  api->CloseFile("HTFile");
+  outfile->Append(aFileName);
+  Handle(MS_HSequenceOfField) theFields;
+
+  for (i = 1; i <= classList->Length(); i++) {
+    InfoMsg << "CSFDBSchema" << "Processing : "<< classList->Value(i)->ToCString() << endm;
+    // HXX
+    //
+    tmpType = aMeta->GetType(classList->Value(i));
+    c = *((Handle(MS_StdClass)*)&tmpType);
+    theFields = c->GetFields();
+
+    Handle(TCollection_HAsciiString) includeFile = new TCollection_HAsciiString;
+
+    // DBC_VArray  
+    //
+    if (!c->GetMyCreator().IsNull()) {
+      Handle(MS_InstClass) inst    = c->GetMyCreator();
+
+      if (strcmp(inst->GenClass()->ToCString(),"DBC_VArray") == 0) {
+       Handle(TCollection_HAsciiString) typeField = inst->InstTypes()->Value(1);
+
+       tmpType = aMeta->GetType(inst->InstTypes()->Value(1));
+
+       if (tmpType->IsKind(STANDARD_TYPE(MS_StdClass)) && !RemoveMap.Contains(typeField)) { 
+         api->AddVariable("%Type",typeField->ToCString());
+         api->Apply("%SHeaderInc","CSFDBDerivatedInclude");
+         includeFile->AssignCat(api->GetVariableValue("%SHeaderInc"));
+       }
+      }
+    }
+
+    
+    
+    // inheritance
+    //
+    if (c->GetInheritsNames()->Length() > 0) {
+      if (!RemoveMap.Contains(c->GetInheritsNames()->Value(1))) {
+       api->AddVariable("%Type",c->GetInheritsNames()->Value(1)->ToCString());
+       api->Apply("%SHeaderInc","CSFDBDerivatedInclude");
+       includeFile->AssignCat(api->GetVariableValue("%SHeaderInc"));
+      }
+    }
+  
+    api->AddVariable("%Include",includeFile->ToCString());
+    api->AddVariable("%Type",classList->Value(i)->ToCString());
+    aFileName = new TCollection_HAsciiString(api->GetVariableValue("%FullPath"));
+    aFileName->AssignCat(schName);
+    aFileName->AssignCat("_");
+    aFileName->AssignCat(classList->Value(i));
+    aFileName->AssignCat(".hxx");
+    api->OpenFile("HTFile",aFileName->ToCString());
+    api->AddVariable("%Type",classList->Value(i)->ToCString());
+    if (c->IsPersistent()) {
+      api->Apply("%SHeaderInc","CSFDBPCallBackClass");
+    }
+    else {
+      api->Apply("%SHeaderInc","CSFDBSCallBackClass");
+    }
+    api->WriteFile("HTFile","%SHeaderInc");
+    api->CloseFile("HTFile");
+    outfile->Append(aFileName);
+
+    // IXX
+    //
+    // Includes des champs
+    //
+    includeFile = new TCollection_HAsciiString;
+
+    // inheritance
+    //
+    if (c->GetInheritsNames()->Length() > 0) {
+      if (!RemoveMap.Contains(c->GetInheritsNames()->Value(1))) {
+       api->AddVariable("%Type",c->GetInheritsNames()->Value(1)->ToCString());
+       api->Apply("%SHeaderInc","CSFDBIxxInclude");
+       includeFile->AssignCat(api->GetVariableValue("%SHeaderInc"));
+      }
+    }
+
+    for (j = 1; j <= theFields->Length(); j++) {
+      Handle(TCollection_HAsciiString) typeField = theFields->Value(j)->TYpe();
+      Handle(MS_Type)                  rtypeField = aMeta->GetType(typeField);
+      
+      if (rtypeField->IsKind(STANDARD_TYPE(MS_StdClass)) && !RemoveMap.Contains(typeField)) {      
+       api->AddVariable("%Type",typeField->ToCString());
+       api->Apply("%SHeaderInc","CSFDBDerivatedInclude");
+       includeFile->AssignCat(api->GetVariableValue("%SHeaderInc"));
+      }
+    }
+    includeFile->AssignCat("\n");
+
+    aFileName = new TCollection_HAsciiString(api->GetVariableValue("%FullPath"));
+    aFileName->AssignCat(schName);
+    aFileName->AssignCat("_");
+    aFileName->AssignCat(classList->Value(i));
+    aFileName->AssignCat(".ixx");
+    api->OpenFile("HTFile",aFileName->ToCString());
+    api->AddVariable("%Type",classList->Value(i)->ToCString());
+    api->AddVariable("%SHeaderInc",includeFile->ToCString());
+    api->WriteFile("HTFile","%SHeaderInc");
+    api->CloseFile("HTFile");
+    outfile->Append(aFileName);
+
+    // CXX
+    //
+    aFileName = new TCollection_HAsciiString(api->GetVariableValue("%FullPath"));
+    aFileName->AssignCat(schName);
+    aFileName->AssignCat("_");
+    aFileName->AssignCat(classList->Value(i));
+    aFileName->AssignCat(".cxx");
+    api->OpenFile("HTFile",aFileName->ToCString());
+    api->Apply("%SHeaderInc","CSFDBDerivatedInclude");
+    api->WriteFile("HTFile","%SHeaderInc");
+
+    // here we include Class.hxx
+    //
+    api->Apply("%SHeaderInc","CSFDBInclude");
+    api->WriteFile("HTFile","%SHeaderInc");
+    // here we include Class.ixx
+    //
+    api->Apply("%SHeaderInc","CSFDBIxxInclude");
+    api->WriteFile("HTFile","%SHeaderInc");
+    api->AddVariable("%Type","Storage_Schema");
+    api->Apply("%SHeaderInc","CSFDBInclude");
+    api->WriteFile("HTFile","%SHeaderInc");
+    api->AddVariable("%Type","Storage_stCONSTclCOM");
+    api->Apply("%SHeaderInc","CSFDBInclude");
+    api->WriteFile("HTFile","%SHeaderInc");
+    api->AddVariable("%Type",classList->Value(i)->ToCString());
+    if (c->IsPersistent()) {
+      api->Apply("%SHeaderInc","CSFDBCallBackTypeMgt");
+      api->WriteFile("HTFile","%SHeaderInc");
+    }
+    api->AddVariable("%Type",schName->ToCString());
+    CSFDBSchema_BuildMethodsBody(aMeta,api,classList->Value(i));
+    api->CloseFile("HTFile");
+    outfile->Append(aFileName);
+  }
+}
+
+Standard_Boolean CSFDBSchema_ClassMustHaveAddFunction(const Handle(MS_MetaSchema)& aMeta,
+                                                     const Handle(TCollection_HAsciiString)& aClassName,
+                                                     WOKTools_MapOfHAsciiString& aMap)
+{
+  Handle(MS_StdClass) stdClass;
+  Handle(MS_Type)     aType;
+  Standard_Boolean    result = Standard_False;
+
+  if (aMeta->IsDefined(aClassName)) {
+    aType    = aMeta->GetType(aClassName);
+    stdClass = Handle(MS_StdClass)::DownCast(aType);
+  }
+  else {
+    ErrorMsg << "CSFDBSchema" << "type " << aClassName->ToCString() << " not defined." << endm;
+    return Standard_False;
+  }
+
+  if (!stdClass.IsNull()) {
+    Handle(MS_HSequenceOfField)      fields = stdClass->GetFields();
+    Handle(TCollection_HAsciiString) dbcitem;
+    Standard_Integer                 i;
+    Standard_Boolean                 locRes;
+
+    
+    if (stdClass->IsPersistent()) {
+      result = Standard_True;
+    }
+
+    if (aMap.Contains(aClassName)) return Standard_True;
+    else if (result) aMap.Add(aClassName);
+
+    dbcitem = CSFDBSchema_IsVArray(aMeta,stdClass);
+
+    if (!dbcitem.IsNull()) {
+      aType = aMeta->GetType(dbcitem);
+      
+      if (aType->IsKind(STANDARD_TYPE(MS_StdClass))) {
+       stdClass = *((Handle(MS_StdClass)*)&aType);
+       
+       if (stdClass->IsPersistent()) {
+         result = Standard_True;
+         if (!aMap.Contains(dbcitem)) aMap.Add(dbcitem);
+       }
+       
+       locRes = CSFDBSchema_ClassMustHaveAddFunction(aMeta,dbcitem,aMap);
+       
+       result = (locRes || result);
+      }
+    }
+    else {
+      for (i = 1; i <= fields->Length(); i++) {
+       aType = aMeta->GetType(fields->Value(i)->TYpe());
+       
+       if (aType->IsKind(STANDARD_TYPE(MS_StdClass))) {
+         stdClass = *((Handle(MS_StdClass)*)&aType);
+         
+         if (stdClass->IsPersistent()) {
+           result = Standard_True;
+           if (!aMap.Contains(fields->Value(i)->TYpe())) aMap.Add(fields->Value(i)->TYpe());
+         }
+         
+         locRes = CSFDBSchema_ClassMustHaveAddFunction(aMeta,fields->Value(i)->TYpe(),aMap);
+         
+         result = (locRes || result);
+       }
+      }
+    }
+  }
+
+  if (result && !aMap.Contains(aClassName)) aMap.Add(aClassName);
+
+  return result;
+}
+  
+// Standard extractor API : launch the extraction of C++ schema file
+//                          from the type <aName>
+// 
+void CSFDBSchema_Extract(const Handle(MS_MetaSchema)& aMeta,
+                        const Handle(TCollection_HAsciiString)& aName,
+                        const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+                        const Handle(TCollection_HAsciiString)& outdir,
+                        const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+                        const Standard_CString DBMS)
+{
+  Handle(MS_Schema)                       aSchema;
+  Handle(TColStd_HSequenceOfHAsciiString) classList,
+                                          classListImp,
+                                          classToRemove;
+  Standard_Integer                        i,j;
+  
+  // before begining, we look if the entity has something to extract...
+  //
+  if (aMeta->IsSchema(aName)) {
+    aSchema   = aMeta->GetSchema(aName); 
+  }
+  else {
+    ErrorMsg << "CSFDBSchema" << aName->ToCString() << " is not a schema..." << endm;
+    Standard_NoSuchObject::Raise();
+  }
+  
+  // ... and we load the templates
+  //
+  Handle(EDL_API)     api;
+  
+  api = CSFDBSchema_LoadTemplate(edlsfullpath,outdir,DBMS);
+  
+  api->AddVariable("%Schema",aName->ToCString());
+  
+  classList    = aMeta->GetPersistentClassesFromSchema(aName,Standard_True);
+  classListImp = aMeta->GetPersistentClassesFromClasses(classList,Standard_True);
+
+  classList->Append(classListImp);
+
+  classToRemove = new TColStd_HSequenceOfHAsciiString;
+
+  for (i = 1; i <= classList->Length(); i++) {
+    if (strcmp(classList->Value(i)->ToCString(),"PStandard_ArrayNode") == 0) {
+      classToRemove->Append(classList->Value(i));
+      if (!RemoveMap.Contains(classList->Value(i))) {
+       RemoveMap.Add(classList->Value(i));
+      }
+    }
+    else if (strcmp(classList->Value(i)->ToCString(),"DBC_BaseArray") == 0) {
+      classToRemove->Append(classList->Value(i));
+      if (!RemoveMap.Contains(classList->Value(i))) {
+       RemoveMap.Add(classList->Value(i));
+      }
+    }
+    else {
+      if (aMeta->IsDefined(classList->Value(i))) {
+       Handle(MS_Type) t = aMeta->GetType(classList->Value(i));
+
+       if (t->IsKind(STANDARD_TYPE(MS_StdClass))) {
+         Handle(MS_StdClass) c = *((Handle(MS_StdClass)*)&t);
+
+         if (!c->GetMyCreator().IsNull() && c->IsNested()) {
+           Handle(MS_InstClass) inst = c->GetMyCreator(),
+                                instn;
+           Handle(MS_Type) tmpType = aMeta->GetType(c->GetNestingClass());
+           Handle(MS_StdClass) cn = *((Handle(MS_StdClass)*)&tmpType);
+
+           if (strcmp(inst->GenClass()->ToCString(),"DBC_VArray") == 0) {
+             if (strcmp(cn->GetMyCreator()->GenClass()->ToCString(),inst->GenClass()->ToCString()) == 0) {
+               classToRemove->Append(classList->Value(i));
+               if (!RemoveMap.Contains(classList->Value(i))) {
+                 RemoveMap.Add(classList->Value(i));
+               }
+             }
+           }
+         }
+       }
+      }
+    }
+
+    CSFDBSchema_ClassMustHaveAddFunction(aMeta,classList->Value(i),AddMap);
+  }
+
+  Standard_Integer LenList = classList->Length();
+
+  for (j = 1; j <= classToRemove->Length(); j++) {
+    for (i = 1; i <= LenList; i++) {
+      if (strcmp(classList->Value(i)->ToCString(),classToRemove->Value(j)->ToCString()) == 0) {
+       classList->Remove(i);
+       if (AddMap.Contains(classToRemove->Value(j))) AddMap.Remove(classToRemove->Value(j));
+       i = LenList + 1;
+      }
+    }
+    LenList = classList->Length();
+  }
+
+  CSFDBSchema_BuildHeader(aMeta,api,classList,aName,outfile);
+  CSFDBSchema_BuildCodeBody(aMeta,api,classList,aName,outfile);
+  AddMap.Clear();
+  RemoveMap.Clear();
+}
+
+
+
+
+
diff --git a/src/CSFDBSchema/CSFDBSchema_Template.edl b/src/CSFDBSchema/CSFDBSchema_Template.edl
new file mode 100755 (executable)
index 0000000..80f6fa1
--- /dev/null
@@ -0,0 +1,790 @@
+-- File:       CSFDBSchema_Template.edl
+-- Author:     Kernel
+-- History:    Tue Apr  9 15:59:24 1996        Kernel  Creation
+-- Copyright:   Matra Datavision 1996
+
+-- SCHEMA
+--
+@template CSFDBSchemaClassProto(%Schema) is
+$// File generated by Schema (Schema)
+$//
+$//                     Copyright (C) 1991,1995 by
+$//  
+$//                      MATRA DATAVISION, FRANCE
+$//  
+$// This software is furnished in accordance with the terms and conditions
+$// of the contract and with the inclusion of the above copyright notice.
+$// This software or any other copy thereof may not be provided or otherwise
+$// be made available to any other person. No title to an ownership of the
+$// software is hereby transferred.
+$//  
+$// At the termination of the contract, the software and all copies of this
+$// software must be deleted.
+$
+$#ifndef _%Schema_HeaderFile
+$#define _%Schema_HeaderFile
+$
+$#ifndef _Standard_Macro_HeaderFile
+$#include <Standard_Macro.hxx>
+$#endif
+$#ifndef _Storage_Macros_HeaderFile
+$#include <Storage_Macros.hxx>
+$#endif
+$#ifndef _Storage_stCONSTclCOM_HeaderFile
+$#include <Storage_stCONSTclCOM.hxx>
+$#endif
+$#ifndef _Handle_Storage_Schema_HeaderFile
+$#include <Handle_Storage_Schema.hxx>
+$#endif
+$
+$class Handle_Standard_Type;
+$Standard_EXPORT Handle_Standard_Type& %Schema_Type_();
+$class Standard_Transient;
+$class Handle(Storage_Schema);
+$class %Schema;
+$
+$class Handle(%Schema) : public Handle(Storage_Schema) {
+$  public:
+$    Handle(%Schema)():Handle(Storage_Schema)() {} 
+$    Handle(%Schema)(const Handle(%Schema)& aHandle) : Handle(Storage_Schema)(aHandle) 
+$     {
+$     }
+$
+$    Handle(%Schema)(const %Schema* anItem) : Handle(Storage_Schema)((Storage_Schema *)anItem) 
+$     {
+$     }
+$
+$    Handle(%Schema)& operator=(const Handle(%Schema)& aHandle)
+$     {
+$      Assign(aHandle.Access());
+$      return *this;
+$     }
+$
+$    Handle(%Schema)& operator=(const %Schema* anItem)
+$     {
+$      Assign((Standard_Transient *)anItem);
+$      return *this;
+$     }
+$
+$    %Schema* operator->() 
+$     {
+$      return (%Schema *)ControlAccess();
+$     }
+$
+$    %Schema* operator->() const 
+$     {
+$      return (%Schema *)ControlAccess();
+$     }
+$
+$   ~Handle(%Schema)(){};
+$
+$   static const Handle(%Schema) DownCast(const Handle(Storage_Schema)& AnObject) 
+$   {
+$     Handle(%Schema) _anOtherObject;
+$
+$     if (!AnObject.IsNull()) {
+$        if (AnObject->IsKind(STANDARD_TYPE(%Schema))) {
+$          _anOtherObject = Handle(%Schema)((Handle(%Schema)&)AnObject);
+$        }
+$     }
+$
+$     return _anOtherObject ;
+$   }
+$};
+$
+$#ifndef _Storage_CallBack_HeaderFile_
+$#include <Storage_CallBack.hxx>
+$#endif
+$#ifndef _Storage_BaseDriver_HeaderFile_
+$#include <Storage_BaseDriver.hxx>
+$#endif
+$
+$class %Schema : public Storage_Schema {
+$public:
+$
+$  Storage_DECLARE_SCHEMA_METHODS(%Schema)
+$
+$  Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const 
+$  { 
+$    return (STANDARD_TYPE(%Schema) == AType || Storage_Schema::IsKind(AType)); 
+$  }
+$
+$  const Handle(Standard_Type)& DynamicType() const 
+$  { 
+$    return STANDARD_TYPE(%Schema) ; 
+$  }
+$};
+$
+$#endif
+@end;
+
+@template CSFDBPCallBackClass(%Schema,%Type,%Include) is
+$// File generated by Schema (CallBack)
+$//
+$//                     Copyright (C) 1991,1995 by
+$//  
+$//                      MATRA DATAVISION, FRANCE
+$//  
+$// This software is furnished in accordance with the terms and conditions
+$// of the contract and with the inclusion of the above copyright notice.
+$// This software or any other copy thereof may not be provided or otherwise
+$// be made available to any other person. No title to an ownership of the
+$// software is hereby transferred.
+$//  
+$// At the termination of the contract, the software and all copies of this
+$// software must be deleted.
+$
+$#ifndef _%Schema_%Type_HeaderFile
+$#define _%Schema_%Type_HeaderFile
+$
+$#ifndef _Storage_Schema_HeaderFile
+$#include <Storage_Schema.hxx>
+$#endif
+$#ifndef _Storage_CallBack_HeaderFile_
+$#include <Storage_CallBack.hxx>
+$#endif
+$#ifndef _Storage_BaseDriver_HeaderFile_
+$#include <Storage_BaseDriver.hxx>
+$#endif
+$
+$%Include
+$
+$class Handle_%Type;
+$
+$class Handle_Standard_Type;
+$Standard_EXPORT Handle_Standard_Type& %Schema_%Type_Type_();
+$Standard_EXPORT Handle_Standard_Type& %Type_Type_();
+$class Standard_Transient;
+$class Handle_Standard_Persistent;
+$class %Schema_%Type;
+$
+$class Handle(%Schema_%Type) : public Handle(Storage_CallBack) {
+$  public:
+$    Handle(%Schema_%Type)() : Handle(Storage_CallBack)() {} 
+$    Handle(%Schema_%Type)(const Handle(%Schema_%Type)& aHandle) : Handle(Storage_CallBack)(aHandle) 
+$     {
+$     }
+$
+$    Handle(%Schema_%Type)(const %Schema_%Type* anItem) : Handle(Storage_CallBack)((Storage_CallBack *)anItem) 
+$     {
+$     }
+$
+$    Handle(%Schema_%Type)& operator=(const Handle(%Schema_%Type)& aHandle)
+$     {
+$      Assign(aHandle.Access());
+$      return *this;
+$     }
+$
+$    Handle(%Schema_%Type)& operator=(const %Schema_%Type* anItem)
+$     {
+$      Assign((Standard_Transient *)anItem);
+$      return *this;
+$     }
+$
+$    %Schema_%Type* operator->() 
+$     {
+$      return (%Schema_%Type *)ControlAccess();
+$     }
+$
+$    %Schema_%Type* operator->() const 
+$     {
+$      return (%Schema_%Type *)ControlAccess();
+$     }
+$
+$   ~Handle(%Schema_%Type)(){};
+$
+$   Standard_EXPORT static const Handle(%Schema_%Type) DownCast(const Handle(Storage_CallBack)&);
+$};
+$
+$
+$class %Schema_%Type : public Storage_CallBack {
+$  public:
+$   %Schema_%Type() {};
+$   Standard_EXPORT static void SAdd(const Handle(%Type)& ,const Handle(Storage_Schema)&);
+$   Standard_EXPORT static void SWrite(const Handle(Standard_Persistent)&,Storage_BaseDriver&,const Handle(Storage_Schema)&);
+$   Standard_EXPORT static void SRead(const Handle(Standard_Persistent)&,Storage_BaseDriver&,const Handle(Storage_Schema)&);
+$
+$   Standard_EXPORT Handle_Standard_Persistent New() const;
+$   Standard_EXPORT void Add(const Handle(Standard_Persistent)&,const Handle(Storage_Schema)&) const;
+$   Standard_EXPORT void Write(const Handle(Standard_Persistent)&,Storage_BaseDriver&,const Handle(Storage_Schema)&) const;
+$   Standard_EXPORT void Read(const Handle(Standard_Persistent)&,Storage_BaseDriver&,const Handle(Storage_Schema)&) const;
+$   ~%Schema_%Type() {};
+$
+$   Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const; 
+$   Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+$};
+$#endif
+@end;
+
+@template CSFDBSCallBackClass(%Schema,%Type,%Include) is
+$// File generated by Schema (Storable CallBack)
+$//
+$//                     Copyright (C) 1991,1995 by
+$//  
+$//                      MATRA DATAVISION, FRANCE
+$//  
+$// This software is furnished in accordance with the terms and conditions
+$// of the contract and with the inclusion of the above copyright notice.
+$// This software or any other copy thereof may not be provided or otherwise
+$// be made available to any other person. No title to an ownership of the
+$// software is hereby transferred.
+$//  
+$// At the termination of the contract, the software and all copies of this
+$// software must be deleted.
+$
+$#ifndef _%Schema_%Type_HeaderFile
+$#define _%Schema_%Type_HeaderFile
+$
+$#ifndef _Handle_Storage_Schema_HeaderFile
+$#include <Handle_Storage_Schema.hxx>
+$#endif
+$#ifndef _Storage_BaseDriver_HeaderFile_
+$#include <Storage_BaseDriver.hxx>
+$#endif
+$
+$%Include
+$
+$class %Type;
+$
+$class %Schema_%Type {
+$  public:
+$   Standard_EXPORT static void SAdd(const %Type&,const Handle(Storage_Schema)& aSchema);
+$   Standard_EXPORT static void SWrite(const %Type&,Storage_BaseDriver& aDriver,const Handle(Storage_Schema)& aSchema);
+$   Standard_EXPORT static void SRead(%Type&,Storage_BaseDriver& aDriver,const Handle(Storage_Schema)& aSchema);
+$};
+$
+$#endif
+@end;
+
+-- -------------- AddTypeSelection
+--
+@template CSFDBADDTSBegin(%Schema,%Type) is
+$
+$ Storage_BEGIN_ADD_TYPES(%Schema)
+@end;
+
+@template CSFDBADDTSPart(%Schema,%Type) is
+$ Storage_ADD_TYPES(%Schema,%Type,%Schema_%Type)
+@end;
+
+@template CSFDBADDTSEnd(%Schema) is
+$ Storage_END_ADD_TYPES(%Schema)
+$
+@end;
+--
+-- -------------- AddTypeSelection
+
+-- -------------- TypeList
+--
+@template CSFDBTypeListBegin(%Schema) is
+$
+$  Storage_BEGIN_SCHEMA_TYPES(%Schema)
+@end;
+
+@template CSFDBTypeListPart(%Type) is
+$  Storage_SCHEMA_TYPES(%Type)
+@end;
+
+@template CSFDBTypeListEnd(%Schema) is
+$  Storage_END_SCHEMA_TYPES(%Schema)
+$
+@end;
+--
+-- -------------- TypeList
+
+-- -------------- ReadTypeSelection
+--
+@template CSFDBREADTSBegin(%Schema) is
+$
+$ Storage_BEGIN_READ_SELECTION(%Schema)
+@end;
+
+@template CSFDBREADTSPart(%Schema,%Type) is
+$ Storage_READ_SELECTION(%Schema,%Type,%Schema_%Type)
+@end;
+
+@template CSFDBREADTSEnd(%Schema) is
+$ Storage_END_READ_SELECTION(%Schema)
+$
+@end;
+--
+-- -------------- ReadTypeSelection
+
+-- -------------- ADD
+--
+@template CSFDBSADD(%Schema,%Type,%Body) is
+$
+$void %Schema_%Type::SAdd(const %Type& p, const Handle(Storage_Schema)& theSchema)
+${
+$  %Body
+$}
+@end;
+
+@template CSFDBPADD(%Schema,%Type,%Body) is
+$
+$void %Schema_%Type::SAdd(const Handle(%Type)& p, const Handle(Storage_Schema)& theSchema)
+${
+$  if (!p.IsNull()) {
+$    if (theSchema->AddPersistent(p,"%Type")) {
+$      %Body
+$    }
+$  }
+$}
+$
+$void %Schema_%Type::Add(const Handle(Standard_Persistent)& p, const Handle(Storage_Schema)& theSchema) const {
+$  %Schema_%Type::SAdd((Handle(%Type)&)p,theSchema);
+$}
+@end;
+--
+-- -------------- ADD
+
+-- -------------- WRITE
+--
+@template CSFDBSWRITE(%Schema,%Type,%Body) is
+$
+$void %Schema_%Type::SWrite(const %Type& pp, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema)
+${
+$  f.BeginWriteObjectData();
+$%Body
+$  f.EndWriteObjectData();
+$}
+@end;
+
+
+@template CSFDBPWRITE(%Schema,%Type,%Body) is
+$
+$void %Schema_%Type::SWrite(const Handle(Standard_Persistent)& p, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema)
+${ 
+$  if (!p.IsNull()) {
+$    Handle(%Type) &pp = (Handle(%Type)&)p;
+$    theSchema->WritePersistentObjectHeader(p,f);
+$    
+$    f.BeginWritePersistentObjectData();
+$%Body
+$    f.EndWritePersistentObjectData();
+$  }
+$}
+$
+$void %Schema_%Type::Write(const Handle(Standard_Persistent)& p, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema) const
+${ 
+$ %Schema_%Type::SWrite(p,f,theSchema);
+$}
+@end;
+--
+-- -------------- WRITE
+
+-- -------------- READ
+--
+@template CSFDBNEWOBJECT(%Schema,%Type) is
+$Handle(Standard_Persistent) %Schema_%Type::New() const
+${
+$ return new %Type(Storage_stCONSTclCOM());
+$}
+@end;
+
+@template CSFDBNEWOBJECTDeferred(%Schema,%Type) is
+$Handle(Standard_Persistent) %Schema_%Type::New() const
+${
+$ Handle(Standard_Persistent) NullObject;
+$ return NullObject;
+$}
+@end;
+
+@template CSFDBSREAD(%Schema,%Type,%Body) is
+$void %Schema_%Type::SRead(%Type& pp, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema)
+${
+$  f.BeginReadObjectData();
+$%Body
+$  f.EndReadObjectData();
+$}
+@end;
+
+@template CSFDBPREAD(%Schema,%Type,%Body) is
+$void %Schema_%Type::SRead(const Handle(Standard_Persistent)& p, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema)
+${ 
+$  if (!p.IsNull()) {
+$    Handle(%Type) &pp = (Handle(%Type)&)p;
+$
+$    theSchema->ReadPersistentObjectHeader(f);
+$    f.BeginReadPersistentObjectData();
+$
+$%Body
+$    f.EndReadPersistentObjectData();
+$  }
+$}
+$
+$void %Schema_%Type::Read(const Handle(Standard_Persistent)& p, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema) const
+${ 
+$ %Schema_%Type::SRead(p,f,theSchema);
+$}
+@end;
+
+@template CSFDBPparameter(%Type,%Field,%NameField,%TCall) is
+$
+$    Handle(%Type) %NameField%Field;
+$
+$    theSchema->ReadPersistentReference(%NameField%Field,f);
+$    pp%TCall_CSFDB_Set%NameField%Field(%NameField%Field);
+@end;
+
+@template CSFDBSparameter(%Schema,%Type,%Field,%NameField,%TCall) is
+$
+$    %Schema_%Type::SRead((%Type&)pp%TCall_CSFDB_Get%NameField%Field(),f,theSchema);
+@end;
+
+@template CSFDBprimitive(%FType,%Field,%NameField,%Convert,%TCall) is
+$
+$    %FType %NameField%Field;
+$    %Convert(%NameField%Field);
+$    pp%TCall_CSFDB_Set%NameField%Field(%NameField%Field);
+@end;
+
+@template CSFDBenumeration(%FType,%Field,%NameField,%Convert,%TCall) is
+$
+$    %FType %NameField%Field;
+$    Standard_Integer i_CSFDB_%NameField%Field;
+$    %Convert(i_CSFDB_%NameField%Field);
+$    %NameField%Field = (%FType)i_CSFDB_%NameField%Field;
+$    pp%TCall_CSFDB_Set%NameField%Field(%NameField%Field);
+@end;
+
+@template CSFDBREADfloat() is
+$f.GetReal\^
+@end;
+
+@template CSFDBREADint() is
+$f.GetInteger\^
+@end;
+
+@template CSFDBREADenum(%Type) is
+$f.GetInteger\^
+@end;
+
+@template CSFDBREADchar() is
+$f.GetCharacter\^
+@end;
+
+@template CSFDBREADshortreal() is
+$f.GetShortReal\^
+@end;
+
+@template CSFDBREADextchar() is
+$f.GetExtCharacter\^
+@end;
+
+@template CSFDBREADboolean() is
+$f.GetBoolean\^
+@end;
+
+
+--
+-- -------------- READ
+
+-- -------------- DBC
+--
+@template CSFDBSADDDBC(%Schema,%Type) is
+$  Standard_Integer i;
+$  for (i = 0; i < p.Length(); i++) {
+$    %Schema_%Type::SAdd(p.Value(i),theSchema);    
+$  }
+@end;
+
+@template CSFDBPADDDBC(%Schema) is
+$  Standard_Integer i;
+$  for (i = 0; i < p.Length(); i++) {
+$    theSchema->PersistentToAdd(p.Value(i));    
+$  }
+@end;
+
+@template CSFDBWRITEDBC(%Schema,%Type,%Body) is
+$void %Schema_%Type::SWrite(const %Type& pp, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema)
+${
+$  Standard_Integer i;
+$
+$  f.BeginWriteObjectData();
+$  f.PutInteger(pp.Length());
+$  for (i = 0; i < pp.Length(); i++) {
+$%Body
+$  }
+$  f.EndWriteObjectData();
+$}
+@end;
+
+@template CSFDBREADDBC(%Schema,%Type,%Body) is
+$void %Schema_%Type::SRead(%Type& pp, Storage_BaseDriver& f, const Handle(Storage_Schema)& theSchema)
+${
+$  Standard_Integer size = 0;
+$
+$  f.BeginReadObjectData();
+$  f.GetInteger(size);
+$  pp.Resize(size);
+$
+$  for (Standard_Integer j = 0; j < size; j++) {
+$%Body
+$  }
+$  f.EndReadObjectData();
+$}
+@end;
+
+@template CSFDBCallWRITE(%Schema,%Type,%Field,%NameField,%TCall) is
+$    %Schema_%Type::SWrite(pp%TCall_CSFDB_Get%NameField%Field(),f,theSchema);
+@end;
+
+@template CSFDBDBCRfloat() is
+$    Standard_Real par;
+$
+$    f.GetReal(par);
+$    pp.SetValue(j,par);
+@end;
+
+@template CSFDBDBCRint() is
+$    Standard_Integer par;
+$
+$    f.GetInteger(par);
+$    pp.SetValue(j,par);
+@end;
+
+@template CSFDBDBCRenum(%Type) is
+$    %Type par;
+$    Standard_Integer parcv = 0;
+$
+$    f.GetInteger(parcv);
+$    par = (%Type)parcv;
+$    pp.SetValue(j,par);
+@end;
+
+@template CSFDBDBCRchar() is
+$    Standard_Character par;
+$
+$    f.GetCharacter(par);
+$    pp.SetValue(j,par);
+@end;
+
+@template CSFDBDBCRextchar() is
+$    Standard_ExtCharacter par;
+$
+$    f.GetExtCharacter(par);
+$    pp.SetValue(j,par);
+@end;
+
+@template CSFDBDBCRshortreal() is
+$    Standard_ShortReal par;
+$
+$    f.GetShortReal(par);
+$    pp.SetValue(j,par);
+@end;
+
+@template CSFDBDBCRboolean() is
+$    Standard_Boolean par;
+$
+$    f.GetBoolean(par);
+$    pp.SetValue(j,par);
+@end;
+
+@template CSFDBDBCPparameter(%Type,%Field,%TCall) is
+$    Handle(%Type) par;
+$
+$    theSchema->ReadPersistentReference(par,f);
+$    pp.SetValue(j,par);
+@end;
+
+
+@template CSFDBDBCSparameter(%Schema,%Type) is
+$    %Schema_%Type::SRead((%Type&)pp.Value(j),f,theSchema);
+@end;
+
+@template CSFDBDBCWprim(%DriverFunction) is
+$    f.%DriverFunction(pp.Value(i));
+@end;
+
+@template CSFDBDBCWpersistent() is
+$    theSchema->WritePersistentReference(pp.Value(i),f);
+@end;
+
+@template CSFDBDBCWstorable(%Schema,%Type) is
+$    %Schema_%Type::SWrite(pp.Value(i),f,theSchema);
+@end;
+--
+-- -------------- DBC
+
+-- ------------- General
+--
+@template CSFDBCallAddTypeSelection(%Schema,%Field,%NameField,%TCall) is
+$   theSchema->PersistentToAdd(p%TCall_CSFDB_Get%NameField%Field());
+@end;
+
+@template CSFDBCallAdd(%Schema,%Type,%Field,%NameField,%TCall) is
+$   %Schema_%Type::SAdd(p%TCall_CSFDB_Get%NameField%Field(),theSchema);
+@end;
+
+@template CSFDBCallWritePersistent(%Field,%NameField,%TCall) is
+$  theSchema->WritePersistentReference(pp%TCall_CSFDB_Get%NameField%Field(),f);
+@end;
+
+@template CSFDBComma() is
+$\^
+@end;
+
+@template CSFDBCallWritePrimitive(%Field,%NameField,%TCall,%DriverFunction) is
+$  f.%DriverFunction(pp%TCall_CSFDB_Get%NameField%Field());
+@end;
+
+@template CSFDBInclude(%Type) is
+$#ifndef _%Type_HeaderFile_
+$#include <%Type.hxx>
+$#endif
+@end;
+
+@template CSFDBDerivatedInclude(%Schema,%Type) is
+$#ifndef _%Schema_%Type_HeaderFile_
+$#include <%Schema_%Type.hxx>
+$#endif
+@end;
+
+@template CSFDBIxxInclude(%Schema,%Type) is
+$#include <%Schema_%Type.ixx>
+@end;
+
+--
+-- ------------- General
+
+-- ------------- C++ Array
+--
+@template CSFDBCallAddTypeSelectionArray(%Schema,%Field,%NameField,%TCall,%VDim) is
+$   theSchema->PersistentToAdd(p%TCall_CSFDB_Get%NameField%Field(%VDim));
+@end;
+
+@template CSFDBCallAddArray(%Schema,%Type,%Field,%NameField,%TCall,%VDim) is
+$   %Schema_%Type::SAdd(p%TCall_CSFDB_Get%NameField%Field(%VDim),theSchema);
+@end;
+
+@template CSFDBforWrite(%Var,%Length) is
+$    for (%Var = 0; %Var < %Length; %Var++)
+@end;
+
+@template CSFDBforRead(%Var,%Length) is
+$    for (%Var = 0; %Var < %Length; %Var++)
+@end;
+
+@template CSFDBCallWritePrimitiveArray(%Field,%NameField,%TCall,%VDim,%Cast,%DriverFunction) is
+$    f.%DriverFunction((%Castpp)%TCall_CSFDB_Get%NameField%Field(%VDim));
+@end;
+
+@template CSFDBCallWritePersistentArray(%Field,%NameField,%TCall,%VDim,%Cast) is
+$    theSchema->WritePersistentReference((%Castpp)%TCall_CSFDB_Get%NameField%Field(%VDim),f);
+@end;
+
+@template CSFDBCallWriteStorableArray(%Schema,%Type,%Field,%NameField,%TCall,%VDim,%Cast) is
+$    %Schema_%Type::SWrite((%Castpp)%TCall_CSFDB_Get%NameField%Field(%VDim),f,theSchema);
+@end;
+
+@template CSFDBWRITEARRAYcpp(%Schema,%Type,%LocalVar,%ForW,%Body) is
+$  Standard_Integer %LocalVar;
+$
+$%ForW {
+$%Body
+$  }
+@end;
+
+@template CSFDBReadPrimitiveArray(%Type,%Field,%NameField,%Convert,%TCall,%VDim) is
+$  %Type %NameField%Field;
+$
+$  %Convert(%NameField%Field);
+$  pp%TCall_CSFDB_Get%NameField%Field(%VDim) = %NameField%Field;
+@end;
+
+@template CSFDBReadEnumArray(%Type,%Field,%NameField,%Convert,%TCall,%VDim) is
+$  %Type %NameField%Field;
+$  Standard_Integer i_CSFDB_%NameField%Field;
+$
+$  %Convert(i_CSFDB_%NameField%Field);
+$  %NameField%Field = (%Type)i_CSFDB_%NameField%Field;
+$  pp%TCall_CSFDB_Get%NameField%Field(%VDim) = %NameField%Field;
+@end;
+
+@template CSFDBReadPersistentArray(%Type,%Field,%NameField,%TCall,%VDim) is
+$    Handle(%Type) %NameField%Field;
+$
+$    theSchema->ReadPersistentReference(%NameField%Field,f);
+$    pp%TCall_CSFDB_Get%NameField%Field(%VDim) = %NameField%Field;
+@end;
+
+@template CSFDBReadStorableArray(%Schema,%Type,%Field,%NameField,%TCall,%VDim) is
+$    %Schema_%Type::SRead((%Type&)pp%TCall_CSFDB_Get%NameField%Field(%VDim),f,theSchema);
+@end;
+
+@template CSFDBREADARRAYcpp(%Schema,%Type,%LocalVar,%ForR,%Body) is
+$  Standard_Integer %LocalVar;
+$   
+$%ForR {
+$%Body
+$}
+@end;
+--
+-- ------------- C++ Array
+@template CSFDBTypeMgt(%Schema) is
+$
+$Handle_Standard_Type& %Schema_Type_()
+${
+$
+$  static Handle_Standard_Type tSchema = STANDARD_TYPE(%Schema); 
+$  static Handle_Standard_Type bSchema = STANDARD_TYPE(Storage_Schema);
+$
+$  static Handle_Standard_Transient _Ancestors[]= {tSchema,bSchema,NULL};
+$  static Handle_Standard_Type _aType = new Standard_Type("%Schema",
+$                                                       sizeof(%Schema),
+$                                                       1,
+$                                                       (Standard_Address)_Ancestors,
+$                                                       (Standard_Address)NULL);
+$
+$  return _aType;
+$}
+$
+@end;
+
+@template CSFDBCallBackTypeMgt(%Schema,%Type) is
+$
+$Handle_Standard_Type& %Schema_%Type_Type_()
+${
+$
+$  static Handle_Standard_Type tSchema = STANDARD_TYPE(%Schema_%Type); 
+$  static Handle_Standard_Type bSchema = STANDARD_TYPE(Storage_CallBack);
+$
+$  static Handle_Standard_Transient _Ancestors[]= {tSchema,bSchema,NULL};
+$  static Handle_Standard_Type _aType = new Standard_Type("%Schema_%Type",
+$                                                       sizeof(%Schema_%Type),
+$                                                       1,
+$                                                       (Standard_Address)_Ancestors,
+$                                                       (Standard_Address)NULL);
+$
+$  return _aType;
+$}
+$
+$const Handle(%Schema_%Type) Handle(%Schema_%Type)::DownCast(const Handle(Storage_CallBack)& AnObject) {
+$  Handle(%Schema_%Type) _anOtherObject;
+$
+$  if (!AnObject.IsNull()) {
+$     if (AnObject->IsKind(STANDARD_TYPE(%Schema_%Type))) {
+$       _anOtherObject = Handle(%Schema_%Type)((Handle(%Schema_%Type)&)AnObject);
+$     }
+$  }
+$
+$  return _anOtherObject ;
+$}
+$
+$Standard_Boolean %Schema_%Type::IsKind(const Handle(Standard_Type)& AType) const { 
+$  return (STANDARD_TYPE(%Schema_%Type) == AType || Storage_CallBack::IsKind(AType)); 
+$}
+$
+$const Handle(Standard_Type)& %Schema_%Type::DynamicType() const { 
+$  return STANDARD_TYPE(%Schema_%Type) ; 
+$}
+@end;
+
+@template CSFDBClassDeclaration (%Type) is
+$class %Type;
+@end;
+
+@template CSFDBHandleDeclaration (%Type) is
+$class Handle_%Type;
+@end;
diff --git a/src/CSFDBSchema/FILES b/src/CSFDBSchema/FILES
new file mode 100755 (executable)
index 0000000..c783439
--- /dev/null
@@ -0,0 +1,3 @@
+CSFDBSchema.cxx
+CSFDBSchema_Template.edl
+FILES