--- /dev/null
+// CLE : Extracteur C++ pour CAS.CADE
+// Matra-Datavision 1995
+//
+// 10/1995
+//
+#include <CPPExt.hxx>
+#include <WOKTools_Messages.hxx>
+#include <MS_ParamWithValue.hxx>
+#include <MS_HArray1OfParam.hxx>
+
+// Standard Extractor API : list the EDL files used by this program
+//
+Handle(TColStd_HSequenceOfHAsciiString) CPP_TemplatesUsed()
+{
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+
+ result->Append(new TCollection_HAsciiString("CPPExt_Template.edl"));
+ result->Append(new TCollection_HAsciiString("CPPExt_TemplateOBJY.edl"));
+ result->Append(new TCollection_HAsciiString("CPPExt_TemplateCSFDB.edl"));
+ result->Append(new TCollection_HAsciiString("CPPExt_TemplateOBJS.edl"));
+
+ return result;
+}
+
+
+Handle(EDL_API)& CPP_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("CPPExt_Template.edl") != EDL_NORMAL) {
+ ErrorMsg << "CPPExt" << "unable to load : CPPExt_Template.edl" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ if (api->Execute("CPPExt_TemplateOBJY.edl") != EDL_NORMAL) {
+ ErrorMsg << "CPPExt" << "unable to load : CPPExt_TemplateOBJY.edl" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ if (api->Execute("CPPExt_TemplateCSFDB.edl") != EDL_NORMAL) {
+ ErrorMsg << "CPPExt" << "unable to load : CPPExt_TemplateCSFDB.edl" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ if (api->Execute("CPPExt_TemplateOBJS.edl") != EDL_NORMAL) {
+ ErrorMsg << "CPPExt" << "unable to load : CPPExt_TemplateOBJS.edl" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ }
+
+ // full path of the destination directory
+ //
+ api->AddVariable(VFullPath,outdir->ToCString());
+
+ // templates for methods extraction
+ //
+ api->AddVariable(VMethodHeader,"MethodHeader");
+ api->AddVariable(VConstructorHeader,"ConstructorHeader");
+
+ // DBMS extraction type
+ //
+ api->AddVariable("%CPPEXTDBMS",DBMS);
+
+ return api;
+}
+
+// write the content of a variable into a file
+//
+void CPP_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");
+}
+
+
+// sort the used types :
+//
+// FullList : all the used types
+// List : the types that must have a full definition
+// Incp : the types that only have to be declared
+//
+void CPP_UsedTypes(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Common)& aCommon,
+ const Handle(TColStd_HSequenceOfHAsciiString)& List,
+ const Handle(TColStd_HSequenceOfHAsciiString)& Incp)
+{
+ if (aCommon->IsKind(STANDARD_TYPE(MS_Type))) {
+ if (aCommon->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) aClass = *((Handle(MS_Class)*)&aCommon);
+
+ MS::ClassUsedTypes(aMeta,aClass,List,Incp);
+ }
+ }
+}
+
+// build a return, parameter or field type in c++
+// return a <type name> or a Handle_<type name>
+//
+Handle(TCollection_HAsciiString) CPP_BuildType(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aTypeName)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Type) aType;
+
+ if (aMeta->IsDefined(aTypeName)) {
+ aType = aMeta->GetType(aTypeName);
+
+ if (aType->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&aType);
+
+ aType = aMeta->GetType(analias->DeepType());
+ }
+
+ if (aType->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) aClass;
+
+ aClass = *((Handle(MS_Class)*)&aType);
+
+ if (aClass->IsPersistent() || aClass->IsTransient()) {
+ result->AssignCat("Handle_");
+ result->AssignCat(aTypeName);
+ }
+ else {
+ result->AssignCat(aTypeName);
+ }
+ }
+ else {
+ result->AssignCat(aTypeName);
+ }
+ }
+ else {
+ ErrorMsg << "CPPExt" << "type " << aType->FullName()->ToCString() << " not defined..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ return result;
+}
+
+// Build a c++ field
+//
+Handle(TCollection_HAsciiString) CPP_BuildField(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Field)& aField)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Type) aType;
+ Handle(TColStd_HSequenceOfInteger) dim;
+ Standard_Integer i;
+
+ result->AssignCat(CPP_BuildType(aMeta,aField->TYpe()));
+ result->AssignCat(" ");
+ result->AssignCat(aField->Name());
+
+ dim = aField->Dimensions();
+
+ for (i = 1; i <= dim->Length(); i++) {
+ result->AssignCat("[");
+ result->AssignCat(new TCollection_HAsciiString(dim->Value(i)));
+ result->AssignCat("]");
+ }
+
+ result->AssignCat(";\n");
+
+ return result;
+}
+
+// Build a parameter list for methods
+// the output is in C++
+//
+Handle(TCollection_HAsciiString) CPP_BuildParameterList(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_HArray1OfParam)& aSeq,
+ const Standard_Boolean withDefaultValue)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Type) aType;
+ Handle(MS_Class) aClass;
+
+ if(!aSeq.IsNull()) {
+ for (i = 1; i <= aSeq->Length(); i++) {
+ if (i > 1) {
+ result->AssignCat(",");
+ }
+
+ if (!aSeq->Value(i)->IsOut()) {
+ result->AssignCat("const ");
+ }
+
+ if (aMeta->IsDefined(aSeq->Value(i)->TypeName())) {
+ aType = aMeta->GetType(aSeq->Value(i)->TypeName());
+
+ if (aType->IsKind(STANDARD_TYPE(MS_Class))) {
+ aClass = *((Handle(MS_Class)*)&aType);
+
+ if (aClass->IsPersistent() || aClass->IsTransient()) {
+ result->AssignCat("Handle(");
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ result->AssignCat(")& ");
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ else {
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ result->AssignCat("& ");
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ } // CLASS ^
+ else if ((aType->IsKind(STANDARD_TYPE(MS_Imported)) || aType->IsKind(STANDARD_TYPE(MS_Pointer)) || aSeq->Value(i)->IsItem() || aSeq->Value(i)->IsOut()) && !(aType->IsKind(STANDARD_TYPE(MS_Alias)))) {
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ result->AssignCat("& ");
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ // WARNING : ALIASES
+ //
+ else if (aType->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&aType);
+ Handle(TCollection_HAsciiString) deeptype = analias->DeepType();
+
+ if (aMeta->IsDefined(deeptype)) {
+ Handle(MS_Type) dt = aMeta->GetType(deeptype);
+
+
+ if (dt->IsKind(STANDARD_TYPE(MS_Class))) {
+ aClass = *((Handle(MS_Class)*)&dt);
+
+ if (aClass->IsPersistent() || aClass->IsTransient()) {
+ result->AssignCat("Handle(");
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ result->AssignCat(")& ");
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ else {
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ result->AssignCat("& ");
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ }
+ else if (dt->IsKind(STANDARD_TYPE(MS_Imported)) || dt->IsKind(STANDARD_TYPE(MS_Pointer)) || aSeq->Value(i)->IsItem() || aSeq->Value(i)->IsOut()) {
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ result->AssignCat("& ");
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ else {
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ if (aSeq->Value(i)->IsOut()) {
+ result->AssignCat("& ");
+ }
+ else {
+ result->AssignCat(" ");
+ }
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ }
+ else {
+ ErrorMsg << "CPPExt" << "incomplete alias deep type in method's parameter..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ }
+ else {
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ if (aSeq->Value(i)->IsOut()) {
+ result->AssignCat("& ");
+ }
+ else {
+ result->AssignCat(" ");
+ }
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+ }
+ else {
+ result->AssignCat(aSeq->Value(i)->TypeName());
+ result->AssignCat("& ");
+ result->AssignCat(aSeq->Value(i)->Name());
+ }
+
+ if (aSeq->Value(i)->GetValueType() != MS_NONE && withDefaultValue) {
+ MS_ParamWithValue* pwv = (MS_ParamWithValue*)aSeq->Value(i).operator->();
+ result->AssignCat(" = ");
+ result->AssignCat(pwv->GetValue());
+ }
+ }
+ }
+ return result;
+}
+
+// build a c++ declaration method
+// the result is in the EDL variable VMethod
+//
+// template used :
+//
+// MethodTemplateDef
+// ConstructorTemplateDef
+// MethodTemplateDec
+// ConstructorTemplateDec
+// InlineMethodTemplateDec
+//
+// the EDL variables :
+// VMethodHeader : must contains the name of the template used for
+// methods construction
+// VConstructorHeader : must contains the name of the template used for
+// constructors construction
+//
+void CPP_BuildMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& m,
+ const Handle(TCollection_HAsciiString)& methodName,
+ const Standard_Boolean forDeclaration = Standard_True)
+{
+ Handle(MS_InstMet) im;
+ Handle(MS_ClassMet) cm;
+ Handle(MS_Construc) ct;
+ Handle(MS_Param) retType;
+
+ Handle(TCollection_HAsciiString) MetTemplate,
+ ConTemplate;
+
+ Standard_Boolean InlineMethod;
+
+ MetTemplate = api->GetVariableValue(VMethodHeader);
+ ConTemplate = api->GetVariableValue(VConstructorHeader);
+
+ // here we process all the common attributes of methods
+ //
+ api->AddVariable(VMethodName,methodName->ToCString());
+ api->AddVariable(VVirtual,"");
+
+ // it s inline method ?
+ //
+ if (m->IsInline()) {
+ api->AddVariable(VIsInline,"yes");
+ InlineMethod = Standard_True;
+ }
+ else {
+ InlineMethod = Standard_False;
+ api->AddVariable(VIsInline,"no");
+ }
+
+ // it s returning const ?
+ //
+ if (m->IsConstReturn()) {
+ api->AddVariable(VRetSpec,"const");
+ }
+ else {
+ api->AddVariable(VRetSpec,"");
+ }
+
+ // it s returning & ?
+ //
+ if (m->IsRefReturn()) {
+ api->AddVariable(VAnd,"&");
+ }
+ else {
+ api->AddVariable(VAnd,"");
+ }
+
+ api->AddVariable(VArgument,CPP_BuildParameterList(aMeta,m->Params(),forDeclaration)->ToCString());
+
+ // it s returning a type or void
+ //
+ retType = m->Returns();
+
+ if (!retType.IsNull()) {
+ api->AddVariable(VReturn,CPP_BuildType(aMeta,retType->TypeName())->ToCString());
+ }
+ else {
+ api->AddVariable(VReturn,"void");
+ }
+
+ // now the specials attributes
+ //
+ // instance methods
+ //
+ if (m->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ im = *((Handle(MS_InstMet)*)&m);
+
+ api->AddVariable(VIsCreateMethod,"no");
+
+ if (!im->IsDeferred() || !forDeclaration) {
+ if (!im->IsStatic() && forDeclaration) {
+ api->AddVariable(VVirtual,"virtual");
+ }
+
+ if (im->IsConst()) {
+ api->AddVariable(VMetSpec,"const");
+ }
+ else {
+ api->AddVariable(VMetSpec,"");
+ }
+ }
+ else if (forDeclaration) {
+ api->AddVariable(VVirtual,"virtual");
+
+ if (im->IsConst()) {
+ api->AddVariable(VMetSpec,"const = 0");
+ }
+ else {
+ api->AddVariable(VMetSpec," = 0");
+ }
+ }
+
+ api->Apply(VMethod,MetTemplate->ToCString());
+
+ if (InlineMethod) {
+ api->Apply(VMethod,"InlineMethodTemplateDec");
+ }
+ }
+ //
+ // class methods
+ //
+ else if (m->IsKind(STANDARD_TYPE(MS_ClassMet))) {
+ api->AddVariable(VIsCreateMethod,"no");
+ api->AddVariable(VMetSpec,"");
+ if (forDeclaration) {
+ api->AddVariable(VVirtual,"static");
+ }
+ api->Apply(VMethod,MetTemplate->ToCString());
+
+ if (InlineMethod) {
+ api->Apply(VMethod,"InlineMethodTemplateDec");
+ }
+ }
+ //
+ // constructors
+ //
+ else if (m->IsKind(STANDARD_TYPE(MS_Construc))) {
+ api->AddVariable(VIsCreateMethod,"yes");
+ api->Apply(VMethod,ConTemplate->ToCString());
+
+ if (InlineMethod) {
+ api->Apply(VMethod,"InlineMethodTemplateDec");
+ }
+ }
+ //
+ // package methods
+ //
+ else if (m->IsKind(STANDARD_TYPE(MS_ExternMet))) {
+ api->AddVariable(VIsCreateMethod,"no");
+ api->AddVariable(VMetSpec,"");
+ if (forDeclaration) {
+ api->AddVariable(VVirtual,"static");
+ }
+
+ api->Apply(VMethod,MetTemplate->ToCString());
+ if (InlineMethod) {
+ api->Apply(VMethod,"InlineMethodTemplateDec");
+ }
+ }
+}
+
+// build an INLINE "function call" body method for "C++: function call" comment
+//
+Handle(TCollection_HAsciiString) CPP_BuildFunctionCall(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_MemberMet)& method,
+ const Standard_Boolean isInlineMode)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Param) retType;
+ Standard_Integer i;
+ Handle(MS_Type) type;
+ Standard_CString calltype;
+
+ type = aMeta->GetType(method->Class());
+
+ if (type->IsKind(STANDARD_TYPE(MS_StdClass))) {
+ Handle(MS_StdClass) stdclass = *((Handle(MS_StdClass)*)&type);
+
+ if (stdclass->IsTransient() || stdclass->IsPersistent()) {
+ calltype = "->";
+ }
+ else {
+ calltype = ".";
+ }
+ }
+
+ // for inline function mode
+ //
+ if (isInlineMode) {
+ result->AssignCat("inline ");
+ }
+
+ // it s returning a type or void
+ //
+ retType = method->Returns();
+
+ if (!retType.IsNull()) {
+ if (method->IsConstReturn()) {
+ result->AssignCat("const ");
+ }
+
+ result->AssignCat(CPP_BuildType(aMeta,retType->TypeName()));
+
+ if (method->IsRefReturn()) {
+ result->AssignCat("& ");
+ }
+ }
+ else {
+ result->AssignCat( "void");
+ }
+
+ result->AssignCat(" ");
+ result->AssignCat(method->Name());
+ result->AssignCat("(");
+
+ if (method->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ Handle(MS_InstMet) im = *((Handle(MS_InstMet)*)&method);
+
+ // if immutable
+ //
+ if (im->IsConst()) {
+ result->AssignCat("const ");
+ }
+ }
+
+ result->AssignCat(CPP_BuildType(aMeta,method->Class()));
+ result->AssignCat("& me");
+
+ if (!method->Params().IsNull()) {
+ result->AssignCat(",");
+ result->AssignCat(CPP_BuildParameterList(aMeta,method->Params(),Standard_True));
+ }
+
+
+ result->AssignCat(") {\n");
+
+ if (!retType.IsNull()) {
+ result->AssignCat(" return");
+ }
+
+ result->AssignCat(" me");
+ result->AssignCat(calltype);
+ result->AssignCat(method->Name());
+ result->AssignCat("(");
+
+ if (!method->Params().IsNull()) {
+ result->AssignCat(method->Params()->Value(1)->Name());
+ for (i = 2; i <= method->Params()->Length(); i++) {
+ result->AssignCat(",");
+ result->AssignCat(method->Params()->Value(i)->Name());
+ }
+ }
+ result->AssignCat(");\n");
+
+ result->AssignCat("}\n\n");
+
+ return result;
+}
+
+// build a method from a "---C++: alias" comment
+//
+Handle(TCollection_HAsciiString) CPP_BuildAliasMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_MemberMet)& method)
+{
+ Handle(TCollection_HAsciiString) result;
+
+ if (!method->IsDestructor() && !method->IsFunctionCall()) {
+ result = new TCollection_HAsciiString(method->IsAlias());
+ }
+ else {
+ result = new TCollection_HAsciiString("~");
+ result->AssignCat(method->Class());
+ result->AssignCat("()");
+ }
+ // alias is kind : "void *new(size_t);"
+ // we only need to kill the quotes
+ //
+ if (method->IsQuotedAlias() && !method->IsDestructor()) {
+ result->Remove(1);
+ if (result->Value(result->Length()) == '"') {
+ result->Remove(result->Length());
+ }
+ result->AssignCat("\n");
+ }
+ // C++: function call
+ //
+ else if (method->IsFunctionCall()) {
+ result = CPP_BuildFunctionCall(aMeta,api,method,Standard_True); // <-- Standard_True = inline mode
+ }
+ else {
+ Handle(TCollection_HAsciiString) body = new TCollection_HAsciiString;
+ Handle(MS_HArray1OfParam) aSeq = method->Params();
+ Standard_Integer i;
+
+ if (!method->IsDestructor()) {
+ CPP_BuildMethod(aMeta,api,method,result,Standard_False);
+ }
+ else {
+ api->AddVariable(VMethod,result->ToCString());
+ }
+
+ result = api->GetVariableValue(VMethod);
+
+ if (!method->Returns().IsNull()) {
+ body->AssignCat("return ");
+ }
+
+ body->AssignCat(method->Name());
+ body->AssignCat("(");
+
+ if(!aSeq.IsNull()) {
+ for (i = 1; i < aSeq->Length(); i++) {
+ body->AssignCat(aSeq->Value(i)->Name());
+ body->AssignCat(",");
+ }
+
+ body->AssignCat(aSeq->Value(aSeq->Length())->Name());
+ }
+ body->AssignCat(");");
+
+ api->AddVariable(VMBody,body->ToCString());
+ api->Apply(VMethod,"MethodTemplateDef");
+
+ result = api->GetVariableValue(VMethod);
+ }
+
+ return result;
+}
+
+
+// Build the list of friends methods and set the result at the end of
+// publics
+//
+Standard_Boolean CPP_SetFriendMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(TColStd_HSequenceOfHAsciiString)& FriendMets,
+ const Handle(TCollection_HAsciiString)& publics)
+{
+ if (publics.IsNull()) return Standard_False;
+
+ Handle(MS_Method) friendmethod;
+ Standard_Integer i;
+ Standard_Boolean result = Standard_True;
+ Handle(TCollection_HAsciiString) aname,
+ oldclass = api->GetVariableValue(VClass);
+
+ // templates for methods extraction
+ //
+ api->AddVariable(VMethodHeader,"ExternalMethodHeader");
+ api->AddVariable(VConstructorHeader,"ExternalConstructorHeader");
+
+ for (i = 1; i <= FriendMets->Length(); i++) {
+ friendmethod.Nullify();
+ friendmethod = MS::GetMethodFromFriendName(aMeta,FriendMets->Value(i));
+
+ if (!friendmethod.IsNull()) {
+ aname = FriendMets->Value(i)->Token(":");
+ api->AddVariable(VClass,aname->ToCString());
+ publics->AssignCat("friend ");
+ CPP_BuildMethod(aMeta,api,friendmethod,friendmethod->Name(),Standard_False);
+ api->Apply(VMethod,"MethodTemplateDec");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+ else {
+ result = Standard_False;
+ }
+ }
+
+ // templates for methods extraction
+ //
+ api->AddVariable(VMethodHeader,"MethodHeader");
+ api->AddVariable(VConstructorHeader,"ConstructorHeader");
+ api->AddVariable(VClass,oldclass->ToCString());
+
+ return result;
+}
+
+// create the defines and the undefines that are around the include of
+// a generic .lxx
+// ex. :
+// #define ItemHArray1 Quantity_Color
+// #define ItemHArray1_hxx <Quantity_Color.hxx>
+// #define TheArray1 Quantity_Array1OfColor
+// #define TheArray1_hxx <Quantity_Array1OfColor.hxx>
+// #define TCollection_HArray1 Quantity_HArray1OfColor
+// #define TCollection_HArray1_hxx <Quantity_HArray1OfColor.hxx>
+// #include <TCollection_HArray1.lxx>
+// #undef ItemHArray1
+// #undef ItemHArray1_hxx
+// #undef TheArray1
+// #undef TheArray1_hxx
+// #undef TCollection_HArray1
+// #undef TCollection_HArray1_hxx
+//
+void CPP_GenericDefine(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_InstClass)& aCreator,
+ const Standard_CString VARDefine,
+ const Standard_CString VARUndefine,
+ const Standard_Boolean handleUsed)
+{
+ Handle(MS_GenClass) aGenClass = Handle(MS_GenClass)::DownCast(aMeta->GetType(aCreator->GenClass()));
+ Handle(TColStd_HSequenceOfHAsciiString) theGenTypes = aCreator->GenTypes();
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Standard_Integer i,
+ itemLength;
+ Handle(MS_HSequenceOfGenType) realGentypes = aGenClass->GenTypes();
+
+ // we need this length because for item we must call
+ // CPP_BuildType and for nested class name we dont need.
+ //
+ itemLength = aGenClass->GenTypes()->Length();
+
+ for (i = 1; i <= theGenTypes->Length(); i++) {
+ if (!aGenClass->FullName()->IsSameString(theGenTypes->Value(i))) {
+ api->AddVariable(VDName,theGenTypes->Value(i)->ToCString());
+
+ // real name or Handle_name
+ //
+ if (i <= itemLength) {
+ if (!realGentypes->Value(i)->TYpeName().IsNull()) {
+ if (aMeta->IsDefined(realGentypes->Value(i)->TYpeName())) {
+ Handle(MS_Type) t = aMeta->GetType(realGentypes->Value(i)->TYpeName());
+
+ if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) c = *((Handle(MS_Class)*)&t);
+
+ // if the items constraint is handled, the item is not the handle,
+ // like in other cases, but the type himself.
+ //
+ // ex. : the item : 'i' as transient
+ // will be defined as #define i class
+ // the item : 'i' as any
+ // will be defined as #define i Handle_Class
+ //
+ if (c->IsPersistent() || c->IsTransient()) {
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->Apply(VARDefine,"ItemConstraintHandle");
+ api->Apply(VARUndefine,"ItemConstraintHandleUndef");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ else {
+ api->AddVariable(VDValue,CPP_BuildType(aMeta,aCreator->InstTypes()->Value(i))->ToCString());
+ }
+ }
+ }
+ }
+ else {
+ api->AddVariable(VDValue,CPP_BuildType(aMeta,aCreator->InstTypes()->Value(i))->ToCString());
+ }
+ api->AddVariable("%DBaseValue",aCreator->InstTypes()->Value(i)->ToCString());
+ }
+ // real name
+ //
+ else {
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->AddVariable("%DBaseValue",aCreator->InstTypes()->Value(i)->ToCString());
+ }
+
+ api->Apply(VARDefine,"ItemDefine");
+ api->Apply(VARUndefine,"ItemUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ }
+
+ for (i = itemLength + 1; i <= theGenTypes->Length(); i++) {
+ if (!aGenClass->FullName()->IsSameString(theGenTypes->Value(i))) {
+ Handle(TCollection_HAsciiString) realName = CPP_BuildType(aMeta,aCreator->InstTypes()->Value(i));
+
+ if (!realName->IsSameString(aCreator->InstTypes()->Value(i))) {
+ api->AddVariable(VDName,theGenTypes->Value(i)->ToCString());
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->Apply(VARDefine,"ItemHandleDefine");
+ api->Apply(VARUndefine,"ItemHandleUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ }
+ }
+
+ api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+ api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+ api->AddVariable("%DBaseValue",aCreator->FullName()->ToCString());
+
+ api->Apply(VARDefine,"ItemDefine");
+ api->Apply(VARUndefine,"ItemUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+
+ // #define TCollection_HSequence_Type_() TColStd_HSequenceOfTransient_Type_()
+ // #define Handle_TCollection_HSequence Handle_TColStd_HSequenceOfTransient
+ //
+ if (aGenClass->IsTransient() || aGenClass->IsPersistent()) {
+ api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+ api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+ api->Apply(VARDefine,"ItemHandleDefine");
+ api->Apply(VARUndefine,"ItemHandleUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+
+ api->AddVariable(VARDefine,publics->ToCString());
+ api->AddVariable(VARUndefine,protecteds->ToCString());
+}
+
+
+
+void CPP_ClassTypeMgt(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Standard_CString var)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) inh = aClass->GetFullInheritsNames();
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) ichar;
+ Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) str1 = new TCollection_HAsciiString;
+
+ for (i = 1; i <= inh->Length(); i++) {
+ ichar = new TCollection_HAsciiString(i);
+
+ api->AddVariable(VNb,ichar->ToCString());
+ api->Apply(VNb,"TypeMgtAncestorType");
+
+ str1->AssignCat(api->GetVariableValue(VNb));
+ str1->AssignCat(",");
+
+ api->AddVariable(VAncestors,inh->Value(i)->ToCString());
+ api->Apply(VInherits,"TypeMgtAncestor");
+ str->AssignCat(api->GetVariableValue(VInherits));
+ }
+
+ api->AddVariable(VInherits,str->ToCString());
+ api->AddVariable(VAncestors,str1->ToCString());
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->Apply(var,"TypeMgt");
+}
+
+
+// Standard extractor API : launch the extraction of C++ files
+// from the type <aName>
+//
+void CPP_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_Type) srcType;
+ Handle(MS_Package) srcPackage;
+
+
+ // before begining, we look if the entity has something to extract...
+ //
+ if (aMeta->IsDefined(aName)) {
+ srcType = aMeta->GetType(aName);
+ }
+ else if (aMeta->IsPackage(aName)) {
+ srcPackage = aMeta->GetPackage(aName);
+ }
+ else {
+ ErrorMsg << "CPPExt" << aName->ToCString() << " not defined..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ // ... and we load the templates
+ //
+ Handle(EDL_API) api;
+
+ // Package Extraction
+ //
+ if (!srcPackage.IsNull()) {
+ if (srcPackage->Methods()->Length() > 0) {
+ api = CPP_LoadTemplate(edlsfullpath,outdir,DBMS);
+ CPP_Package(aMeta,api,srcPackage,outfile);
+ }
+ else {
+ return;
+ }
+ }
+ // Extraction of Classes
+ //
+ else if (srcType->IsKind(STANDARD_TYPE(MS_StdClass)) && !srcType->IsKind(STANDARD_TYPE(MS_GenClass)) && !srcType->IsKind(STANDARD_TYPE(MS_InstClass))) {
+ Handle(MS_StdClass) aClass = *((Handle(MS_StdClass)*)&srcType);
+
+ if (aClass->Incomplete()) {
+ ErrorMsg << "CPPExt" << aName->ToCString() << " not complete..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ if (aClass->IsGeneric()) {
+ return;
+ }
+
+ api = CPP_LoadTemplate(edlsfullpath,outdir,DBMS);
+
+ // Transient classes
+ //
+ if (aClass->IsTransient() && !aName->IsSameString(MS::GetTransientRootName())) {
+ Handle(TCollection_HAsciiString) aHandleFile = new TCollection_HAsciiString(outdir);
+
+ aHandleFile->AssignCat("Handle_");
+ aHandleFile->AssignCat(aName);
+ aHandleFile->AssignCat(".hxx");
+
+ outfile->Append(aHandleFile);
+
+ if (aClass->GetInheritsNames()->Length() == 0) {
+ ErrorMsg << "CPPExt" << "incomplete metaschema..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ CPP_TransientHandle(api,aName,aClass->GetInheritsNames()->Value(1),aHandleFile);
+
+ if (aClass->IsKind(STANDARD_TYPE(MS_Error))) {
+ CPP_ExceptionClass(aMeta,api,aClass,outfile);
+ }
+ else {
+ CPP_TransientClass(aMeta,api,aClass,outfile);
+ }
+ }
+ // Persistent classes
+ //
+ else if (aClass->IsPersistent() && !aName->IsSameString(MS::GetPersistentRootName())) {
+ Handle(TCollection_HAsciiString) aHandleFile = new TCollection_HAsciiString(outdir);
+
+ aHandleFile->AssignCat("Handle_");
+ aHandleFile->AssignCat(aName);
+ aHandleFile->AssignCat(".hxx");
+
+ outfile->Append(aHandleFile);
+
+ if (aClass->GetInheritsNames()->Length() == 0) {
+ ErrorMsg << "CPPExt" << "incomplete metaschema..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJY")) {
+ CPP_PersistentHandleOBJY(api,aName,aClass->GetInheritsNames()->Value(1),aHandleFile);
+ CPP_PersistentClassOBJY(aMeta,api,aClass,outfile);
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"MEM")) {
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJS")) {
+ CPP_PersistentHandleOBJS(api,aName,aClass->GetInheritsNames()->Value(1),aHandleFile);
+ CPP_PersistentClassOBJS(aMeta,api,aClass,outfile);
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OO2")) {
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"CSFDB")) {
+ CPP_PersistentHandleCSFDB(api,aName,aClass->GetInheritsNames()->Value(1),aHandleFile);
+ CPP_PersistentClassCSFDB(aMeta,api,aClass,outfile);
+ }
+ }
+ // Storable classes
+ //
+ else if (aClass->IsStorable()) {
+ CPP_StorableClass(aMeta,api,aClass,outfile);
+ }
+ // MPV classes
+ //
+ else {
+ CPP_MPVClass(aMeta,api,aClass,outfile);
+ }
+ }
+ // Enumerations
+ //
+ else if (srcType->IsKind(STANDARD_TYPE(MS_Enum))) {
+ Handle(MS_Enum) anEnum = *((Handle(MS_Enum)*)&srcType);
+
+ api = CPP_LoadTemplate(edlsfullpath,outdir,DBMS);
+ CPP_Enum(aMeta,api,anEnum,outfile);
+ }
+ // Aliases
+ //
+ else if (srcType->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(MS_Alias) anAlias = *((Handle(MS_Alias)*)&srcType);
+
+ api = CPP_LoadTemplate(edlsfullpath,outdir,DBMS);
+ CPP_Alias(aMeta,api,anAlias,outfile);
+ }
+ else if (srcType->IsKind(STANDARD_TYPE(MS_Pointer))) {
+ Handle(MS_Pointer) aPointer = *((Handle(MS_Pointer)*)&srcType);
+
+ api = CPP_LoadTemplate(edlsfullpath,outdir,DBMS);
+ CPP_Pointer(aMeta,api,aPointer,outfile);
+ }
+}
+
--- /dev/null
+#ifndef _CPPExt_HeaderFile
+#define _CPPExt_HeaderFile
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+#include <MS_Alias.hxx>
+#include <MS_Pointer.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#ifndef _Standard_Macro_HeaderFile
+# include <Standard_Macro.hxx>
+#endif
+
+extern "C" {
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) CPP_TemplatesUsed();
+
+ void Standard_EXPORT CPP_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);
+
+}
+
+Handle(TCollection_HAsciiString) CPP_BuildType(const Handle(MS_MetaSchema)&,
+ const Handle(TCollection_HAsciiString)&);
+
+void CPP_TransientHandle(const Handle(EDL_API)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&);
+
+
+void CPP_TransientClass(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Class)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_PersistentClassOBJY(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Class)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_PersistentHandleOBJY(const Handle(EDL_API)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&);
+
+void CPP_PersistentClassCSFDB(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Class)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_PersistentHandleCSFDB(const Handle(EDL_API)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&);
+
+void CPP_PersistentClassOBJS(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Class)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_PersistentHandleOBJS(const Handle(EDL_API)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TCollection_HAsciiString)&);
+
+void CPP_ExceptionClass(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Class)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_MPVClass(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Class)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_StorableClass(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Class)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_Enum(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Enum)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_Alias(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Alias)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_Pointer(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Pointer)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_Package(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)&,
+ const Handle(MS_Package)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPP_BuildMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& m,
+ const Handle(TCollection_HAsciiString)& methodName,
+ const Standard_Boolean forDeclaration);
+
+// EDL variables
+//
+Standard_CString VClass = "%Class",
+ VTICIncludes = "%TICIncludes",
+ VInherits = "%Inherits",
+ VTICPublicmets = "%TICPublicmets",
+ VTICPublicfriends = "%TICPublicfriends",
+ VTICProtectedmets = "%TICProtectedmets",
+ VTICProtectedfields = "%TICProtectedfields",
+ VTICPrivatemets = "%TICPrivatemets",
+ VTICPrivatefriends = "%TICPrivatefriends",
+ VTICDefines = "%TICDefines",
+ VTICInlineIncludes = "%TICInlineIncludes",
+ VTICUndefines = "%TICUndefines",
+ VTICPrivatefields = "%TICPrivatefields",
+ VRetSpec = "%RetSpec",
+ VVirtual = "%Virtual",
+ VReturn = "%Return",
+ VAnd = "%And",
+ VMethodName = "%MethodName",
+ VArgument = "%Arguments",
+ VMetSpec = "%MetSpec",
+ VMethod = "%Method",
+ VMBody = "%MBody",
+ VDName = "%DName",
+ VDValue = "%DValue",
+ VIsInline = "%IsInline",
+ VIsCreateMethod = "%IsCreateMethod",
+ VIClass = "%IClass",
+ VSuffix = "%Suffix",
+ VCxxFile = "CxxFile",
+ VLxxFile = "LxxFile",
+ VInlineMethod = "%InlineMethod",
+ VoutClass = "%outClass",
+ VNb = "%Nb",
+ VValues = "%Values",
+ VSupplement = "%Supplement",
+ VTypeMgt = "%TypeMgt",
+ VMethods = "%Methods",
+ VAncestors = "%Ancestors",
+ VFullPath = "%FullPath",
+ VMethodHeader = "%MethodHeader",
+ VConstructorHeader = "%ConstructorHeader",
+ VTICSuppMethod = "%TICSuppMethod";
+
+#endif
--- /dev/null
+// CLE
+//
+// 11/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Alias.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <MS_Class.hxx>
+
+#include <CPPExt_Define.hxx>
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_Alias(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Alias)& anAlias,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ if (anAlias.IsNull()) return;
+
+ Handle(TCollection_HAsciiString) aFileName,
+ realType;
+ Standard_Integer i;
+ Handle(MS_Type) theType,tmpType;
+
+ api->AddVariable(VClass,anAlias->FullName()->ToCString());
+
+ realType = anAlias->Type();
+ Handle(MS_Alias) alias = anAlias;
+
+ while (aMeta->GetType(realType)->IsKind(STANDARD_TYPE(MS_Alias))) {
+ tmpType = aMeta->GetType(realType);
+ alias = *((Handle(MS_Alias)*)&tmpType);
+ realType = alias->Type();
+ }
+
+ theType = aMeta->GetType(realType);
+
+ if (theType->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) aclass = *((Handle(MS_Class)*)&theType);
+
+ if (aclass->IsPersistent() || aclass->IsTransient()) {
+ Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString("typedef ");
+
+ str->AssignCat("Handle_");
+ str->AssignCat(aclass->FullName());
+ str->AssignCat(" Handle_");
+ str->AssignCat(anAlias->FullName());
+ str->AssignCat(";");
+
+ api->AddVariable("%HandleTypedef",str->ToCString());
+ }
+ else {
+ api->AddVariable("%HandleTypedef","");
+ }
+ }
+ else {
+ api->AddVariable("%HandleTypedef","");
+ }
+
+ api->AddVariable(VInherits,realType->ToCString());
+
+ api->Apply(VoutClass,"AliasHXX");
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFileName->AssignCat(anAlias->FullName());
+ aFileName->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ outfile->Append(aFileName);
+}
+
--- /dev/null
+#ifndef _CPPExt_Define_HeaderFile
+#define _CPPExt_Define_HeaderFile
+
+extern Standard_CString VClass,
+ VTICIncludes,
+ VInherits,
+ VTICPublicmets,
+ VTICPublicfriends,
+ VTICProtectedmets,
+ VTICProtectedfields,
+ VTICPrivatemets,
+ VTICPrivatefriends,
+ VTICDefines,
+ VTICInlineIncludes,
+ VTICUndefines,
+ VTICPrivatefields,
+ VTICSuppMethod,
+ VRetSpec,
+ VVirtual,
+ VReturn,
+ VAnd,
+ VMethodName,
+ VArgument,
+ VMetSpec,
+ VMethod,
+ VMBody,
+ VDName,
+ VDValue,
+ VIsInline,
+ VIsCreateMethod,
+ VIClass,
+ VSuffix,
+ VCxxFile,
+ VLxxFile,
+ VInlineMethod,
+ VoutClass,
+ VNb,
+ VValues,
+ VSupplement,
+ VTypeMgt,
+ VMethods,
+ VAncestors,
+ VFullPath,
+ VMethodHeader,
+ VConstructorHeader;
+
+Standard_Boolean CPP_SetFriendMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(TColStd_HSequenceOfHAsciiString)& FriendMets,
+ const Handle(TCollection_HAsciiString)& publics);
+
+
+
+void CPP_WriteFile(const Handle(EDL_API)& api,
+ const Handle(TCollection_HAsciiString)& aFileName,
+ const Standard_CString var);
+
+void CPP_UsedTypes(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Common)& aCommon,
+ const Handle(TColStd_HSequenceOfHAsciiString)& List,
+ const Handle(TColStd_HSequenceOfHAsciiString)& Incp);
+
+Handle(TCollection_HAsciiString) CPP_BuildType(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aTypeName);
+
+Handle(TCollection_HAsciiString) CPP_BuildField(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Field)& aField);
+
+class Handle(MS_HArray1OfParam);
+Handle(TCollection_HAsciiString) CPP_BuildParameterList(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_HArray1OfParam)& aSeq,
+ const Standard_Boolean withDefaultValue);
+
+void CPP_BuildMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& m,
+ const Handle(TCollection_HAsciiString)& methodName,
+ const Standard_Boolean forDeclaration = Standard_True);
+
+Handle(TCollection_HAsciiString) CPP_BuildAliasMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_MemberMet)& method);
+
+void CPP_GenericDefine(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_InstClass)& aCreator,
+ const Standard_CString VARDefine,
+ const Standard_CString VARUndefine,
+ const Standard_Boolean handleUsed);
+
+void CPP_PersistentHandleOBJY(const Handle(EDL_API)& api,
+ const Handle(TCollection_HAsciiString)& aClass,
+ const Handle(TCollection_HAsciiString)& aMother,
+ const Handle(TCollection_HAsciiString)& aFileName);
+
+void CPP_ClassTypeMgt(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Standard_CString var);
+
+#endif
--- /dev/null
+// CLE
+//
+// 11/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Enum.hxx>
+#include <MS_Package.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <CPPExt_Define.hxx>
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_Enum(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Enum)& anEnum,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ if (anEnum.IsNull()) return;
+
+ Handle(TColStd_HSequenceOfHAsciiString) EnumVal = anEnum->Enums();
+ Handle(TCollection_HAsciiString) result,
+ aFileName;
+ Standard_Integer i;
+
+ result = new TCollection_HAsciiString(EnumVal->Length());
+
+ api->AddVariable(VNb,result->ToCString());
+ api->AddVariable(VClass,anEnum->FullName()->ToCString());
+
+ result->Clear();
+
+ i = 1;
+
+ for (; i < EnumVal->Length(); i++) {
+ result->AssignCat(EnumVal->Value(i));
+ result->AssignCat(",\n");
+ }
+
+ if (EnumVal->Length() > 0) {
+ result->AssignCat(EnumVal->Value(i));
+ }
+
+ api->AddVariable(VValues,result->ToCString());
+
+ api->Apply(VoutClass,"EnumHXX");
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFileName->AssignCat(anEnum->FullName());
+ aFileName->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ outfile->Append(aFileName);
+/*
+ result->Clear();
+
+ i = 1;
+
+ for (; i < EnumVal->Length(); i++) {
+ result->AssignCat("\"");
+ result->AssignCat(EnumVal->Value(i));
+ result->AssignCat("\",\n");
+ }
+
+ if (EnumVal->Length() > 0) {
+ result->AssignCat("\"");
+ result->AssignCat(EnumVal->Value(i));
+ result->AssignCat("\"");
+ }
+
+ api->AddVariable(VValues,result->ToCString());
+
+ api->Apply(VoutClass,"EnumCXX");
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFileName->AssignCat(anEnum->FullName());
+ aFileName->AssignCat("_0.cxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ outfile->Append(aFileName);
+*/
+}
+
+
+
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+// Extraction of a transient .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_ExceptionDerivated(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+ api->Apply(VSupplement,"ExceptionMethod");
+
+ supplement->Append(api->GetVariableValue(VSupplement));
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->AddVariable(VSuffix,"hxx");
+
+ CPP_ClassTypeMgt(aMeta,api,aClass,VTypeMgt);
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+
+ aFileName->AssignCat("_0.cxx");
+
+ // Supplement
+ //
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ api->AddVariable(VIClass,MS::GetTransientRootName()->ToCString());
+ api->Apply(VMethods,"DownCast");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"DynamicType");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->AddVariable(VIClass,aClass->GetInheritsNames()->Value(1)->ToCString());
+ api->Apply(VMethods,"IsKind");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"FullEmptyHandleDestructorTemplate");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->AddVariable(VSuffix,"hxx");
+
+ api->AddVariable(VMethods,result->ToCString());
+ api->Apply(VoutClass,"TransientIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_ExceptionClass(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_Error) theClass = Handle(MS_Error)::DownCast(aClass);
+
+ if (!theClass.IsNull()) {
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) FullList = new TColStd_HSequenceOfHAsciiString;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+ api->AddVariable(VInherits,aClass->GetInheritsNames()->Value(1)->ToCString());
+
+ api->Apply(VoutClass,"ExceptionHXX");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(theClass->FullName());
+ aFile->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ CPP_ExceptionDerivated(aMeta,api,aClass,outfile,FullList,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_TransientClass - the class is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+// Extraction of a transient .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_MPVDerivated(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ // we do this only on standard classes (not on inst classes)
+ //
+ if (theClass.IsNull()) return;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= inclist->Length(); i++) {
+ api->AddVariable(VIClass,inclist->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+ }
+
+
+ if (theClass->GetMyCreator().IsNull()) {
+ // include hxx of me
+ //
+ api->AddVariable(VIClass,aClass->FullName()->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+
+ api->AddVariable(VoutClass,result->ToCString());
+
+ aFileName->AssignCat(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+ aFileName->AssignCat(".jxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ result->Clear();
+ outfile->Append(aFileName);
+ }
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ aFileName->AssignCat(".ixx");
+ }
+ else {
+ aFileName->AssignCat("_0.cxx");
+ }
+
+ // Supplement
+ //
+ if (theClass->GetMyCreator().IsNull()) {
+ result->Clear();
+ }
+
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ if (!theClass->GetMyCreator().IsNull()) {
+ CPP_GenericDefine(aMeta,api,theClass->GetMyCreator(),VTICDefines,VTICUndefines,Standard_False);
+ result->AssignCat(api->GetVariableValue(VTICDefines));
+ api->AddVariable(VSuffix,"gxx");
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,theClass->GetMyCreator()->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->Apply(VMethods,"IncludeNoSafe");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+
+ api->AddVariable(VMethods,result->ToCString());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ api->AddVariable(VSuffix,"jxx");
+ }
+ else {
+ api->AddVariable(VSuffix,"hxx");
+ }
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->Apply(VoutClass,"MPVIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_MPVClass(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ if (!theClass.IsNull()) {
+ Standard_Integer i;
+
+ Handle(MS_HSequenceOfMemberMet) methods = theClass->GetMethods();
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privates = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) SuppMethod = new TCollection_HAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+
+ Standard_Boolean HasInlineMethod = Standard_False,
+ HasDestructor = Standard_False;
+
+
+ api->AddVariable(VTICIncludes,"");
+ api->AddVariable(VTICPublicfriends,"");
+ api->AddVariable(VTICProtectedfields,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICDefines,"");
+ api->AddVariable(VTICInlineIncludes,"");
+ api->AddVariable(VTICUndefines,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICPrivatefields,"");
+ api->AddVariable(VSuffix,"");
+ api->AddVariable(VTICSuppMethod,"");
+
+ if (theClass->GetInheritsNames()->Length() > 0) {
+ publics->AssignCat(" : public ");
+ publics->AssignCat(theClass->GetInheritsNames()->Value(1));
+ api->AddVariable(VInherits,publics->ToCString());
+ publics->Clear();
+ }
+ else {
+ api->AddVariable(VInherits,"");
+ }
+
+ api->AddVariable(VClass,theClass->FullName()->ToCString());
+
+ for (i = 1; i <= theClass->GetFriendsNames()->Length(); i++) {
+ publics->AssignCat("friend ");
+ api->AddVariable(VIClass,theClass->GetFriendsNames()->Value(i)->ToCString());
+ api->Apply(VTICPublicfriends,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICPublicfriends));
+ }
+
+ if (!CPP_SetFriendMethod(aMeta,api,theClass->GetFriendMets(),publics)) {
+ ErrorMsg << "CPPExt" << "a friend method was not found..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ api->AddVariable(VTICPublicfriends,publics->ToCString());
+
+ publics->Clear();
+
+ // extraction of the methods
+ //
+ Handle(TCollection_HAsciiString) aliasMethod;
+
+ for (i = 1; i <= methods->Length(); i++) {
+ aliasMethod.Nullify();
+
+ if (methods->Value(i)->IsInline()) {
+ HasInlineMethod = Standard_True;
+ }
+
+ // if the class has no destructor we give it
+ //
+ if (methods->Value(i)->IsDestructor()) {
+ HasDestructor = Standard_True;
+ }
+
+ if (!methods->Value(i)->IsAlias().IsNull() || methods->Value(i)->IsDestructor()) {
+ aliasMethod = CPP_BuildAliasMethod(aMeta,api,methods->Value(i));
+ }
+
+ // Function Call c++ comment :
+ // it s must be in the _0.cxx or ixx file
+ // so we add it in the supplement sequence
+ //
+ if (methods->Value(i)->IsFunctionCall()) {
+ SuppMethod->AssignCat(CPP_BuildAliasMethod(aMeta,api,methods->Value(i)));
+ }
+
+ CPP_BuildMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+
+#ifdef WNT
+ if ( !methods -> Value ( i ) -> IsInline () )
+#endif // WNT
+ api->Apply(VMethod,"MethodTemplateDec");
+#ifdef WNT
+ else
+ api->Apply(VMethod,"MethodTemplateDecInlineWNT" );
+#endif // WNT
+
+ if (methods->Value(i)->Private()) {
+ privates->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ privates->AssignCat(aliasMethod);
+ }
+ }
+ else if ((theClass->Deferred() && methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) ||
+ methods->Value(i)->IsProtected()) {
+ protecteds->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ protecteds->AssignCat(aliasMethod);
+ }
+ }
+ else {
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ publics->AssignCat(aliasMethod);
+ }
+ }
+ }
+
+ api->AddVariable(VTICPublicmets,publics->ToCString());
+ api->AddVariable(VTICPrivatemets,privates->ToCString());
+ api->AddVariable(VTICProtectedmets,protecteds->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+
+ // extraction of fields
+ //
+ Handle(MS_HSequenceOfField) fields = theClass->GetFields();
+
+ for (i = 1; i <= fields->Length(); i++) {
+ if (fields->Value(i)->Protected()) {
+ protecteds->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ else {
+ privates->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ }
+
+ api->AddVariable(VTICPrivatefields,privates->ToCString());
+ api->AddVariable(VTICProtectedfields,protecteds->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+
+ // others inline methods and functions (ex. function call)
+ //
+ api->AddVariable(VTICSuppMethod,SuppMethod->ToCString());
+
+ // include the lxx if the class have inline methods
+ //
+ if (HasInlineMethod) {
+ Handle(MS_InstClass) aCreator = theClass->GetMyCreator();
+
+ if (aCreator.IsNull()) {
+ api->AddVariable(VIClass,theClass->FullName()->ToCString());
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+ }
+ // this part is for class created by instantiations
+ //
+ else {
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,aCreator->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+
+ CPP_GenericDefine(aMeta,api,aCreator,VTICDefines,VTICUndefines,Standard_False);
+ }
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) List = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) incp = new TColStd_HSequenceOfHAsciiString;
+
+ CPP_UsedTypes(aMeta,theClass,List,incp);
+
+ publics->Clear();
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= List->Length(); i++) {
+ if (!List->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,List->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VTICIncludes,"IncludeNoSafe");
+#else
+ api->Apply(VTICIncludes,"Include");
+#endif
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+
+ for (i = 1; i <= incp->Length(); i++) {
+ if (!incp->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,incp->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ api->AddVariable(VTICIncludes,publics->ToCString());
+
+ api->Apply(VoutClass,"MPVClass");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(theClass->FullName());
+ aFile->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ CPP_MPVDerivated(aMeta,api,aClass,outfile,incp,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_MPVClass - the class is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+// Extraction of a transient .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_PackageDerivated(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Package)& aPackage,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+
+ api->AddVariable(VClass,aPackage->Name()->ToCString());
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= inclist->Length(); i++) {
+ api->AddVariable(VIClass,inclist->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+ }
+
+
+ // include hxx of me
+ //
+ api->AddVariable(VIClass,aPackage->Name()->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+
+ api->AddVariable(VoutClass,result->ToCString());
+
+ aFileName->AssignCat(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aPackage->Name());
+ aFileName->AssignCat(".jxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aPackage->Name());
+ aFileName->AssignCat(".ixx");
+
+ // Supplement
+ //
+ result->Clear();
+
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ api->AddVariable(VSuffix,"jxx");
+
+ api->AddVariable(VClass,aPackage->Name()->ToCString());
+
+ api->Apply(VoutClass,"MPVIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_Package(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Package)& aPackage,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ if (!aPackage.IsNull()) {
+ Standard_Integer i;
+
+ Handle(MS_HSequenceOfExternMet) methods = aPackage->Methods();
+
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privates = new TCollection_HAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) packClass = aPackage->Classes();
+ Standard_Boolean HasInlineMethod = Standard_False;
+
+ Handle(TColStd_HSequenceOfHAsciiString) List = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) incp = new TColStd_HSequenceOfHAsciiString;
+
+
+ api->AddVariable(VTICIncludes,"");
+ api->AddVariable(VTICPublicfriends,"");
+ api->AddVariable(VTICProtectedfields,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICDefines,"");
+ api->AddVariable(VTICInlineIncludes,"");
+ api->AddVariable(VTICUndefines,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICPrivatefields,"");
+ api->AddVariable(VSuffix,"");
+ api->AddVariable(VInherits,"");
+ api->AddVariable(VTICProtectedmets,"");
+ api->AddVariable(VTICPrivatemets,"");
+ api->AddVariable(VMethods,"");
+ api->AddVariable(VClass,aPackage->FullName()->ToCString());
+ api->AddVariable(VTICSuppMethod,"");
+
+ // extraction of the methods
+ //
+ Handle(TCollection_HAsciiString) aliasMethod;
+
+ for (i = 1; i <= methods->Length(); i++) {
+ aliasMethod.Nullify();
+
+ if (methods->Value(i)->IsInline()) {
+ HasInlineMethod = Standard_True;
+ }
+
+ if (!methods->Value(i)->IsAlias().IsNull()) {
+ if (methods->Value(i)->IsQuotedAlias()) {
+ aliasMethod = new TCollection_HAsciiString(methods->Value(i)->IsAlias());
+ aliasMethod->Remove(1);
+ if (aliasMethod->Value(aliasMethod->Length()) == '"') {
+ aliasMethod->Remove(aliasMethod->Length());
+ }
+ aliasMethod->AssignCat("\n");
+ }
+ }
+
+ CPP_BuildMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+
+#ifdef WNT
+ if ( !methods -> Value ( i ) -> IsInline () )
+#endif // WNT
+ api->Apply(VMethod,"MethodTemplateDec");
+#ifdef WNT
+ else
+ api->Apply(VMethod,"MethodTemplateDecInlineWNT" );
+#endif // WNT
+
+ MS::MethodUsedTypes(aMeta,methods->Value(i),List,incp);
+
+ if (methods->Value(i)->Private()) {
+ privates->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ privates->AssignCat(aliasMethod);
+ }
+ }
+ else {
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ publics->AssignCat(aliasMethod);
+ }
+ }
+ }
+
+ api->AddVariable(VTICPublicmets,publics->ToCString());
+ api->AddVariable(VTICPrivatemets,privates->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+
+ // include the lxx if the class have inline methods
+ //
+ if (HasInlineMethod) {
+ api->AddVariable(VIClass,aPackage->Name()->ToCString());
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+ }
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= List->Length(); i++) {
+ if (!List->Value(i)->IsSameString(aPackage->Name())) {
+ api->AddVariable(VIClass,List->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VTICIncludes,"IncludeNoSafe");
+#else
+ api->Apply(VTICIncludes,"Include");
+#endif
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ for (i = 1; i <= incp->Length(); i++) {
+ if (!incp->Value(i)->IsSameString(aPackage->Name())) {
+ api->AddVariable(VIClass,incp->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ for (i = 1; i <= packClass->Length(); i++) {
+ // Declaration incomplete et
+ //
+ Handle(TCollection_HAsciiString) name = MS::BuildFullName(aPackage->Name(),packClass->Value(i));
+ api->AddVariable(VIClass,name->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ // ... declarations friends des classes declarees dans le package pour
+ // les methodes de classes privees
+ //
+ Handle(TCollection_HAsciiString) friendname = new TCollection_HAsciiString("friend class ");
+ friendname->AssignCat(name->ToCString());
+ friendname->AssignCat(";\n");
+ privates->AssignCat(friendname);
+ }
+ api->AddVariable(VTICPrivatefriends,privates->ToCString());
+ api->AddVariable(VTICIncludes,publics->ToCString());
+
+ api->Apply(VoutClass,"MPVClass");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(aPackage->Name());
+ aFile->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ CPP_PackageDerivated(aMeta,api,aPackage,outfile,incp,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_Package - the package is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <stdio.h>
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HArray1OfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+
+// create a VArray CSFDB dependent declaration for DBC instance
+// look EDL template : VArrayFieldCSFDB
+//
+void CPP_BuildVArrayDeclarationCSFDB(const Handle(MS_MetaSchema)&,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const 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())) {
+ api->AddVariable(VDName,aClass->FullName()->ToCString());
+ api->AddVariable(VDValue,anInst->InstTypes()->Value(1)->ToCString());
+ api->Apply(VDValue,"VArrayDeclareCSFDB");
+ Result->AssignCat(api->GetVariableValue(VDValue));
+ }
+ }
+}
+
+// create a VArray CSFDB dependent field for DBC instance
+// look EDL template : VArrayFieldCSFDB
+//
+void CPP_BuildVArrayFieldCSFDB(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const 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())) {
+ api->AddVariable(VDName,aClass->FullName()->ToCString());
+ api->AddVariable(VDValue,CPP_BuildType(aMeta,anInst->InstTypes()->Value(1))->ToCString());
+ api->Apply(VDValue,"VArrayFieldCSFDB");
+ Result->AssignCat(api->GetVariableValue(VDValue));
+ }
+ }
+}
+
+// CLE: ajouter le nom de la classe dans le nom des methodes d'acces aux champs
+//
+void CPP_BuildAccessFieldCSFDB(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Field)& field,
+ const Handle(TCollection_HAsciiString)& publics)
+{
+ Handle(MS_Type) thetype = aMeta->GetType(field->TYpe());
+
+ if (field->Dimensions()->Length() > 0) {
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) sdim = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) ddim = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) vdim = new TCollection_HAsciiString;
+ char num[30];
+
+
+ api->AddVariable("%CSFDBType",CPP_BuildType(aMeta,field->TYpe())->ToCString());
+ api->AddVariable("%Field",field->Name()->ToCString());
+
+ for (i = 1; i <= field->Dimensions()->Length(); i++) {
+ sdim->AssignCat("[");
+ sprintf(num,"%d",i);
+ sdim->AssignCat("i");
+ sdim->AssignCat(num);
+ sdim->AssignCat("]");
+
+ if (i != 1) {
+ vdim->AssignCat(",");
+ ddim->AssignCat(",");
+ }
+ vdim->AssignCat("const Standard_Integer i");
+ vdim->AssignCat(num);
+
+ ddim->AssignCat("i");
+ ddim->AssignCat(num);
+ }
+ api->AddVariable("%FDim",sdim->ToCString());
+ api->AddVariable("%VarDim",vdim->ToCString());
+ api->AddVariable("%Dimension",ddim->ToCString());
+ api->Apply("%res","DefFuncFieldArray");
+ }
+ else {
+ api->AddVariable("%CSFDBType",field->TYpe()->ToCString());
+ api->AddVariable("%Field",field->Name()->ToCString());
+
+ if (thetype->IsKind(STANDARD_TYPE(MS_StdClass))) {
+ Handle(MS_StdClass) aclass = *((Handle(MS_StdClass)*)&thetype);
+
+ if (aclass->IsPersistent()) {
+ api->Apply("%res","DefFuncPField");
+ }
+ else {
+ api->Apply("%res","DefFuncSField");
+ }
+ }
+ else {
+ api->Apply("%res","DefFuncPrField");
+ }
+ }
+
+ publics->AssignCat(api->GetVariableValue("%res"));
+}
+
+// Extraction of a Persistent handle for CSFDB
+//
+void CPP_PersistentHandleCSFDB(const Handle(EDL_API)& api,
+ const Handle(TCollection_HAsciiString)& aClass,
+ const Handle(TCollection_HAsciiString)& aMother,
+ const Handle(TCollection_HAsciiString)& aFileName)
+{
+ // we create the handle...
+ //
+ api->AddVariable("%HPName",aClass->ToCString());
+ api->AddVariable("%HPInherits",aMother->ToCString());
+ api->Apply("%HPHandle","HandlePersistentCSFDB");
+
+ // ...now we write the result
+ //
+ api->OpenFile("HTFile",aFileName->ToCString());
+ api->WriteFile("HTFile","%HPHandle");
+ api->CloseFile("HTFile");
+}
+
+
+// Extraction of a persistent .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_PersistentDerivatedCSFDB(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ // we do this only on standard classes (not on inst classes)
+ //
+ if (theClass.IsNull()) return;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= inclist->Length(); i++) {
+ api->AddVariable(VIClass,inclist->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ // include the hxx of me
+ //
+ api->AddVariable(VIClass,aClass->FullName()->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+
+ api->AddVariable(VoutClass,result->ToCString());
+
+ aFileName->AssignCat(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+ aFileName->AssignCat(".jxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ result->Clear();
+ outfile->Append(aFileName);
+ }
+
+ CPP_ClassTypeMgt(aMeta,api,aClass,VTypeMgt);
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ aFileName->AssignCat(".ixx");
+ }
+ else {
+ aFileName->AssignCat("_0.cxx");
+ }
+
+ // Supplement
+ //
+ if (theClass->GetMyCreator().IsNull()) {
+ result->Clear();
+ }
+
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ api->AddVariable(VIClass,MS::GetPersistentRootName()->ToCString());
+ api->Apply(VMethods,"DownCast");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"DynamicType");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->AddVariable(VIClass,aClass->GetInheritsNames()->Value(1)->ToCString());
+ api->Apply(VMethods,"IsKind");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"FullEmptyHandleDestructorTemplate");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ if (!theClass->GetMyCreator().IsNull()) {
+ CPP_GenericDefine(aMeta,api,theClass->GetMyCreator(),VTICDefines,VTICUndefines,Standard_True);
+ result->AssignCat(api->GetVariableValue(VTICDefines));
+ api->AddVariable(VSuffix,"gxx");
+
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,theClass->GetMyCreator()->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+
+ api->Apply(VMethods,"IncludeNoSafe");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ api->AddVariable(VSuffix,"jxx");
+ }
+ else {
+ api->AddVariable(VSuffix,"hxx");
+ }
+
+ api->AddVariable(VMethods,result->ToCString());
+ api->Apply(VoutClass,"PersistentCSFDBIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+
+// Extraction of a persistent class (inst or std)
+//
+void CPP_PersistentClassCSFDB(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ if (!theClass.IsNull()) {
+ Standard_Integer i;
+
+ Handle(MS_HSequenceOfMemberMet) methods = theClass->GetMethods();
+ Handle(MS_Method) friendmethod;
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privates = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protf = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privf = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) SuppMethod = new TCollection_HAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+ Standard_Boolean HasInlineMethod = Standard_False,
+ HasDestructor = Standard_False,
+ HasEmptyConst = Standard_False,
+ HasConstructor = Standard_False;
+ Handle(TColStd_HSequenceOfHAsciiString) List = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) incp = new TColStd_HSequenceOfHAsciiString;
+
+
+ api->AddVariable(VTICIncludes,"");
+ api->AddVariable(VTICPublicfriends,"");
+ api->AddVariable(VTICProtectedfields,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICDefines,"");
+ api->AddVariable(VTICInlineIncludes,"");
+ api->AddVariable(VTICUndefines,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICPrivatefields,"");
+ api->AddVariable(VSuffix,"");
+ api->AddVariable(VTICSuppMethod,"");
+
+ api->AddVariable(VClass,theClass->FullName()->ToCString());
+ api->AddVariable(VInherits,theClass->GetInheritsNames()->Value(1)->ToCString());
+
+ for (i = 1; i <= theClass->GetFriendsNames()->Length(); i++) {
+ publics->AssignCat("friend ");
+ api->AddVariable(VIClass,theClass->GetFriendsNames()->Value(i)->ToCString());
+ api->Apply(VTICPublicfriends,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICPublicfriends));
+ }
+
+ if (!CPP_SetFriendMethod(aMeta,api,theClass->GetFriendMets(),publics)) {
+ ErrorMsg << "CPPExt" << "a friend method was not found..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ api->AddVariable(VTICPublicfriends,publics->ToCString());
+
+ publics->Clear();
+
+ // extraction of the methods : BEGIN
+ //
+ Handle(TCollection_HAsciiString) aliasMethod;
+
+ for (i = 1; i <= methods->Length(); i++) {
+ aliasMethod.Nullify();
+
+ if (methods->Value(i)->IsInline()) {
+ HasInlineMethod = Standard_True;
+ }
+
+ // if the class has no destructor, we give it
+ //
+ if (methods->Value(i)->IsDestructor()) {
+ HasDestructor = Standard_True;
+ }
+
+ // if the class has no empty constructor, we give it
+ //
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) {
+ if (methods->Value(i)->Params().IsNull()) {
+ HasEmptyConst = Standard_True;
+ }
+
+ HasConstructor = Standard_True;
+ }
+ else {
+ if (!methods->Value(i)->Returns().IsNull()) {
+ MS::DispatchUsedType(aMeta,methods->Value(i)->Returns()->Type(),List,incp,Standard_True);
+ }
+ }
+
+ if (!methods->Value(i)->IsAlias().IsNull() || methods->Value(i)->IsDestructor()) {
+ aliasMethod = CPP_BuildAliasMethod(aMeta,api,methods->Value(i));
+ }
+
+ // Function Call c++ comment :
+ // it s must be in the _0.cxx or ixx file
+ // so we add it in the supplement sequence
+ //
+ if (methods->Value(i)->IsFunctionCall()) {
+ SuppMethod->AssignCat(CPP_BuildAliasMethod(aMeta,api,methods->Value(i)));
+ }
+
+ CPP_BuildMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+
+#ifdef WNT
+ if ( !methods -> Value ( i ) -> IsInline () )
+#endif // WNT
+ api->Apply(VMethod,"MethodTemplateDec");
+#ifdef WNT
+ else
+ api->Apply(VMethod,"MethodTemplateDecInlineWNT" );
+#endif // WNT
+
+ if (methods->Value(i)->Private()) {
+ privates->AssignCat(api->GetVariableValue(VMethod));
+
+ if (!aliasMethod.IsNull()) {
+ privates->AssignCat(aliasMethod);
+ }
+ }
+ else if ((theClass->Deferred() && methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) ||
+ methods->Value(i)->IsProtected()) {
+ protecteds->AssignCat(api->GetVariableValue(VMethod));
+
+ if (!aliasMethod.IsNull()) {
+ protecteds->AssignCat(aliasMethod);
+ }
+ }
+ else {
+ publics->AssignCat(api->GetVariableValue(VMethod));
+
+ if (!aliasMethod.IsNull()) {
+ publics->AssignCat(aliasMethod);
+ }
+ }
+ } // methods extraction : END
+
+ if (!HasDestructor) {
+ api->Apply(VMethod,"EmptyDestructorTemplate");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+
+ if (!HasEmptyConst && (aClass->GetFields()->Length() > 0)) {
+ api->AddVariable("%Class",aClass->FullName()->ToCString());
+ api->AddVariable("%Arguments"," ");
+ api->Apply(VMethod,"ConstructorHeader");
+ api->AddVariable(VMBody,"");
+ api->Apply(VMethod,"MethodTemplateDef");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+
+ // WARNING: here is a trap
+ //
+ HasEmptyConst = Standard_True;
+ }
+
+ // Add a special constructor for Storage package
+ //
+ Handle(MS_StdClass) aMaman = Handle(MS_StdClass)::DownCast(aMeta->GetType(theClass->GetInheritsNames()->Value(1)));
+
+ api->AddVariable("%Class",aClass->FullName()->ToCString());
+ api->Apply(VMethod,"ConstructorHeaderCallAncestor");
+ api->AddVariable(VMBody,"");
+ api->Apply(VMethod,"MethodTemplateDef");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ // if the class have empty constructor we must add one.
+ // if a derived class of this have a constructor
+ // this constructor will be forced to call an empty constructor
+ //
+ if (!HasEmptyConst) {
+ api->AddVariable("%Class",aClass->FullName()->ToCString());
+ api->AddVariable("%Arguments"," ");
+ api->Apply(VMethod,"ConstructorHeader");
+ api->AddVariable(VMBody,"");
+ api->Apply(VMethod,"MethodTemplateDef");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+
+ // extraction of fields
+ //
+ Handle(MS_HSequenceOfField) fields = theClass->GetFields();
+
+ api->AddVariable("%NameField",theClass->FullName()->ToCString());
+
+ for (i = 1; i <= fields->Length(); i++) {
+ if (fields->Value(i)->Protected()) {
+ protf->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ else {
+ privf->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ CPP_BuildAccessFieldCSFDB(aMeta,api,fields->Value(i),publics);
+ }
+
+ api->AddVariable(VTICPublicmets,publics->ToCString());
+ api->AddVariable(VTICPrivatemets,privates->ToCString());
+ api->AddVariable(VTICProtectedmets,protecteds->ToCString());
+ api->AddVariable(VTICPrivatefields,privf->ToCString());
+ api->AddVariable(VTICProtectedfields,protf->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+ privf->Clear();
+ protf->Clear();
+
+ // others inline methods and functions (ex. function call)
+ //
+ api->AddVariable(VTICSuppMethod,SuppMethod->ToCString());
+
+ // include the lxx if the class have inline methods
+ //
+ if (HasInlineMethod) {
+ Handle(MS_InstClass) aCreator = theClass->GetMyCreator();
+
+ if (aCreator.IsNull()) {
+ api->AddVariable(VIClass,theClass->FullName()->ToCString());
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+ }
+ // this part is for class created by instantiations
+ //
+ else {
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,aCreator->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+
+ CPP_GenericDefine(aMeta,api,aCreator,VTICDefines,VTICUndefines,Standard_True);
+ }
+ }
+
+ CPP_UsedTypes(aMeta,theClass,List,incp);
+
+ publics->Clear();
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= List->Length(); i++) {
+ if (!List->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,List->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VTICIncludes,"IncludeNoSafe");
+#else
+ api->Apply(VTICIncludes,"Include");
+#endif
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+
+ for (i = 1; i <= incp->Length(); i++) {
+ if (!incp->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,incp->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ api->AddVariable(VTICIncludes,publics->ToCString());
+
+ api->Apply(VoutClass,"PersistentCSFDBInstClass");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(theClass->FullName());
+ aFile->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ // .ixx or _0.cxx
+ //
+ if (!HasDestructor) {
+ api->Apply(VMethod,"FullEmptyDestructorTemplate");
+ Supplement->Append(new TCollection_HAsciiString(api->GetVariableValue(VMethod)));
+ }
+
+ CPP_PersistentDerivatedCSFDB(aMeta,api,aClass,outfile,incp,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_PersistentClassCSFDB - the class is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_ParamWithValue.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+#include <MS_Alias.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HArray1OfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+static Standard_CString VTICOidpubMet = "%TICOidpubMet",
+ VTICOidproMet = "%TICOidproMet",
+ VTICOidpriMet = "%TICOidpriMet";
+
+Handle(TCollection_HAsciiString) CPP_BuildTypeOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aTypeName);
+
+// create the defines and the undefines that are around the include of
+// a generic .lxx
+// ex. :
+// #define ItemHArray1 Quantity_Color
+// #define ItemHArray1_hxx <Quantity_Color.hxx>
+// #define TheArray1 Quantity_Array1OfColor
+// #define TheArray1_hxx <Quantity_Array1OfColor.hxx>
+// #define TCollection_HArray1 Quantity_HArray1OfColor
+// #define TCollection_HArray1_hxx <Quantity_HArray1OfColor.hxx>
+// #include <TCollection_HArray1.lxx>
+// #undef ItemHArray1
+// #undef ItemHArray1_hxx
+// #undef TheArray1
+// #undef TheArray1_hxx
+// #undef TCollection_HArray1
+// #undef TCollection_HArray1_hxx
+//
+void CPP_GenericMDTVDefineOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_InstClass)& aCreator,
+ const Standard_CString VARDefine,
+ const Standard_CString VARUndefine,
+ const Standard_Boolean handleUsed)
+{
+ Handle(MS_GenClass) aGenClass = Handle(MS_GenClass)::DownCast(aMeta->GetType(aCreator->GenClass()));
+ Handle(TColStd_HSequenceOfHAsciiString) theGenTypes = aCreator->GenTypes();
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Standard_Integer i,
+ itemLength;
+ Handle(MS_HSequenceOfGenType) realGentypes = aGenClass->GenTypes();
+
+ // we need this length because for item we must call
+ // CPP_BuildType and for nested class name we dont need.
+ //
+ itemLength = aGenClass->GenTypes()->Length();
+
+ for (i = 1; i <= theGenTypes->Length(); i++) {
+ if (!aGenClass->FullName()->IsSameString(theGenTypes->Value(i))) {
+ api->AddVariable(VDName,theGenTypes->Value(i)->ToCString());
+
+ // real name or Handle_name
+ //
+ if (i <= itemLength) {
+ if (!realGentypes->Value(i)->TYpeName().IsNull()) {
+ if (aMeta->IsDefined(realGentypes->Value(i)->TYpeName())) {
+ Handle(MS_Type) t = aMeta->GetType(realGentypes->Value(i)->TYpeName());
+
+ if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) c = *((Handle(MS_Class)*)&t);
+
+ // if the items constraint is handled, the item is not the handle,
+ // like in other cases, but the type himself.
+ //
+ // ex. : the item : 'i' as transient
+ // will be defined as #define i class
+ // the item : 'i' as any
+ // will be defined as #define i Handle_Class
+ //
+ if (c->IsPersistent() || c->IsTransient()) {
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->Apply(VARDefine,"ItemMDTVConstraintHandle");
+ api->Apply(VARUndefine,"ItemMDTVConstraintHandleUndef");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ else {
+ api->AddVariable(VDValue,CPP_BuildTypeOBJS(aMeta,aCreator->InstTypes()->Value(i))->ToCString());
+ }
+ }
+ }
+ }
+ else {
+ api->AddVariable(VDValue,CPP_BuildTypeOBJS(aMeta,aCreator->InstTypes()->Value(i))->ToCString());
+ }
+ api->AddVariable("%DBaseValue",aCreator->InstTypes()->Value(i)->ToCString());
+ }
+ // real name
+ //
+ else {
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->AddVariable("%DBaseValue",aCreator->InstTypes()->Value(i)->ToCString());
+ }
+
+ api->Apply(VARDefine,"ItemMDTVDefine");
+ api->Apply(VARUndefine,"ItemMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ }
+
+ for (i = itemLength + 1; i <= theGenTypes->Length(); i++) {
+ if (!aGenClass->FullName()->IsSameString(theGenTypes->Value(i))) {
+ Handle(TCollection_HAsciiString) realName = CPP_BuildTypeOBJS(aMeta,aCreator->InstTypes()->Value(i));
+
+ if (!realName->IsSameString(aCreator->InstTypes()->Value(i))) {
+ api->AddVariable(VDName,theGenTypes->Value(i)->ToCString());
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->Apply(VARDefine,"ItemHandleMDTVDefine");
+ api->Apply(VARUndefine,"ItemHandleMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ }
+ }
+
+ api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+ api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+ api->AddVariable("%DBaseValue",aCreator->FullName()->ToCString());
+
+ api->Apply(VARDefine,"ItemMDTVDefine");
+ api->Apply(VARUndefine,"ItemMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+
+
+ // #define TCollection_HSequence_Type_() TColStd_HSequenceOfTransient_Type_()
+ // #define Handle_TCollection_HSequence Handle_TColStd_HSequenceOfTransient
+ //
+ if (aGenClass->IsTransient() || aGenClass->IsPersistent()) {
+ api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+ api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+ api->Apply(VARDefine,"ItemHandleMDTVDefine");
+ api->Apply(VARUndefine,"ItemHandleMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+
+ api->AddVariable(VARDefine,publics->ToCString());
+ api->AddVariable(VARUndefine,protecteds->ToCString());
+}
+
+// create a VArray OBJS dependent declaration for DBC instance
+// look EDL template : VArrayFieldOBJS
+//
+void CPP_BuildVArrayDeclarationOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const 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())) {
+// api->AddVariable(VDName,aClass->FullName()->ToCString());
+// api->AddVariable(VDValue,anInst->InstTypes()->Value(1)->ToCString());
+// api->Apply(VDValue,"VArrayDeclareOBJS");
+// Result->AssignCat(api->GetVariableValue(VDValue));
+// }
+// }
+}
+
+// create a VArray OBJS dependent field for DBC instance
+// look EDL template : VArrayFieldOBJS
+//
+void CPP_BuildVArrayFieldOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const 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())) {
+// api->AddVariable(VDName,aClass->FullName()->ToCString());
+// api->AddVariable(VDValue,anInst->InstTypes()->Value(1)->ToCString());
+// api->Apply(VDValue,"VArrayFieldOBJS");
+// Result->AssignCat(api->GetVariableValue(VDValue));
+// }
+// }
+}
+
+// build a c++ declaration method
+// the result is in the EDL variable VMethod
+//
+// template used :
+//
+// MethodTemplateDef
+// ConstructorTemplateDef
+// MethodTemplateDec
+// ConstructorTemplateDec
+// InlineMethodTemplateDec
+//
+// the EDL variables :
+// VMethodHeader : must contains the name of the template used for
+// methods construction
+// VConstructorHeader : must contains the name of the template used for
+// constructors construction
+//
+void CPP_BuildOidOBJSMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& m,
+ const Handle(TCollection_HAsciiString)& methodName,
+ const Standard_Boolean forDeclaration = Standard_True)
+{
+ Handle(MS_InstMet) im;
+ Handle(MS_ClassMet) cm;
+ Handle(MS_Construc) ct;
+ Handle(MS_Param) retType;
+
+ Handle(TCollection_HAsciiString) MetTemplate,
+ ConTemplate;
+
+ Standard_Boolean InlineMethod;
+
+ MetTemplate = api->GetVariableValue(VMethodHeader);
+ ConTemplate = api->GetVariableValue(VConstructorHeader);
+
+ // here we process all the common attributes of methods
+ //
+ api->AddVariable(VMethodName,methodName->ToCString());
+ api->AddVariable(VVirtual,"");
+
+ // it s inline method ?
+ //
+ api->AddVariable(VIsInline,"no");
+ InlineMethod = Standard_False;
+
+ api->AddVariable(VRetSpec,"");
+
+ // it s returning & ?
+ //
+ if (m->IsRefReturn()) {
+ api->AddVariable(VAnd,"&");
+ }
+ else {
+ api->AddVariable(VAnd,"");
+ }
+
+ api->AddVariable(VArgument,CPP_BuildParameterList(aMeta,m->Params(),forDeclaration)->ToCString());
+
+ // it s returning a type or void
+ //
+ retType = m->Returns();
+
+ if (!retType.IsNull()) {
+ api->AddVariable(VReturn,CPP_BuildType(aMeta,retType->TypeName())->ToCString());
+ }
+ else {
+ api->AddVariable(VReturn,"void");
+ }
+
+ // now the specials attributes
+ //
+ // instance methods
+ //
+ if (m->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ im = *((Handle(MS_InstMet)*)&m);
+
+ api->AddVariable(VIsCreateMethod,"no");
+ api->AddVariable(VMetSpec,"");
+ api->Apply(VMethod,MetTemplate->ToCString());
+ //api->Apply(VMethod,"InlineMethodTemplateDec");
+ }
+}
+
+Handle(TCollection_HAsciiString) CPP_BuildOidImmTestOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& Method,
+ const Standard_Boolean UseMutability)
+{
+ Handle(TCollection_HAsciiString) body = new TCollection_HAsciiString;
+ Standard_Integer i;
+ Standard_Boolean testResult;
+ Handle(MS_HArray1OfParam) aSeqParam = Method->Params();
+
+ api->AddVariable(VMethodName,Method->Name()->ToCString());
+
+ if(!aSeqParam.IsNull()) {
+ for (i = 1; i <= aSeqParam->Length(); i++) {
+ if (aSeqParam->Value(i)->Type()->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Type) pType = aSeqParam->Value(i)->Type();
+ Handle(MS_Class) aPersClass = *((Handle_MS_Class*)&pType);
+
+ if (UseMutability) {
+ testResult = aSeqParam->Value(i)->IsMutable();
+ }
+ else {
+ testResult = aSeqParam->Value(i)->IsOut();
+ }
+
+ if (testResult && aPersClass->IsPersistent()) {
+ api->AddVariable(VDName,aSeqParam->Value(i)->Name()->ToCString());
+ api->Apply(VDName,"ImmutableTestOBJS");
+ body->AssignCat(api->GetVariableValue(VDName));
+ }
+ }
+ }
+ }
+ return body;
+}
+
+// Build the list of call for persistent oid methods and set the result at the end of
+// publics
+//
+Standard_Boolean CPP_BuildOidMethodCallOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& Method,
+ const Handle(TCollection_HAsciiString)& publics)
+{
+ if (publics.IsNull()) return Standard_False;
+
+ Handle(MS_InstMet) method = Handle(MS_InstMet)::DownCast(Method);
+ Standard_Integer i;
+ Standard_Boolean result = Standard_True;
+ Handle(TCollection_HAsciiString) aname,
+ oldclass = api->GetVariableValue(VClass),
+ body,
+ immTest;
+ Handle(MS_HArray1OfParam) aSeqParam;
+
+ // templates for methods extraction
+ //
+ api->AddVariable(VMethodHeader,"ExternalMethodHeader");
+ api->AddVariable(VConstructorHeader,"ExternalConstructorHeader");
+
+ if (!method.IsNull()) {
+ body = new TCollection_HAsciiString;
+
+ aSeqParam = method->Params();
+
+ aname = new TCollection_HAsciiString("Oid_");
+ aname->AssignCat(method->Class());
+
+ // method header
+ //
+ api->AddVariable(VClass,aname->ToCString());
+ CPP_BuildOidOBJSMethod(aMeta,api,method,method->Name(),Standard_False);
+
+ api->AddVariable(VClass,method->Class()->ToCString());
+ api->AddVariable(VMethodName,method->Name()->ToCString());
+
+ // parameters
+ //
+ aname = new TCollection_HAsciiString(method->Name());
+ aname->AssignCat("(");
+
+ immTest = CPP_BuildOidImmTestOBJS(aMeta,api,method,Standard_True);
+
+ body->AssignCat(immTest);
+
+ // method call signature
+ //
+ if (!aSeqParam.IsNull()) {
+ aname->AssignCat(aSeqParam->Value(1)->Name());
+
+ for (i = 2; i <= aSeqParam->Length(); i++) {
+ aname->AssignCat(",");
+ aname->AssignCat(aSeqParam->Value(i)->Name());
+ }
+ }
+
+ aname->AssignCat(")");
+
+ // method call
+ //
+ api->AddVariable(VMethodName,aname->ToCString());
+
+ if (method->IsConst()) {
+ api->Apply(VMethodName,"ReadAccessOBJS");
+ }
+ else {
+ api->Apply(VMethodName,"UpdateAccessOBJS");
+ }
+
+ // returns value
+ //
+ if (!method->Returns().IsNull()) {
+ body->AssignCat(CPP_BuildType(aMeta,method->Returns()->TypeName()));
+ body->AssignCat(" _result = ");
+ body->AssignCat(api->GetVariableValue(VMethodName));
+
+ if (method->Returns()->Type()->IsKind(STANDARD_TYPE(MS_Class))) {
+ if (method->Returns()->IsMutable()) {
+ api->AddVariable(VDName,"_result");
+ api->AddVariable(VMethodName,method->Name()->ToCString());
+ api->Apply(VDName,"ImmutableTestOBJS");
+ body->AssignCat(api->GetVariableValue(VDName));
+ }
+ }
+ }
+ else {
+ body->AssignCat(api->GetVariableValue(VMethodName));
+ }
+
+ immTest = CPP_BuildOidImmTestOBJS(aMeta,api,method,Standard_False);
+ body->AssignCat(immTest);
+ body->AssignCat(" EndAccess();\n");
+
+ // return code
+ //
+ if (!method->Returns().IsNull()) {
+ body->AssignCat(" return _result;");
+ }
+
+ api->AddVariable(VMBody,body->ToCString());
+ api->Apply(VMethod,"MethodTemplateDef");
+
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+ else {
+ result = Standard_False;
+ }
+
+ // templates for methods extraction
+ //
+ api->AddVariable(VMethodHeader,"MethodHeader");
+ api->AddVariable(VConstructorHeader,"ConstructorHeader");
+ api->AddVariable(VClass,oldclass->ToCString());
+
+ return result;
+}
+
+// Extraction of a Persistent handle for OBJS
+//
+void CPP_PersistentHandleOBJS(const Handle(EDL_API)& api,
+ const Handle(TCollection_HAsciiString)& aClass,
+ const Handle(TCollection_HAsciiString)& aMother,
+ const Handle(TCollection_HAsciiString)& aFileName)
+{
+ // we create the handle...
+ //
+ api->AddVariable("%HPName",aClass->ToCString());
+ api->AddVariable("%HPInherits",aMother->ToCString());
+ api->Apply("%HPHandle","HandlePersistentOBJS");
+
+ // ...now we write the result
+ //
+ api->OpenFile("HTFile",aFileName->ToCString());
+ api->WriteFile("HTFile","%HPHandle");
+ api->CloseFile("HTFile");
+}
+
+
+// Extraction of a persistent .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_PersistentDerivatedOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ // we do this only on standard classes (not on inst classes)
+ //
+ if (theClass.IsNull()) return;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= inclist->Length(); i++) {
+ api->AddVariable(VIClass,inclist->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ // include the hxx of me
+ //
+ api->AddVariable(VIClass,aClass->FullName()->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+
+ api->AddVariable(VoutClass,result->ToCString());
+
+ aFileName->AssignCat(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+ aFileName->AssignCat(".jxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ result->Clear();
+ outfile->Append(aFileName);
+ }
+
+ CPP_ClassTypeMgt(aMeta,api,aClass,VTypeMgt);
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ aFileName->AssignCat(".ixx");
+ }
+ else {
+ aFileName->AssignCat("_0.cxx");
+ }
+
+ // Supplement
+ //
+ if (theClass->GetMyCreator().IsNull()) {
+ result->Clear();
+ }
+
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ api->AddVariable(VIClass,MS::GetPersistentRootName()->ToCString());
+ api->Apply(VMethods,"DownCast");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"DynamicType");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->AddVariable(VIClass,aClass->GetInheritsNames()->Value(1)->ToCString());
+ api->Apply(VMethods,"IsKind");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"FullEmptyHandleDestructorTemplate");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ if (!theClass->Deferred()) {
+ api->Apply(VMethods,"PersistentAllocationOBJS");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+ else {
+ api->Apply(VMethods,"PersistentAllocationOBJSDeferred");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+
+ if (!theClass->GetMyCreator().IsNull()) {
+ CPP_GenericDefine(aMeta,api,theClass->GetMyCreator(),VTICDefines,VTICUndefines,Standard_True);
+ result->AssignCat(api->GetVariableValue(VTICDefines));
+
+ // CLE
+ Handle(MS_GenClass) aGenClassCreator = Handle(MS_GenClass)::DownCast(aMeta->GetType(theClass->GetMyCreator()->GenClass()));
+
+ api->AddVariable(VDName,aGenClassCreator->FullName()->ToCString());
+ api->AddVariable(VDValue,theClass->GetMyCreator()->FullName()->ToCString());
+ api->Apply(VTICDefines,"ItemMDTVptrDefine");
+ result->AssignCat(api->GetVariableValue(VTICDefines));
+ // ENDCLE
+
+ api->AddVariable(VSuffix,"gxx");
+
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,theClass->GetMyCreator()->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+
+ api->Apply(VMethods,"IncludeNoSafe");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ api->AddVariable(VSuffix,"jxx");
+ }
+ else {
+ api->AddVariable(VSuffix,"hxx");
+ }
+
+ api->AddVariable(VMethods,result->ToCString());
+ api->Apply(VoutClass,"PersistentOBJSIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+// build a return, parameter or field type in c++
+// return a <type name> or a Handle_<type name>
+//
+Handle(TCollection_HAsciiString) CPP_BuildTypeOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aTypeName)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Type) aType;
+
+ if (aMeta->IsDefined(aTypeName)) {
+ aType = aMeta->GetType(aTypeName);
+
+ if (aType->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&aType);
+
+ aType = aMeta->GetType(analias->DeepType());
+ }
+
+ if (aType->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) aClass;
+
+ aClass = *((Handle(MS_Class)*)&aType);
+
+ if (aClass->IsPersistent()) {
+ result->AssignCat("Handle_");
+ result->AssignCat(aTypeName);
+ }
+ else if (aClass->IsTransient()) {
+ ErrorMsg << "CPPExt" << "type " << aType->FullName()->ToCString() << " is Transient an cannot be a field of a Persistent capable class" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ else {
+ result->AssignCat(aTypeName);
+ }
+ }
+ else {
+ result->AssignCat(aTypeName);
+ }
+ }
+ else {
+ ErrorMsg << "CPPExt" << "type " << aType->FullName()->ToCString() << " not defined..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ return result;
+}
+
+// Build a c++ field
+//
+Handle(TCollection_HAsciiString) CPP_BuildFieldOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Field)& aField)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Type) aType;
+ Handle(TColStd_HSequenceOfInteger) dim;
+ Standard_Integer i;
+
+ result->AssignCat(CPP_BuildTypeOBJS(aMeta,aField->TYpe()));
+ result->AssignCat(" ");
+ result->AssignCat(aField->Name());
+
+ dim = aField->Dimensions();
+
+ for (i = 1; i <= dim->Length(); i++) {
+ result->AssignCat("[");
+ result->AssignCat(new TCollection_HAsciiString(dim->Value(i)));
+ result->AssignCat("]");
+ }
+
+ result->AssignCat(";\n");
+
+ return result;
+}
+
+// Extraction of a persistent class (inst or std)
+//
+void CPP_PersistentClassOBJS(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ if (!theClass.IsNull()) {
+ Standard_Integer i,j;
+
+ Handle(MS_HSequenceOfMemberMet) methods = theClass->GetMethods();
+ Handle(MS_Method) friendmethod;
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privates = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) SuppMethod = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) SuppOIDMethod = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) oidpubmethods = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) oidpromethods = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) oidprimethods = new TCollection_HAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+ Standard_Boolean HasInlineMethod = Standard_False,
+ HasDestructor = Standard_False,
+ HasEmptyConst = Standard_False,
+ HasConstructor = Standard_False;
+
+ Handle(TColStd_HSequenceOfHAsciiString) List = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) incp = new TColStd_HSequenceOfHAsciiString;
+
+ api->AddVariable(VTICIncludes,"");
+ api->AddVariable(VTICPublicfriends,"");
+ api->AddVariable(VTICProtectedfields,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICDefines,"");
+ api->AddVariable(VTICInlineIncludes,"");
+ api->AddVariable(VTICUndefines,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICPrivatefields,"");
+ api->AddVariable(VSuffix,"");
+ api->AddVariable(VTICSuppMethod,"");
+
+ api->AddVariable(VClass,theClass->FullName()->ToCString());
+ api->AddVariable(VInherits,theClass->GetInheritsNames()->Value(1)->ToCString());
+
+ for (i = 1; i <= theClass->GetFriendsNames()->Length(); i++) {
+ publics->AssignCat("friend ");
+ api->AddVariable(VIClass,theClass->GetFriendsNames()->Value(i)->ToCString());
+ api->Apply(VTICPublicfriends,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICPublicfriends));
+ }
+
+ if (!CPP_SetFriendMethod(aMeta,api,theClass->GetFriendMets(),publics)) {
+ ErrorMsg << "CPPExt" << "a friend method was not found..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ api->AddVariable(VTICPublicfriends,publics->ToCString());
+
+ publics->Clear();
+
+ // extraction of the methods : BEGIN
+ //
+ Handle(TCollection_HAsciiString) aliasMethod;
+
+ for (i = 1; i <= methods->Length(); i++) {
+ aliasMethod.Nullify();
+
+ if (methods->Value(i)->IsInline()) {
+ HasInlineMethod = Standard_True;
+ }
+
+ // if the class has no destructor, we give it
+ //
+ if (methods->Value(i)->IsDestructor()) {
+ HasDestructor = Standard_True;
+ }
+
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) {
+ if (methods->Value(i)->Params().IsNull()) {
+ HasEmptyConst = Standard_True;
+ }
+ else {
+ Handle(MS_HArray1OfParam) aParseq = methods->Value(i)->Params();
+ Standard_Boolean hasDefault = Standard_True;
+ Handle(MS_Param) aParam;
+ if(!aParseq.IsNull()) {
+ for(j = 1; j <= aParseq->Length() && hasDefault; j++) {
+ aParam = aParseq->Value(j);
+
+ if (!aParam->IsKind(STANDARD_TYPE(MS_ParamWithValue))) {
+ hasDefault = Standard_False;
+ }
+ }
+ }
+
+ if (hasDefault) {
+ HasEmptyConst = Standard_True;
+ }
+ }
+
+ HasConstructor = Standard_True;
+ }
+ else {
+ if (!methods->Value(i)->Returns().IsNull()) {
+ MS::DispatchUsedType(aMeta,methods->Value(i)->Returns()->Type(),List,incp,Standard_True);
+ }
+ }
+
+ if (!methods->Value(i)->IsAlias().IsNull() || methods->Value(i)->IsDestructor()) {
+ aliasMethod = CPP_BuildAliasMethod(aMeta,api,methods->Value(i));
+ }
+
+ // Function Call c++ comment :
+ // it s must be in the _0.cxx or ixx file
+ // so we add it in the supplement sequence
+ //
+ if (methods->Value(i)->IsFunctionCall()) {
+ SuppMethod->AssignCat(CPP_BuildAliasMethod(aMeta,api,methods->Value(i)));
+ }
+
+ CPP_BuildMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+
+ api->Apply(VMethod,"MethodTemplateDec");
+
+ if (methods->Value(i)->Private()) {
+ privates->AssignCat(api->GetVariableValue(VMethod));
+
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ CPP_BuildOidOBJSMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+ api->Apply(VMethod,"MethodTemplateDec");
+ oidprimethods->AssignCat(api->GetVariableValue(VMethod));
+ CPP_BuildOidMethodCallOBJS(aMeta,api,methods->Value(i),SuppOIDMethod);
+ }
+
+ if (!aliasMethod.IsNull()) {
+ privates->AssignCat(aliasMethod);
+ }
+ }
+ else if ((theClass->Deferred() && methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) ||
+ methods->Value(i)->IsProtected()) {
+ protecteds->AssignCat(api->GetVariableValue(VMethod));
+
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ CPP_BuildOidOBJSMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+ api->Apply(VMethod,"MethodTemplateDec");
+ oidpromethods->AssignCat(api->GetVariableValue(VMethod));
+ CPP_BuildOidMethodCallOBJS(aMeta,api,methods->Value(i),SuppOIDMethod);
+ }
+
+ if (!aliasMethod.IsNull()) {
+ protecteds->AssignCat(aliasMethod);
+ }
+ }
+ else {
+ publics->AssignCat(api->GetVariableValue(VMethod));
+
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ CPP_BuildOidOBJSMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+ api->Apply(VMethod,"MethodTemplateDec");
+ oidpubmethods->AssignCat(api->GetVariableValue(VMethod));
+ CPP_BuildOidMethodCallOBJS(aMeta,api,methods->Value(i),SuppOIDMethod);
+ }
+
+ if (!aliasMethod.IsNull()) {
+ publics->AssignCat(aliasMethod);
+ }
+ }
+ } // methods extraction : END
+
+ if (!HasDestructor) {
+ api->Apply(VMethod,"EmptyDestructorTemplate");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+
+ if (!HasEmptyConst) {
+ api->AddVariable("%Class",aClass->FullName()->ToCString());
+ api->AddVariable("%Arguments"," ");
+ api->Apply(VMethod,"ConstructorHeader");
+ api->AddVariable(VMBody,"");
+ api->Apply(VMethod,"MethodTemplateDef");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+
+ // WARNING: here is a trap
+ //
+ HasEmptyConst = Standard_True;
+ }
+
+ api->AddVariable(VTICPublicmets,publics->ToCString());
+ api->AddVariable(VTICPrivatemets,privates->ToCString());
+ api->AddVariable(VTICProtectedmets,protecteds->ToCString());
+ api->AddVariable(VTICOidpubMet,oidpubmethods->ToCString());
+ api->AddVariable(VTICOidproMet,oidpromethods->ToCString());
+ api->AddVariable(VTICOidpriMet,oidprimethods->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+ oidpubmethods->Clear();
+ oidpromethods->Clear();
+ oidprimethods->Clear();
+
+ // extraction of fields
+ //
+ Handle(MS_HSequenceOfField) fields = theClass->GetFields();
+
+ for (i = 1; i <= fields->Length(); i++) {
+ if (fields->Value(i)->Protected()) {
+ protecteds->AssignCat(CPP_BuildFieldOBJS(aMeta,fields->Value(i)));
+ }
+ else {
+ privates->AssignCat(CPP_BuildFieldOBJS(aMeta,fields->Value(i)));
+ }
+ }
+
+ api->AddVariable(VTICPrivatefields,privates->ToCString());
+ api->AddVariable(VTICProtectedfields,protecteds->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+
+ // others inline methods and functions (ex. function call)
+ //
+ // api->AddVariable(VTICSuppMethod,SuppMethod->ToCString());
+
+ // include the lxx if the class have inline methods
+ //
+ if (HasInlineMethod) {
+ Handle(MS_InstClass) aCreator = theClass->GetMyCreator();
+
+ if (aCreator.IsNull()) {
+ api->AddVariable(VIClass,theClass->FullName()->ToCString());
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+ }
+ // this part is for class created by instantiations
+ //
+ else {
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,aCreator->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeMDTVNoSafe");
+
+ CPP_GenericMDTVDefineOBJS(aMeta,api,aCreator,VTICDefines,VTICUndefines,Standard_True);
+ }
+ }
+
+ CPP_UsedTypes(aMeta,theClass,List,incp);
+
+ publics->Clear();
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= List->Length(); i++) {
+ if (!List->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,List->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VTICIncludes,"IncludeNoSafe");
+#else
+ api->Apply(VTICIncludes,"Include");
+#endif
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+
+ for (i = 1; i <= incp->Length(); i++) {
+ if (!incp->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,incp->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ api->AddVariable(VTICIncludes,publics->ToCString());
+
+ api->Apply(VoutClass,"PersistentOBJSInstClass");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(theClass->FullName());
+ aFile->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ // .ixx or _0.cxx
+ //
+ if (!HasDestructor) {
+ api->Apply("%Destructor","FullEmptyDestructorTemplate");
+ }
+ else {
+ api->AddVariable("%Destructor"," ");
+ }
+
+ api->AddVariable("%MethodOID",SuppOIDMethod->ToCString());
+ CPP_PersistentDerivatedOBJS(aMeta,api,aClass,outfile,incp,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_PersistentClassOBJS - the class is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+#include <MS_Alias.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HArray1OfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+static Standard_CString VTICOidpubMet = "%TICOidpubMet",
+ VTICOidproMet = "%TICOidproMet",
+ VTICOidpriMet = "%TICOidpriMet";
+
+Handle(TCollection_HAsciiString) CPP_BuildTypeOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aTypeName);
+
+// create the defines and the undefines that are around the include of
+// a generic .lxx
+// ex. :
+// //MDTV#define ItemHArray1 Quantity_Color
+// //MDTV#define ItemHArray1_hxx <Quantity_Color.hxx>
+// //MDTV#define TheArray1 Quantity_Array1OfColor
+// //MDTV#define TheArray1_hxx <Quantity_Array1OfColor.hxx>
+// //MDTV#define TCollection_HArray1 Quantity_HArray1OfColor
+// //MDTV#define TCollection_HArray1_hxx <Quantity_HArray1OfColor.hxx>
+// //MDTV#include <TCollection_HArray1.lxx>
+// //MDTV#undef ItemHArray1
+// //MDTV#undef ItemHArray1_hxx
+// //MDTV#undef TheArray1
+// //MDTV#undef TheArray1_hxx
+// //MDTV#undef TCollection_HArray1
+// //MDTV#undef TCollection_HArray1_hxx
+//
+void CPP_GenericMDTVDefineOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_InstClass)& aCreator,
+ const Standard_CString VARDefine,
+ const Standard_CString VARUndefine,
+ const Standard_Boolean handleUsed)
+{
+// Handle(MS_GenClass) aGenClass = Handle(MS_GenClass)::DownCast(aMeta->GetType(aCreator->GenClass()));
+// Handle(TColStd_HSequenceOfHAsciiString) theGenTypes = aCreator->GenTypes();
+// Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString,
+// protecteds = new TCollection_HAsciiString;
+// Standard_Integer i;
+
+
+// for (i = 1; i <= theGenTypes->Length(); i++) {
+// if (!aGenClass->FullName()->IsSameString(theGenTypes->Value(i))) {
+// api->AddVariable(VDName,theGenTypes->Value(i)->ToCString());
+// api->AddVariable(VDValue,CPP_BuildType(aMeta,aCreator->InstTypes()->Value(i))->ToCString());
+// api->Apply(VARDefine,"ItemMDTVDefine");
+// api->Apply(VARUndefine,"ItemMDTVUndefine");
+// publics->AssignCat(api->GetVariableValue(VARDefine));
+// protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+// }
+// }
+
+// api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+// api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+// api->Apply(VARDefine,"ItemMDTVDefine");
+// api->Apply(VARUndefine,"ItemMDTVUndefine");
+// publics->AssignCat(api->GetVariableValue(VARDefine));
+// protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+
+ // #define TCollection_HSequence_Type_() TColStd_HSequenceOfTransient_Type_()
+ // #define Handle_TCollection_HSequence Handle_TColStd_HSequenceOfTransient
+ //
+// if (handleUsed) {
+// api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+// api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+// api->Apply(VARDefine,"ItemHandleMDTVDefine");
+// api->Apply(VARUndefine,"ItemHandleMDTVUndefine");
+// publics->AssignCat(api->GetVariableValue(VARDefine));
+// protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+// }
+
+// api->AddVariable(VARDefine,publics->ToCString());
+// api->AddVariable(VARUndefine,protecteds->ToCString());
+ Handle(MS_GenClass) aGenClass = Handle(MS_GenClass)::DownCast(aMeta->GetType(aCreator->GenClass()));
+ Handle(TColStd_HSequenceOfHAsciiString) theGenTypes = aCreator->GenTypes();
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Standard_Integer i,
+ itemLength;
+ Handle(MS_HSequenceOfGenType) realGentypes = aGenClass->GenTypes();
+
+ // we need this length because for item we must call
+ // CPP_BuildType and for nested class name we dont need.
+ //
+ itemLength = aGenClass->GenTypes()->Length();
+
+ for (i = 1; i <= theGenTypes->Length(); i++) {
+ if (!aGenClass->FullName()->IsSameString(theGenTypes->Value(i))) {
+ api->AddVariable(VDName,theGenTypes->Value(i)->ToCString());
+
+ // real name or Handle_name
+ //
+ if (i <= itemLength) {
+ if (!realGentypes->Value(i)->TYpeName().IsNull()) {
+ if (aMeta->IsDefined(realGentypes->Value(i)->TYpeName())) {
+ Handle(MS_Type) t = aMeta->GetType(realGentypes->Value(i)->TYpeName());
+
+ if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) c = *((Handle(MS_Class)*)&t);
+
+ // if the items constraint is handled, the item is not the handle,
+ // like in other cases, but the type himself.
+ //
+ // ex. : the item : 'i' as transient
+ // will be defined as #define i class
+ // the item : 'i' as any
+ // will be defined as #define i Handle_Class
+ //
+ if (c->IsPersistent() || c->IsTransient()) {
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->Apply(VARDefine,"ItemMDTVConstraintHandle");
+ api->Apply(VARUndefine,"ItemMDTVConstraintHandleUndef");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ else {
+ api->AddVariable(VDValue,CPP_BuildTypeOBJY(aMeta,aCreator->InstTypes()->Value(i))->ToCString());
+ }
+ }
+ }
+ }
+ else {
+ api->AddVariable(VDValue,CPP_BuildTypeOBJY(aMeta,aCreator->InstTypes()->Value(i))->ToCString());
+ }
+ api->AddVariable("%DBaseValue",aCreator->InstTypes()->Value(i)->ToCString());
+ }
+ // real name
+ //
+ else {
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->AddVariable("%DBaseValue",aCreator->InstTypes()->Value(i)->ToCString());
+ }
+
+ api->Apply(VARDefine,"ItemMDTVDefine");
+ api->Apply(VARUndefine,"ItemMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ }
+
+ for (i = itemLength + 1; i <= theGenTypes->Length(); i++) {
+ if (!aGenClass->FullName()->IsSameString(theGenTypes->Value(i))) {
+ Handle(TCollection_HAsciiString) realName = CPP_BuildTypeOBJY(aMeta,aCreator->InstTypes()->Value(i));
+
+ if (!realName->IsSameString(aCreator->InstTypes()->Value(i))) {
+ api->AddVariable(VDName,theGenTypes->Value(i)->ToCString());
+ api->AddVariable(VDValue,aCreator->InstTypes()->Value(i)->ToCString());
+ api->Apply(VARDefine,"ItemHandleMDTVDefine");
+ api->Apply(VARUndefine,"ItemHandleMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+ }
+ }
+
+ api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+ api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+ api->AddVariable("%DBaseValue",aCreator->FullName()->ToCString());
+
+ api->Apply(VARDefine,"ItemMDTVDefine");
+ api->Apply(VARUndefine,"ItemMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+
+ // #define TCollection_HSequence_Type_() TColStd_HSequenceOfTransient_Type_()
+ // #define Handle_TCollection_HSequence Handle_TColStd_HSequenceOfTransient
+ //
+ if (aGenClass->IsTransient() || aGenClass->IsPersistent()) {
+ api->AddVariable(VDName,aGenClass->FullName()->ToCString());
+ api->AddVariable(VDValue,aCreator->FullName()->ToCString());
+ api->Apply(VARDefine,"ItemHandleMDTVDefine");
+ api->Apply(VARUndefine,"ItemHandleMDTVUndefine");
+ publics->AssignCat(api->GetVariableValue(VARDefine));
+ protecteds->AssignCat(api->GetVariableValue(VARUndefine));
+ }
+
+ api->AddVariable(VARDefine,publics->ToCString());
+ api->AddVariable(VARUndefine,protecteds->ToCString());
+}
+
+// create a VArray OBJY dependent declaration for DBC instance
+// look EDL template : VArrayFieldOBJY
+//
+void CPP_BuildVArrayDeclarationOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const 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())) {
+// api->AddVariable(VDName,aClass->FullName()->ToCString());
+// api->AddVariable(VDValue,anInst->InstTypes()->Value(1)->ToCString());
+// api->Apply(VDValue,"VArrayDeclareOBJY");
+// Result->AssignCat(api->GetVariableValue(VDValue));
+// }
+// }
+}
+
+// create a VArray OBJY dependent field for DBC instance
+// look EDL template : VArrayFieldOBJY
+//
+void CPP_BuildVArrayFieldOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const 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())) {
+// api->AddVariable(VDName,aClass->FullName()->ToCString());
+// api->AddVariable(VDValue,anInst->InstTypes()->Value(1)->ToCString());
+// api->Apply(VDValue,"VArrayFieldOBJY");
+// Result->AssignCat(api->GetVariableValue(VDValue));
+// }
+// }
+}
+
+// build a c++ declaration method
+// the result is in the EDL variable VMethod
+//
+// template used :
+//
+// MethodTemplateDef
+// ConstructorTemplateDef
+// MethodTemplateDec
+// ConstructorTemplateDec
+// InlineMethodTemplateDec
+//
+// the EDL variables :
+// VMethodHeader : must contains the name of the template used for
+// methods construction
+// VConstructorHeader : must contains the name of the template used for
+// constructors construction
+//
+void CPP_BuildOidOBJYMethod(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& m,
+ const Handle(TCollection_HAsciiString)& methodName,
+ const Standard_Boolean forDeclaration = Standard_True)
+{
+ Handle(MS_InstMet) im;
+ Handle(MS_ClassMet) cm;
+ Handle(MS_Construc) ct;
+ Handle(MS_Param) retType;
+
+ Handle(TCollection_HAsciiString) MetTemplate,
+ ConTemplate;
+
+ Standard_Boolean InlineMethod;
+
+ MetTemplate = api->GetVariableValue(VMethodHeader);
+ ConTemplate = api->GetVariableValue(VConstructorHeader);
+
+ // here we process all the common attributes of methods
+ //
+ api->AddVariable(VMethodName,methodName->ToCString());
+ api->AddVariable(VVirtual,"");
+
+ // it s inline method ?
+ //
+ api->AddVariable(VIsInline,"yes");
+ InlineMethod = Standard_True;
+
+ api->AddVariable(VRetSpec,"");
+
+ // it s returning & ?
+ //
+ if (m->IsRefReturn()) {
+ api->AddVariable(VAnd,"&");
+ }
+ else {
+ api->AddVariable(VAnd,"");
+ }
+
+ api->AddVariable(VArgument,CPP_BuildParameterList(aMeta,m->Params(),forDeclaration)->ToCString());
+
+ // it s returning a type or void
+ //
+ retType = m->Returns();
+
+ if (!retType.IsNull()) {
+ api->AddVariable(VReturn,CPP_BuildType(aMeta,retType->TypeName())->ToCString());
+ }
+ else {
+ api->AddVariable(VReturn,"void");
+ }
+
+ // now the specials attributes
+ //
+ // instance methods
+ //
+ if (m->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ im = *((Handle(MS_InstMet)*)&m);
+
+ api->AddVariable(VIsCreateMethod,"no");
+ api->AddVariable(VMetSpec,"");
+ api->Apply(VMethod,MetTemplate->ToCString());
+ api->Apply(VMethod,"InlineMethodTemplateDec");
+ }
+}
+
+Handle(TCollection_HAsciiString) CPP_BuildOidImmTestOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& Method,
+ const Standard_Boolean UseMutability)
+{
+ Handle(TCollection_HAsciiString) body = new TCollection_HAsciiString;
+ Standard_Integer i;
+ Standard_Boolean testResult;
+ Handle(MS_HArray1OfParam) aSeqParam = Method->Params();
+
+ api->AddVariable(VMethodName,Method->Name()->ToCString());
+
+ if(!aSeqParam.IsNull()) {
+ for (i = 1; i <= aSeqParam->Length(); i++) {
+ if (aSeqParam->Value(i)->Type()->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Type) pType = aSeqParam->Value(i)->Type();
+ Handle(MS_Class) aPersClass = *((Handle_MS_Class*)&pType);
+
+ if (UseMutability) {
+ testResult = aSeqParam->Value(i)->IsMutable();
+ }
+ else {
+ testResult = aSeqParam->Value(i)->IsOut();
+ }
+
+ if (testResult && aPersClass->IsPersistent()) {
+ api->AddVariable(VDName,aSeqParam->Value(i)->Name()->ToCString());
+ api->Apply(VDName,"ImmutableTestOBJY");
+ body->AssignCat(api->GetVariableValue(VDName));
+ }
+ }
+ }
+ }
+ return body;
+}
+
+// Build the list of call for persistent oid methods and set the result at the end of
+// publics
+//
+Standard_Boolean CPP_BuildOidMethodCallOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Method)& Method,
+ const Handle(TCollection_HAsciiString)& publics)
+{
+ if (publics.IsNull()) return Standard_False;
+
+ Handle(MS_InstMet) method = Handle(MS_InstMet)::DownCast(Method);
+ Standard_Integer i;
+ Standard_Boolean result = Standard_True;
+ Handle(TCollection_HAsciiString) aname,
+ oldclass = api->GetVariableValue(VClass),
+ body,
+ immTest;
+ Handle(MS_HArray1OfParam) aSeqParam;
+
+ // templates for methods extraction
+ //
+ api->AddVariable(VMethodHeader,"ExternalMethodHeader");
+ api->AddVariable(VConstructorHeader,"ExternalConstructorHeader");
+
+ if (!method.IsNull()) {
+ body = new TCollection_HAsciiString;
+
+ aSeqParam = method->Params();
+
+ aname = new TCollection_HAsciiString("Oid_");
+ aname->AssignCat(method->Class());
+
+ // method header
+ //
+ api->AddVariable(VClass,aname->ToCString());
+ CPP_BuildOidOBJYMethod(aMeta,api,method,method->Name(),Standard_False);
+
+ api->AddVariable(VClass,method->Class()->ToCString());
+ api->AddVariable(VMethodName,method->Name()->ToCString());
+
+ // parameters
+ //
+ aname = new TCollection_HAsciiString(method->Name());
+ aname->AssignCat("(");
+
+ immTest = CPP_BuildOidImmTestOBJY(aMeta,api,method,Standard_True);
+
+ body->AssignCat(immTest);
+
+ // method call signature
+ //
+
+ if (!aSeqParam.IsNull()) {
+ aname->AssignCat(aSeqParam->Value(1)->Name());
+
+ for (i = 2; i <= aSeqParam->Length(); i++) {
+ aname->AssignCat(",");
+ aname->AssignCat(aSeqParam->Value(i)->Name());
+ }
+ }
+
+ aname->AssignCat(")");
+
+ // method call
+ //
+ api->AddVariable(VMethodName,aname->ToCString());
+
+ if (method->IsConst()) {
+ api->Apply(VMethodName,"ReadAccessOBJY");
+ }
+ else {
+ api->Apply(VMethodName,"UpdateAccessOBJY");
+ }
+
+ // returns value
+ //
+ if (!method->Returns().IsNull()) {
+ body->AssignCat(CPP_BuildType(aMeta,method->Returns()->TypeName()));
+ body->AssignCat(" _result = ");
+ body->AssignCat(api->GetVariableValue(VMethodName));
+
+ if (method->Returns()->Type()->IsKind(STANDARD_TYPE(MS_Class))) {
+ if (method->Returns()->IsMutable()) {
+ api->AddVariable(VDName,"_result");
+ api->AddVariable(VMethodName,method->Name()->ToCString());
+ api->Apply(VDName,"ImmutableTestOBJY");
+ body->AssignCat(api->GetVariableValue(VDName));
+ }
+ }
+ }
+ else {
+ body->AssignCat(api->GetVariableValue(VMethodName));
+ }
+
+ immTest = CPP_BuildOidImmTestOBJY(aMeta,api,method,Standard_False);
+ body->AssignCat(immTest);
+ body->AssignCat(" EndAccess();\n");
+
+ // return code
+ //
+ if (!method->Returns().IsNull()) {
+ body->AssignCat(" return _result;");
+ }
+
+ api->AddVariable(VMBody,body->ToCString());
+ api->Apply(VMethod,"MethodTemplateDef");
+
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+ else {
+ result = Standard_False;
+ }
+
+ // templates for methods extraction
+ //
+ api->AddVariable(VMethodHeader,"MethodHeader");
+ api->AddVariable(VConstructorHeader,"ConstructorHeader");
+ api->AddVariable(VClass,oldclass->ToCString());
+
+ return result;
+}
+
+// Extraction of a Persistent handle for OBJY
+//
+void CPP_PersistentHandleOBJY(const Handle(EDL_API)& api,
+ const Handle(TCollection_HAsciiString)& aClass,
+ const Handle(TCollection_HAsciiString)& aMother,
+ const Handle(TCollection_HAsciiString)& aFileName)
+{
+ // we create the handle...
+ //
+ api->AddVariable("%HPName",aClass->ToCString());
+ api->AddVariable("%HPInherits",aMother->ToCString());
+ api->Apply("%HPHandle","HandlePersistentOBJY");
+
+ // ...now we write the result
+ //
+ api->OpenFile("HTFile",aFileName->ToCString());
+ api->WriteFile("HTFile","%HPHandle");
+ api->CloseFile("HTFile");
+}
+
+
+// Extraction of a persistent .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_PersistentDerivatedOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ // we do this only on standard classes (not on inst classes)
+ //
+ if (theClass.IsNull()) return;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= inclist->Length(); i++) {
+ api->AddVariable(VIClass,inclist->Value(i)->ToCString());
+ api->Apply(VoutClass,"Include");
+ result->AssignCat(api->GetVariableValue(VoutClass));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ // include the hxx of me
+ //
+ api->AddVariable(VIClass,aClass->FullName()->ToCString());
+ api->Apply(VoutClass,"Include");
+ result->AssignCat(api->GetVariableValue(VoutClass));
+
+ api->AddVariable(VoutClass,result->ToCString());
+
+ aFileName->AssignCat(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+ aFileName->AssignCat(".jxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ result->Clear();
+ outfile->Append(aFileName);
+ }
+
+ CPP_ClassTypeMgt(aMeta,api,aClass,VTypeMgt);
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ aFileName->AssignCat(".ixx");
+ }
+ else {
+ aFileName->AssignCat("_0.cxx");
+ }
+
+ // Supplement
+ //
+ if (theClass->GetMyCreator().IsNull()) {
+ result->Clear();
+ }
+
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ api->AddVariable(VIClass,MS::GetPersistentRootName()->ToCString());
+ api->Apply(VMethods,"DownCast");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"DynamicType");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->AddVariable(VIClass,aClass->GetInheritsNames()->Value(1)->ToCString());
+ api->Apply(VMethods,"IsKind");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"FullEmptyHandleDestructorTemplate");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ if (!theClass->GetMyCreator().IsNull()) {
+ CPP_GenericDefine(aMeta,api,theClass->GetMyCreator(),VTICDefines,VTICUndefines,Standard_True);
+ result->AssignCat(api->GetVariableValue(VTICDefines));
+ api->AddVariable(VSuffix,"gxx");
+
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,theClass->GetMyCreator()->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+
+ api->Apply(VMethods,"IncludeNoSafe");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ api->AddVariable(VSuffix,"jxx");
+ }
+ else {
+ api->AddVariable(VSuffix,"hxx");
+ }
+
+ api->AddVariable(VMethods,result->ToCString());
+ api->Apply(VoutClass,"PersistentOBJYIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+// build a return, parameter or field type in c++
+// return a <type name> or a Handle_<type name>
+//
+Handle(TCollection_HAsciiString) CPP_BuildTypeOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aTypeName)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Type) aType;
+
+ if (aMeta->IsDefined(aTypeName)) {
+ aType = aMeta->GetType(aTypeName);
+
+ if (aType->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&aType);
+
+ aType = aMeta->GetType(analias->DeepType());
+ }
+
+ if (aType->IsKind(STANDARD_TYPE(MS_Class))) {
+ Handle(MS_Class) aClass;
+
+ aClass = *((Handle(MS_Class)*)&aType);
+
+ if (aClass->IsPersistent()) {
+ result->AssignCat("PHandle_");
+ result->AssignCat(aTypeName);
+ }
+ else if (aClass->IsTransient()) {
+ ErrorMsg << "CPPExt" << "type " << aType->FullName()->ToCString() << " is Transient an cannot be a field of a Persistent capable class" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ else {
+ result->AssignCat(aTypeName);
+ }
+ }
+ else {
+ result->AssignCat(aTypeName);
+ }
+ }
+ else {
+ ErrorMsg << "CPPExt" << "type " << aType->FullName()->ToCString() << " not defined..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ return result;
+}
+
+// Build a c++ field
+//
+Handle(TCollection_HAsciiString) CPP_BuildFieldOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Field)& aField)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_Type) aType;
+ Handle(TColStd_HSequenceOfInteger) dim;
+ Standard_Integer i;
+
+ result->AssignCat(CPP_BuildTypeOBJY(aMeta,aField->TYpe()));
+ result->AssignCat(" ");
+ result->AssignCat(aField->Name());
+
+ dim = aField->Dimensions();
+
+ for (i = 1; i <= dim->Length(); i++) {
+ result->AssignCat("[");
+ result->AssignCat(new TCollection_HAsciiString(dim->Value(i)));
+ result->AssignCat("]");
+ }
+
+ result->AssignCat(";\n");
+
+ return result;
+}
+
+// Extraction of a persistent class (inst or std)
+//
+void CPP_PersistentClassOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ if (!theClass.IsNull()) {
+ Standard_Integer i;
+
+ Handle(MS_HSequenceOfMemberMet) methods = theClass->GetMethods();
+ Handle(MS_Method) friendmethod;
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privates = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) SuppMethod = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) oidpubmethods = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) oidpromethods = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) oidprimethods = new TCollection_HAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+ Standard_Boolean HasInlineMethod = Standard_False,
+ HasDestructor = Standard_False;
+
+ Handle(TColStd_HSequenceOfHAsciiString) List = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) incp = new TColStd_HSequenceOfHAsciiString;
+
+ api->AddVariable(VTICIncludes,"");
+ api->AddVariable(VTICPublicfriends,"");
+ api->AddVariable(VTICProtectedfields,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICDefines,"");
+ api->AddVariable(VTICInlineIncludes,"");
+ api->AddVariable(VTICUndefines,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICPrivatefields,"");
+ api->AddVariable(VSuffix,"");
+ api->AddVariable(VTICSuppMethod,"");
+
+ api->AddVariable(VClass,theClass->FullName()->ToCString());
+ api->AddVariable(VInherits,theClass->GetInheritsNames()->Value(1)->ToCString());
+
+ for (i = 1; i <= theClass->GetFriendsNames()->Length(); i++) {
+ publics->AssignCat("friend ");
+ api->AddVariable(VIClass,theClass->GetFriendsNames()->Value(i)->ToCString());
+ api->Apply(VTICPublicfriends,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICPublicfriends));
+ }
+
+ if (!CPP_SetFriendMethod(aMeta,api,theClass->GetFriendMets(),publics)) {
+ ErrorMsg << "CPPExt" << "a friend method was not found..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ api->AddVariable(VTICPublicfriends,publics->ToCString());
+
+ publics->Clear();
+
+ // extraction of the methods : BEGIN
+ //
+ Handle(TCollection_HAsciiString) aliasMethod;
+
+ for (i = 1; i <= methods->Length(); i++) {
+ aliasMethod.Nullify();
+
+ if (methods->Value(i)->IsInline()) {
+ HasInlineMethod = Standard_True;
+ }
+
+ // if the class has no destructor, we give it
+ //
+ if (methods->Value(i)->IsDestructor()) {
+ HasDestructor = Standard_True;
+ }
+
+ if (!methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) {
+ if (!methods->Value(i)->Returns().IsNull()) {
+ MS::DispatchUsedType(aMeta,methods->Value(i)->Returns()->Type(),List,incp,Standard_True);
+ }
+ }
+
+ if (!methods->Value(i)->IsAlias().IsNull() || methods->Value(i)->IsDestructor()) {
+ aliasMethod = CPP_BuildAliasMethod(aMeta,api,methods->Value(i));
+ }
+
+ // Function Call c++ comment :
+ // it s must be in the _0.cxx or ixx file
+ // so we add it in the supplement sequence
+ //
+ if (methods->Value(i)->IsFunctionCall()) {
+ SuppMethod->AssignCat(CPP_BuildAliasMethod(aMeta,api,methods->Value(i)));
+ }
+
+ CPP_BuildMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+
+ api->Apply(VMethod,"MethodTemplateDec");
+
+ if (methods->Value(i)->Private()) {
+ privates->AssignCat(api->GetVariableValue(VMethod));
+
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ CPP_BuildOidOBJYMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+ api->Apply(VMethod,"MethodTemplateDec");
+ oidprimethods->AssignCat(api->GetVariableValue(VMethod));
+ CPP_BuildOidMethodCallOBJY(aMeta,api,methods->Value(i),SuppMethod);
+ }
+
+ if (!aliasMethod.IsNull()) {
+ privates->AssignCat(aliasMethod);
+ }
+ }
+ else if ((theClass->Deferred() && methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) ||
+ methods->Value(i)->IsProtected()) {
+ protecteds->AssignCat(api->GetVariableValue(VMethod));
+
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ CPP_BuildOidOBJYMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+ api->Apply(VMethod,"MethodTemplateDec");
+ oidpromethods->AssignCat(api->GetVariableValue(VMethod));
+ CPP_BuildOidMethodCallOBJY(aMeta,api,methods->Value(i),SuppMethod);
+ }
+
+ if (!aliasMethod.IsNull()) {
+ protecteds->AssignCat(aliasMethod);
+ }
+ }
+ else {
+ publics->AssignCat(api->GetVariableValue(VMethod));
+
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ CPP_BuildOidOBJYMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+ api->Apply(VMethod,"MethodTemplateDec");
+ oidpubmethods->AssignCat(api->GetVariableValue(VMethod));
+ CPP_BuildOidMethodCallOBJY(aMeta,api,methods->Value(i),SuppMethod);
+ }
+
+ if (!aliasMethod.IsNull()) {
+ publics->AssignCat(aliasMethod);
+ }
+ }
+ } // methods extraction : END
+
+ if (!HasDestructor) {
+ api->Apply(VMethod,"EmptyDestructorTemplate");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+
+ api->AddVariable(VTICPublicmets,publics->ToCString());
+ api->AddVariable(VTICPrivatemets,privates->ToCString());
+ api->AddVariable(VTICProtectedmets,protecteds->ToCString());
+ api->AddVariable(VTICOidpubMet,oidpubmethods->ToCString());
+ api->AddVariable(VTICOidproMet,oidpromethods->ToCString());
+ api->AddVariable(VTICOidpriMet,oidprimethods->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+ oidpubmethods->Clear();
+ oidpromethods->Clear();
+ oidprimethods->Clear();
+
+ // extraction of fields
+ //
+ Handle(MS_HSequenceOfField) fields = theClass->GetFields();
+
+ for (i = 1; i <= fields->Length(); i++) {
+ if (fields->Value(i)->Protected()) {
+ protecteds->AssignCat(CPP_BuildFieldOBJY(aMeta,fields->Value(i)));
+ }
+ else {
+ privates->AssignCat(CPP_BuildFieldOBJY(aMeta,fields->Value(i)));
+ }
+ }
+
+ api->AddVariable(VTICPrivatefields,privates->ToCString());
+ api->AddVariable(VTICProtectedfields,protecteds->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+
+ // others inline methods and functions (ex. function call)
+ //
+ api->AddVariable(VTICSuppMethod,SuppMethod->ToCString());
+
+ // include the lxx if the class have inline methods
+ //
+ if (HasInlineMethod) {
+ Handle(MS_InstClass) aCreator = theClass->GetMyCreator();
+
+ if (aCreator.IsNull()) {
+ api->AddVariable(VIClass,theClass->FullName()->ToCString());
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+ }
+ // this part is for class created by instantiations
+ //
+ else {
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,aCreator->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeMDTVNoSafe");
+
+ CPP_GenericMDTVDefineOBJY(aMeta,api,aCreator,VTICDefines,VTICUndefines,Standard_True);
+ }
+ }
+
+ CPP_UsedTypes(aMeta,theClass,List,incp);
+
+ publics->Clear();
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= List->Length(); i++) {
+ if (!List->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,List->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"Include");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+
+ for (i = 1; i <= incp->Length(); i++) {
+ if (!incp->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,incp->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ api->AddVariable(VTICIncludes,publics->ToCString());
+
+ api->Apply(VoutClass,"PersistentOBJYInstClass");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(theClass->FullName());
+ aFile->AssignCat("_objy.ddl");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ // .ixx or _0.cxx
+ //
+ if (!HasDestructor) {
+ api->Apply(VMethod,"FullEmptyDestructorTemplate");
+ Supplement->Append(new TCollection_HAsciiString(api->GetVariableValue(VMethod)));
+ }
+
+ CPP_PersistentDerivatedOBJY(aMeta,api,aClass,outfile,incp,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_PersistentClassOBJY - the class is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+// CLE
+//
+// 11/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Pointer.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <CPPExt_Define.hxx>
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_Pointer(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Pointer)& aPointer,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ if (aPointer.IsNull()) return;
+
+ Handle(TCollection_HAsciiString) aFileName;
+ Standard_Integer i;
+
+ // Hxx extraction
+ //
+ api->AddVariable(VClass,aPointer->FullName()->ToCString());
+ api->AddVariable(VInherits,aPointer->Type()->ToCString());
+
+ api->Apply(VoutClass,"PointerHXX");
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFileName->AssignCat(aPointer->FullName());
+ aFileName->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ outfile->Append(aFileName);
+}
+
--- /dev/null
+-- File: CPPExt_Standard.edl
+-- Author: Kernel
+-- History: Fri Dec 8 09:59:38 1995 Kernel Creation
+-- Copyright: Matra Datavision 1995
+
+@template HandleStandardTransient is
+$#ifndef _Handle_Standard_Transient_HeaderFile
+$#define _Handle_Standard_Transient_HeaderFile
+$
+$#ifndef _Standard_Macro_HeaderFile
+$#include <Standard_Macro.hxx>
+$#endif
+$#ifndef _Standard_PrimitiveTypes_HeaderFile
+$#include <Standard_PrimitiveTypes.hxx>
+$#endif
+$#ifndef _Standard_Transient_proto_HeaderFile
+$#include <Standard_Transient_proto.hxx>
+$#endif
+$
+$#ifndef UndefinedHandleAddress
+$#ifdef DECOSF1
+$#define UndefinedHandleAddress ((Standard_Transient *)0xfefdfefdfefd0000)
+$#else
+$#define UndefinedHandleAddress ((Standard_Transient *)0xfefd0000)
+$#endif
+$#endif
+$
+$class Standard_Transient;
+$class Handle_Standard_Type;
+$
+$Standard_Integer HashCode(const Handle(Standard_Transient)& ,const Standard_Integer);
+$
+$class Handle(Standard_Transient)
+$ {
+$ private:
+$
+$ Standard_Transient *entity;
+$
+$ void RaiseNullObject(const Standard_CString S) const;
+$
+$ void BeginScope() const
+$ {
+$ if (entity != UndefinedHandleAddress) entity->count++;
+$ }
+$
+$ void EndScope()
+$ {
+$ if (entity != UndefinedHandleAddress)
+$ {
+$ entity->count--;
+$ if (entity->count == 0) {
+$ entity->Delete();
+$ entity = UndefinedHandleAddress ;
+$ }
+$ }
+$ }
+$
+$
+$ public:
+$
+$ Handle(Standard_Transient)()
+$ {
+$ entity = UndefinedHandleAddress ;
+$ }
+$
+$ Handle(Standard_Transient)(const Handle(Standard_Transient)& aTid)
+$ {
+$ entity = aTid.entity;
+$ BeginScope();
+$ }
+$
+$ Handle(Standard_Transient)(const Standard_Transient *anItem)
+$ {
+$ if (!anItem)
+$ entity = UndefinedHandleAddress ;
+$ else
+$ entity = (Standard_Transient *)anItem;
+$ BeginScope();
+$ }
+$ void Dump(Standard_OStream& out) const;
+$ ~Handle(Standard_Transient)();
+$
+$ void ShallowDump(Standard_OStream&) const;
+$
+$ Standard_Boolean IsImmutable() const {
+$ return(Standard_False);
+$ };
+$
+$ void SetImmutable() {};
+$
+$ int operator==(const Handle(Standard_Transient)& right) const
+$ {
+$ return entity == right.entity;
+$ }
+$
+$ int operator==(const Standard_Transient *right) const
+$ {
+$ return entity == (Standard_Transient *)right;
+$ }
+$
+$ friend int operator==(const Standard_Transient *left, const Handle(Standard_Transient)& right)
+$ {
+$ return left == right.entity;
+$ }
+$
+$ int operator!=(const Handle(Standard_Transient)& right) const
+$ {
+$ return entity != right.entity;
+$ }
+$
+$ int operator!=(const Standard_Transient *right) const
+$ {
+$ return entity != right;
+$ }
+$
+$ friend int operator!=(const Standard_Transient *left, const Handle(Standard_Transient)& right)
+$ {
+$ return left != right.entity;
+$ }
+$
+$ void Nullify()
+$ {
+$ EndScope();
+$ entity = UndefinedHandleAddress ;
+$ }
+$
+$ Standard_Boolean IsNull() const
+$ {
+$ return entity == UndefinedHandleAddress ;
+$ }
+$
+$ protected:
+$
+$ Standard_Transient* Access() const
+$ {
+$ return entity;
+$ }
+$
+$ Standard_Transient* ControlAccess() const
+$ {
+$ return entity;
+$ }
+$
+$ void Assign(const Standard_Transient *anItem)
+$ {
+$ EndScope();
+$ if (!anItem)
+$ entity = UndefinedHandleAddress ;
+$ else
+$ entity = (Standard_Transient *)anItem;
+$ entity = (Standard_Transient *)anItem;
+$ BeginScope();
+$ }
+$
+$
+$ public:
+$
+$ operator Standard_Transient*()
+$ {
+$ return Access();
+$ }
+$
+$
+$ Handle(Standard_Transient)& operator=(const Handle(Standard_Transient)& aHandle);
+$ Handle(Standard_Transient)& operator=(const Standard_Transient* anItem);
+$
+$ Standard_Transient* operator->()
+$ {
+$ return ControlAccess();
+$ }
+$
+$ Standard_Transient* operator->() const
+$ {
+$ return ControlAccess();
+$ }
+$
+$ Standard_Transient& operator*()
+$ {
+$ return *(ControlAccess());
+$ }
+$
+$ const Standard_Transient& operator*() const
+$ {
+$ return *(ControlAccess());
+$ }
+$
+$ static const Handle(Standard_Transient) DownCast(const Handle(Standard_Transient)& AnObject);
+$
+$ friend void ShallowDump(const Handle_Standard_Transient&,Standard_OStream&);
+$
+$ };
+$
+$#ifndef _Standard_Type_HeaderFile
+$#include <Standard_Type.hxx>
+$#endif
+$
+$#endif
+@end;
+
+@template StandardTransient is
+$#ifndef _Standard_Transient_HeaderFile
+$#define _Standard_Transient_HeaderFile
+$
+$#ifndef _Handle_Standard_Transient_HeaderFile
+$#include <Handle_Standard_Transient.hxx>
+$#endif
+$#ifndef _Standard_PrimitiveTypes_HeaderFile
+$#include <Standard_PrimitiveTypes.hxx>
+$#endif
+$#ifndef _Standard_Transient_proto_HeaderFile
+$#include <Standard_Transient_proto.hxx>
+$#endif
+$#ifndef _Standard_Type_HeaderFile
+$#include <Standard_Type.hxx>
+$#endif
+$
+$#endif
+@end;
+
+@template StandardErrorHandler is
+$//============================================================================
+$//==== Titre: Standard_ErrorHandler.hxx
+$//==== Role : the header file of class "Standard_ErrorHandler".
+$//==== define the syntaxe "try" and "catch".
+$//============================================================================
+$
+$#ifndef _Standard_ErrorHandler_HeaderFile
+$#define _Standard_ErrorHandler_HeaderFile
+$
+$#ifndef _Standard_Failure_HeaderFile
+$#include <Standard_Failure.hxx>
+$#endif
+$
+$#include <stdlib.h>
+$#include <setjmp.h>
+$
+$class Standard_ErrorHandler
+${
+$ friend class Standard_Failure; // To execute the raise exception.
+$
+$ public:
+$
+$ Standard_ErrorHandler();
+$ ~Standard_ErrorHandler();
+$ Standard_Boolean Catches (const Handle(Standard_Type)&);
+$
+$ private:
+$ static void Abort();
+$ static void Error(const Handle(Standard_Failure)&);
+$ static Handle(Standard_Failure) LastCaughtError();
+$
+$ //==== The fields ===========================================================
+$ private:
+$ Standard_ErrorHandler* Previous;
+$ Handle(Standard_Failure) CaughtError;
+$
+$ public:
+$ jmp_buf Label;
+$
+$};
+$
+$
+$#include <Standard_ErrorHandler.lxx>
+$
+$#endif
+@end;
+
+@template StandardSStream is
+$#ifndef _Standard_SStream_HeaderFile
+$#define _Standard_SStream_HeaderFile
+$
+$#include <strstream.h>
+$
+$class Handle_Standard_Type;
+$
+$Handle_Standard_Type& Standard_SStream_Type_();
+$
+$class Standard_SStream : public strstreambase, public ostream {
+$
+$ public:
+$ Standard_SStream();
+$ Standard_SStream(ostream& );
+$
+$ ~Standard_SStream();
+$};
+$#endif
+@end;
+
+@template StandardIStream is
+$#ifndef _Standard_IStream_HeaderFile
+$#define _Standard_IStream_HeaderFile
+$
+$#include <stream.h>
+$
+$
+$class Handle_Standard_Type;
+$
+$Handle_Standard_Type& Standard_IStream_Type_();
+$
+$#define Standard_IStream istream
+$
+$#endif
+@end;
+
+@template StandardOStream is
+$#ifndef _Standard_OStream_HeaderFile
+$#define _Standard_OStream_HeaderFile
+$
+$#include <stream.h>
+$
+$
+$class Handle_Standard_Type;
+$
+$Handle_Standard_Type& Standard_OStream_Type_();
+$
+$#define Standard_OStream ostream
+$
+$#endif
+@end;
+
+@template HandleStandardPersistent is
+$//============================================================================
+$//
+$// Title : Handle_Standard_Persistent.hxx
+$// Role : This file just include <Standard_Persistent.hxx>
+$//
+$//============================================================================
+$
+$#ifndef _Handle_Standard_Persistent_HeaderFile
+$#define _Handle_Standard_Persistent_HeaderFile
+$#include <Handle_StandardDB_Persistent.hxx>
+$
+$#endif
+@end;
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <stdio.h>
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <MS_HArray1OfParam.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+// WARNING: DB Dependent functions
+//
+void CPP_BuildVArrayDeclarationOBJY(const Handle(MS_MetaSchema)&,const Handle(EDL_API)&,const Handle(MS_StdClass)&,const Handle(TCollection_HAsciiString)&);
+void CPP_BuildVArrayFieldOBJY(const Handle(MS_MetaSchema)&,const Handle(EDL_API)&,const Handle(MS_StdClass)&,const Handle(TCollection_HAsciiString)&);
+
+void CPP_BuildVArrayDeclarationCSFDB(const Handle(MS_MetaSchema)&,const Handle(EDL_API)&,const Handle(MS_StdClass)&,const Handle(TCollection_HAsciiString)&);
+void CPP_BuildVArrayFieldCSFDB(const Handle(MS_MetaSchema)&,const Handle(EDL_API)&,const Handle(MS_StdClass)&,const Handle(TCollection_HAsciiString)&);
+
+void CPP_BuildVArrayDeclarationOBJS(const Handle(MS_MetaSchema)&,const Handle(EDL_API)&,const Handle(MS_StdClass)&,const Handle(TCollection_HAsciiString)&);
+void CPP_BuildVArrayFieldOBJS(const Handle(MS_MetaSchema)&,const Handle(EDL_API)&,const Handle(MS_StdClass)&,const Handle(TCollection_HAsciiString)&);
+
+Handle(TCollection_HAsciiString) CPP_BuildFieldOBJY(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Field)& aField);
+// create a VArray dependent declaration for DBC instance
+//
+void CPP_BuildVArrayDeclaration(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const Handle(TCollection_HAsciiString)& Result)
+{
+ if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJY")) {
+ CPP_BuildVArrayDeclarationOBJY(aMeta,api,aClass,Result);
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJS")) {
+ CPP_BuildVArrayDeclarationOBJS(aMeta,api,aClass,Result);
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"CSFDB")) {
+ CPP_BuildVArrayDeclarationCSFDB(aMeta,api,aClass,Result);
+ }
+}
+
+// create a VArray dependent field for DBC instance
+//
+void CPP_BuildVArrayField(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_StdClass)& aClass,
+ const Handle(TCollection_HAsciiString)& Result)
+{
+ if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJY")) {
+ CPP_BuildVArrayFieldOBJY(aMeta,api,aClass,Result);
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJS")) {
+ CPP_BuildVArrayFieldOBJS(aMeta,api,aClass,Result);
+ }
+ else if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"CSFDB")) {
+ CPP_BuildVArrayFieldCSFDB(aMeta,api,aClass,Result);
+ }
+}
+
+// CSFDB extension for storable classes
+// only if %CPPEXTDBMS == "CSFDB"
+//
+void CPP_BuildStorableAccessFieldCSFDB(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Field)& field,
+ const Handle(TCollection_HAsciiString)& publics)
+{
+ Handle(MS_Type) thetype = aMeta->GetType(field->TYpe());
+
+ if (field->Dimensions()->Length() > 0) {
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) sdim = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) ddim = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) vdim = new TCollection_HAsciiString;
+ char num[30];
+
+
+ api->AddVariable("%CSFDBType",CPP_BuildType(aMeta,field->TYpe())->ToCString());
+ api->AddVariable("%Field",field->Name()->ToCString());
+
+ for (i = 1; i <= field->Dimensions()->Length(); i++) {
+ sdim->AssignCat("[");
+ sprintf(num,"%d",i);
+ sdim->AssignCat("i");
+ sdim->AssignCat(num);
+ sdim->AssignCat("]");
+
+ if (i != 1) {
+ vdim->AssignCat(",");
+ ddim->AssignCat(",");
+ }
+ vdim->AssignCat("const Standard_Integer i");
+ vdim->AssignCat(num);
+
+ ddim->AssignCat("i");
+ ddim->AssignCat(num);
+ }
+ api->AddVariable("%FDim",sdim->ToCString());
+ api->AddVariable("%VarDim",vdim->ToCString());
+ api->AddVariable("%Dimension",ddim->ToCString());
+ api->Apply("%res","DefFuncFieldArray");
+ }
+ else {
+ api->AddVariable("%CSFDBType",field->TYpe()->ToCString());
+ api->AddVariable("%Field",field->Name()->ToCString());
+
+ if (thetype->IsKind(STANDARD_TYPE(MS_StdClass))) {
+ Handle(MS_StdClass) aclass = *((Handle(MS_StdClass)*)&thetype);
+
+ if (aclass->IsPersistent()) {
+ api->Apply("%res","DefFuncPField");
+ }
+ else {
+ api->Apply("%res","DefFuncSField");
+ }
+ }
+ else {
+ api->Apply("%res","DefFuncPrField");
+ }
+ }
+
+ publics->AssignCat(api->GetVariableValue("%res"));
+}
+
+// Extraction of a transient .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_StorableDerivated(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ // we do this only on standard classes (not on inst classes)
+ //
+ if (theClass.IsNull()) return;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= inclist->Length(); i++) {
+ api->AddVariable(VIClass,inclist->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+ }
+
+
+ if (theClass->GetMyCreator().IsNull()) {
+ // include hxx of me
+ //
+ api->AddVariable(VIClass,aClass->FullName()->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+
+ api->AddVariable(VoutClass,result->ToCString());
+
+ aFileName->AssignCat(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+ aFileName->AssignCat(".jxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ result->Clear();
+ outfile->Append(aFileName);
+ }
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ aFileName->AssignCat(".ixx");
+ }
+ else {
+ aFileName->AssignCat("_0.cxx");
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ result->Clear();
+ }
+
+ // Type Management and supplement
+ //
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ CPP_ClassTypeMgt(aMeta,api,aClass,VTypeMgt);
+
+ result->AssignCat(api->GetVariableValue(VTypeMgt));
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ if (!theClass->GetMyCreator().IsNull()) {
+ CPP_GenericDefine(aMeta,api,theClass->GetMyCreator(),VTICDefines,VTICUndefines,Standard_False);
+ result->AssignCat(api->GetVariableValue(VTICDefines));
+ api->AddVariable(VSuffix,"gxx");
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,theClass->GetMyCreator()->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->Apply(VMethods,"IncludeNoSafe");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+
+ api->AddVariable(VMethods,result->ToCString());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ api->AddVariable(VSuffix,"jxx");
+ }
+ else {
+ api->AddVariable(VSuffix,"hxx");
+ }
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->Apply(VoutClass,"StorableIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_StorableClass(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ if (!theClass.IsNull()) {
+ Standard_Integer i;
+
+ Handle(MS_HSequenceOfMemberMet) methods = theClass->GetMethods();
+ Handle(MS_Method) friendmethod;
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privates = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protf = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privf = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) SuppMethod = new TCollection_HAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+
+ Standard_Boolean HasInlineMethod = Standard_False,
+ HasDestructor = Standard_False,
+ HasEmptyConst = Standard_False,
+ HasConstructor = Standard_False;
+
+
+ api->AddVariable(VTICIncludes,"");
+ api->AddVariable(VTICPublicfriends,"");
+ api->AddVariable(VTICProtectedfields,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICDefines,"");
+ api->AddVariable(VTICInlineIncludes,"");
+ api->AddVariable(VTICUndefines,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICPrivatefields,"");
+ api->AddVariable(VSuffix,"");
+ api->AddVariable(VTICSuppMethod,"");
+
+ if (theClass->GetInheritsNames()->Length() > 0) {
+ if (!theClass->GetInheritsNames()->Value(1)->IsSameString(MS::GetStorableRootName())) {
+ publics->AssignCat(" : public ");
+ publics->AssignCat(theClass->GetInheritsNames()->Value(1));
+ api->AddVariable(VInherits,publics->ToCString());
+ publics->Clear();
+ }
+ else {
+ api->AddVariable(VInherits,"");
+ }
+ }
+ else {
+ api->AddVariable(VInherits,"");
+ }
+
+ api->AddVariable(VClass,theClass->FullName()->ToCString());
+ api->AddVariable("%NameField",theClass->FullName()->ToCString());
+
+ for (i = 1; i <= theClass->GetFriendsNames()->Length(); i++) {
+ publics->AssignCat("friend ");
+ api->AddVariable(VIClass,theClass->GetFriendsNames()->Value(i)->ToCString());
+ api->Apply(VTICPublicfriends,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICPublicfriends));
+ }
+
+ if (!CPP_SetFriendMethod(aMeta,api,theClass->GetFriendMets(),publics)) {
+ ErrorMsg << "CPPExt" << "Error : a friend method was not found..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ api->AddVariable(VTICPublicfriends,publics->ToCString());
+
+ publics->Clear();
+
+ // extraction of the methods
+ //
+ Handle(TCollection_HAsciiString) aliasMethod;
+
+ for (i = 1; i <= methods->Length(); i++) {
+ aliasMethod.Nullify();
+
+ if (methods->Value(i)->IsInline()) {
+ HasInlineMethod = Standard_True;
+ }
+
+ // if the class has no destructor we give it
+ //
+ if (methods->Value(i)->IsDestructor()) {
+ HasDestructor = Standard_True;
+ }
+
+ if (!methods->Value(i)->IsAlias().IsNull() || methods->Value(i)->IsDestructor()) {
+ aliasMethod = CPP_BuildAliasMethod(aMeta,api,methods->Value(i));
+ }
+
+ // if the class has no empty constructor, we give it
+ //
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) {
+ if (methods->Value(i)->Params().IsNull()) {
+ HasEmptyConst = Standard_True;
+ }
+
+ HasConstructor = Standard_True;
+ }
+
+ // Function Call c++ comment :
+ // it s must be in the _0.cxx or ixx file
+ // so we add it in the supplement sequence
+ //
+ if (methods->Value(i)->IsFunctionCall()) {
+ SuppMethod->AssignCat(CPP_BuildAliasMethod(aMeta,api,methods->Value(i)));
+ }
+
+ CPP_BuildMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+
+#ifdef WNT
+ if ( !methods -> Value ( i ) -> IsInline () )
+#endif // WNT
+ api->Apply(VMethod,"MethodTemplateDec");
+#ifdef WNT
+ else
+ api->Apply(VMethod,"MethodTemplateDecInlineWNT" );
+#endif // WNT
+
+ if (methods->Value(i)->Private()) {
+ privates->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ privates->AssignCat(aliasMethod);
+ }
+ }
+ else if ((theClass->Deferred() && methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) ||
+ methods->Value(i)->IsProtected()) {
+ protecteds->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ protecteds->AssignCat(aliasMethod);
+ }
+ }
+ else {
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ publics->AssignCat(aliasMethod);
+ }
+ }
+ }
+
+ if (!HasEmptyConst && (aClass->GetFields()->Length() > 0)) {
+ api->AddVariable("%Class",aClass->FullName()->ToCString());
+ api->AddVariable("%Arguments"," ");
+ api->Apply(VMethod,"ConstructorHeader");
+ api->AddVariable(VMBody,"");
+ api->Apply(VMethod,"MethodTemplateDef");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+
+ // extraction of fields
+ // WARNING: DB dependent
+ //
+ Handle(MS_HSequenceOfField) fields = theClass->GetFields();
+
+ for (i = 1; i <= fields->Length(); i++) {
+ if (fields->Value(i)->Protected()) {
+ if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJY")) {
+ protf->AssignCat(CPP_BuildFieldOBJY(aMeta,fields->Value(i)));
+ }
+ else {
+ protf->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ }
+ else {
+ if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"OBJY")) {
+ privf->AssignCat(CPP_BuildFieldOBJY(aMeta,fields->Value(i)));
+ }
+ else {
+ privf->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ }
+ if (!strcmp(api->GetVariableValue("%CPPEXTDBMS")->ToCString(),"CSFDB")) {
+ CPP_BuildStorableAccessFieldCSFDB(aMeta,api,fields->Value(i),publics);
+ }
+ }
+
+ // for DBC instance
+ //
+ CPP_BuildVArrayField(aMeta,api,theClass,privates);
+
+ api->AddVariable(VTICPrivatefields,privf->ToCString());
+ api->AddVariable(VTICProtectedfields,protf->ToCString());
+ api->AddVariable(VTICPublicmets,publics->ToCString());
+ api->AddVariable(VTICPrivatemets,privates->ToCString());
+ api->AddVariable(VTICProtectedmets,protecteds->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+ privf->Clear();
+ protf->Clear();
+
+ // others inline methods and functions (ex. function call)
+ //
+ api->AddVariable(VTICSuppMethod,SuppMethod->ToCString());
+
+ // include the lxx if the class have inline methods
+ //
+ if (HasInlineMethod) {
+ Handle(MS_InstClass) aCreator = theClass->GetMyCreator();
+
+ if (aCreator.IsNull()) {
+ api->AddVariable(VIClass,theClass->FullName()->ToCString());
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+ }
+ // this part is for class created by instantiations
+ //
+ else {
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,aCreator->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+
+ CPP_GenericDefine(aMeta,api,aCreator,VTICDefines,VTICUndefines,Standard_False);
+ }
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) List = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) incp = new TColStd_HSequenceOfHAsciiString;
+
+ CPP_UsedTypes(aMeta,theClass,List,incp);
+
+ publics->Clear();
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= List->Length(); i++) {
+ if (!List->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,List->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VTICIncludes,"IncludeNoSafe");
+#else
+ api->Apply(VTICIncludes,"Include");
+#endif
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ // a storable class must include Standard_PrimitiveTypes.hxx
+ //
+ api->AddVariable(VIClass,"Standard_PrimitiveTypes");
+ api->Apply(VTICIncludes,"Include");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+
+ for (i = 1; i <= incp->Length(); i++) {
+ if (!incp->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,incp->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ // for DBC instance
+ //
+ CPP_BuildVArrayDeclaration(aMeta,api,theClass,publics);
+
+ api->AddVariable(VTICIncludes,publics->ToCString());
+
+ api->Apply(VoutClass,"StorableClass");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(theClass->FullName());
+ aFile->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ CPP_StorableDerivated(aMeta,api,aClass,outfile,incp,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_StorableClass - the class is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+-- File: CPPExt_Template.edl
+-- Author: Kernel (CLE)
+-- History: Tue Sep 19 17:25:59 1995 Kernel Creation
+-- Copyright: Matra Datavision 1995
+-- Purpose: C++ extractor
+
+-- ====================================
+-- for extraction of a transient handle
+-- ====================================
+
+@verboseoff;
+
+@template HandleTransient (%HTName,%HTInherits) is
+$// File generated by CPPExt (Transient)
+$//
+$// 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 _Handle_%HTName_HeaderFile
+$#define _Handle_%HTName_HeaderFile
+$
+$#ifndef _Standard_Macro_HeaderFile
+$#include <Standard_Macro.hxx>
+$#endif
+$#ifndef _Standard_HeaderFile
+$#include <Standard.hxx>
+$#endif
+$
+$#ifndef _Handle_%HTInherits_HeaderFile
+$#include <Handle_%HTInherits.hxx>
+$#endif
+$
+$class Standard_Transient;
+$class Handle_Standard_Type;
+$class Handle(%HTInherits);
+$class %HTName;
+$Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(%HTName);
+$
+$class Handle(%HTName) : public Handle(%HTInherits) {
+$ public:
+$ inline void* operator new(size_t,void* anAddress)
+$ {
+$ return anAddress;
+$ }
+$ inline void* operator new(size_t size)
+$ {
+$ return Standard::Allocate(size);
+$ }
+$ inline void operator delete(void *anAddress, size_t size)
+$ {
+$ if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
+$ }
+$ Handle(%HTName)():Handle(%HTInherits)() {}
+$ Handle(%HTName)(const Handle(%HTName)& aHandle) : Handle(%HTInherits)(aHandle)
+$ {
+$ }
+$
+$ Handle(%HTName)(const %HTName* anItem) : Handle(%HTInherits)((%HTInherits *)anItem)
+$ {
+$ }
+$
+$ Handle(%HTName)& operator=(const Handle(%HTName)& aHandle)
+$ {
+$ Assign(aHandle.Access());
+$ return *this;
+$ }
+$
+$ Handle(%HTName)& operator=(const %HTName* anItem)
+$ {
+$ Assign((Standard_Transient *)anItem);
+$ return *this;
+$ }
+$
+$ %HTName* operator->()
+$ {
+$ return (%HTName *)ControlAccess();
+$ }
+$
+$ %HTName* operator->() const
+$ {
+$ return (%HTName *)ControlAccess();
+$ }
+$
+$ Standard_EXPORT ~Handle(%HTName)();
+$
+$ Standard_EXPORT static const Handle(%HTName) DownCast(const Handle(Standard_Transient)& AnObject);
+$};
+$#endif
+@end;
+
+
+-- ===============================
+-- extraction of a transient class
+-- ===============================
+
+@template TransientInstClass (%Class,
+ %TICIncludes,
+ %Inherits,
+ %TICPublicmets,
+ %TICPublicfriends,
+ %TICProtectedmets,
+ %TICProtectedfields,
+ %TICPrivatemets,
+ %TICPrivatefields,
+ %TICPrivatefriends,
+ %TICDefines,
+ %TICInlineIncludes,
+ %TICUndefines,
+ %TICSuppMethod) is
+$// File generated by CPPExt (Transient)
+$//
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$#ifndef _Standard_HeaderFile
+$#include <Standard.hxx>
+$#endif
+$#ifndef _Handle_%Class_HeaderFile
+$#include <Handle_%Class.hxx>
+$#endif
+$
+$%TICIncludes
+$
+$class %Class : public %Inherits {
+$
+$public:
+$
+$ inline void* operator new(size_t,void* anAddress)
+$ {
+$ return anAddress;
+$ }
+$ inline void* operator new(size_t size)
+$ {
+$ return Standard::Allocate(size);
+$ }
+$ inline void operator delete(void *anAddress, size_t size)
+$ {
+$ if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
+$ }
+$ // Methods PUBLIC
+$ //
+$%TICPublicmets
+$
+$%TICPublicfriends
+$
+$ // Type management
+$ //
+$ Standard_EXPORT friend Handle_Standard_Type& %Class_Type_();
+$ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+$ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+$
+$protected:
+$
+$ // Methods PROTECTED
+$ //
+$%TICProtectedmets
+$
+$ // Fields PROTECTED
+$ //
+$%TICProtectedfields
+$
+$private:
+$
+$ // Methods PRIVATE
+$ //
+$%TICPrivatemets
+$
+$ // Fields PRIVATE
+$ //
+$%TICPrivatefields
+$%TICPrivatefriends
+$};
+$
+$%TICDefines
+$%TICInlineIncludes
+$%TICUndefines
+$
+$// other inline functions and methods (like "C++: function call" methods)
+$//
+$%TICSuppMethod
+$
+$#endif
+@end;
+
+@template TransientIxx (%Class,%Suffix,%Supplement,%TypeMgt,%Methods) is
+$// File generated by CPPExt (Transient)
+$// 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.
+$//
+$#include <%Class.%Suffix>
+$
+$#ifndef _Standard_TypeMismatch_HeaderFile
+$#include <Standard_TypeMismatch.hxx>
+$#endif
+$
+$%Supplement
+$
+$%TypeMgt
+$
+$%Methods
+@end;
+
+-- ================================
+-- extraction of a normal c++ class
+-- ================================
+
+@template MPVClass (%Class,
+ %TICIncludes,
+ %Inherits,
+ %TICPublicmets,
+ %TICPublicfriends,
+ %TICProtectedmets,
+ %TICProtectedfields,
+ %TICPrivatemets,
+ %TICPrivatefields,
+ %TICPrivatefriends,
+ %TICDefines,
+ %TICInlineIncludes,
+ %TICUndefines,
+ %TICSuppMethod) is
+$// File generated by CPPExt (Value)
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$%TICIncludes
+$
+$#ifndef _Standard_HeaderFile
+$#include <Standard.hxx>
+$#endif
+$#ifndef _Standard_Macro_HeaderFile
+$#include <Standard_Macro.hxx>
+$#endif
+$
+$class %Class %Inherits {
+$
+$public:
+$
+$ inline void* operator new(size_t,void* anAddress)
+$ {
+$ return anAddress;
+$ }
+$ inline void* operator new(size_t size)
+$ {
+$ return Standard::Allocate(size);
+$ }
+$ inline void operator delete(void *anAddress, size_t size)
+$ {
+$ if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
+$ }
+$ // Methods PUBLIC
+$ //
+$%TICPublicmets
+$
+$%TICPublicfriends
+$
+$
+$protected:
+$
+$ // Methods PROTECTED
+$ //
+$%TICProtectedmets
+$
+$ // Fields PROTECTED
+$ //
+$%TICProtectedfields
+$
+$private:
+$
+$ // Methods PRIVATE
+$ //
+$%TICPrivatemets
+$
+$ // Fields PRIVATE
+$ //
+$%TICPrivatefields
+$%TICPrivatefriends
+$};
+$
+$%TICDefines
+$%TICInlineIncludes
+$%TICUndefines
+$
+$// other inline functions and methods (like "C++: function call" methods)
+$//
+$%TICSuppMethod
+$
+$#endif
+@end;
+
+@template MPVIxx (%Class,%Suffix,%Supplement,%Methods) is
+$// File generated by CPPExt (Value)
+$// 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.
+$//
+$#include <%Class.%Suffix>
+$
+$%Supplement
+$
+$%Methods
+@end;
+
+-- ==============================
+-- extraction of a storable class
+-- ==============================
+
+@template StorableClass(%Class,
+ %TICIncludes,
+ %Inherits,
+ %TICPublicmets,
+ %TICPublicfriends,
+ %TICProtectedmets,
+ %TICProtectedfields,
+ %TICPrivatemets,
+ %TICPrivatefields,
+ %TICPrivatefriends,
+ %TICDefines,
+ %TICInlineIncludes,
+ %TICUndefines,
+ %TICSuppMethod) is
+$// File generated by CPPExt (Storable)
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$%TICIncludes
+$
+$#ifndef _Standard_HeaderFile
+$#include <Standard.hxx>
+$#endif
+$#ifndef _Standard_Macro_HeaderFile
+$#include <Standard_Macro.hxx>
+$#endif
+$
+$Standard_EXPORT Handle_Standard_Type& %Class_Type_();
+$
+$class %Class %Inherits {
+$
+$public:
+$ inline void* operator new(size_t,void* anAddress)
+$ {
+$ return anAddress;
+$ }
+$ inline void* operator new(size_t size)
+$ {
+$ return Standard::Allocate(size);
+$ }
+$ inline void operator delete(void *anAddress, size_t size)
+$ {
+$ if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
+$ }
+$
+$ // Methods PUBLIC
+$ //
+$%TICPublicmets
+$
+$%TICPublicfriends
+$
+$ // Type management
+$ //
+$ Standard_EXPORT friend Handle_Standard_Type& %Class_Type_();
+$
+$protected:
+$
+$ // Methods PROTECTED
+$ //
+$%TICProtectedmets
+$
+$ // Fields PROTECTED
+$ //
+$%TICProtectedfields
+$
+$private:
+$
+$ // Methods PRIVATE
+$ //
+$%TICPrivatemets
+$
+$ // Fields PRIVATE
+$ //
+$%TICPrivatefields
+$%TICPrivatefriends
+$};
+$
+$%TICDefines
+$%TICInlineIncludes
+$%TICUndefines
+$
+$// other inline functions and methods (like "C++: function call" methods)
+$//
+$%TICSuppMethod
+$
+$#endif
+@end;
+
+@template StorableIxx(%Class,%Suffix,%Supplement,%Methods) is
+$// File generated by CPPExt (Storable)
+$// 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.
+$//
+$#include <%Class.%Suffix>
+$
+$#ifndef _Standard_Type_HeaderFile
+$#include <Standard_Type.hxx>
+$#endif
+$#ifndef _Standard_TypeMismatch_HeaderFile
+$#include <Standard_TypeMismatch.hxx>
+$#endif
+$
+$%Supplement
+$
+$%Methods
+@end;
+
+-- ===============
+-- Enum extraction
+-- ===============
+
+@template EnumHXX(%Class,%Values) is
+$// File generated by CPPExt (Enum)
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$enum %Class {
+$ %Values
+$};
+$
+$
+$#ifndef _Standard_PrimitiveTypes_HeaderFile
+$#include <Standard_PrimitiveTypes.hxx>
+$#endif
+$
+$#endif
+@end;
+
+@template EnumCXX(%Class,%Values,%Nb) is
+$// File generated by CPPExt (Enum)
+$// 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.
+$//
+@end;
+
+-- ================
+-- Alias extraction
+-- ================
+@template AliasHXX(%Class,%Inherits, %HandleTypedef) is
+$// File generated by CPPExt (Alias)
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$#ifndef _%Inherits_HeaderFile
+$#include <%Inherits.hxx>
+$#endif
+$
+$typedef %Inherits %Class;
+$%HandleTypedef
+$
+$#define %Class_Type_() %Inherits_Type_()
+$#endif
+@end;
+
+-- ==================
+-- Pointer extraction
+-- ==================
+
+@template PointerHXX(%Class,%Inherits) is
+$// File generated by CPPExt (Pointer)
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$class %Inherits;
+$
+$typedef %Inherits* %Class;
+$
+$#endif
+@end;
+
+-- =====================
+-- Exceptions extraction
+-- =====================
+@template ExceptionHXX(%Class,%Inherits) is
+$// File generated by CPPExt (Exception)
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$#ifndef _Standard_HeaderFile
+$#include <Standard.hxx>
+$#endif
+$#ifndef _Handle_%Class_HeaderFile
+$#include <Handle_%Class.hxx>
+$#endif
+$
+$#ifndef _Standard_SStream_HeaderFile
+$#include <Standard_SStream.hxx>
+$#endif
+$
+$
+$#ifndef _%Inherits_HeaderFile
+$#include <%Inherits.hxx>
+$#endif
+$
+$
+$#if !defined No_Exception && !defined No_%Class
+$#define %Class_Raise_if(CONDITION,MESSAGE) \
+$ if (CONDITION) %Class::Raise(MESSAGE);
+$#else
+$#define %Class_Raise_if(CONDITION,MESSAGE)
+$#endif
+$
+$class %Class : public %Inherits {
+$
+$ inline void* operator new(size_t,void* anAddress)
+$ {
+$ return anAddress;
+$ }
+$ inline void* operator new(size_t size)
+$ {
+$ return Standard::Allocate(size);
+$ }
+$ inline void operator delete(void *anAddress, size_t size)
+$ {
+$ if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
+$ }
+$public:
+$ Standard_EXPORT static void Raise(const Standard_CString aMessage = "");
+$ Standard_EXPORT static void Raise(Standard_SStream& aReason);
+$#ifndef NO_CXX_EXCEPTION
+$ Standard_EXPORT virtual void Throw() const ;
+$#endif
+$
+$ Standard_EXPORT ~%Class();
+$
+$ // Type methods
+$ //
+$ Standard_EXPORT friend Handle_Standard_Type& %Class_Type_();
+$ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+$ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+$};
+$
+$#endif
+@end;
+
+@template ExceptionMethod(%Class) is
+$%Class::~%Class(){}
+$
+$void %Class::Raise(Standard_SStream& aReason)
+${
+$ Handle(%Class) _E(new %Class);
+$ _E->Reraise (aReason.rdbuf()->str());
+$}
+$
+$void %Class::Raise(const Standard_CString AString)
+${
+$ Handle(%Class) _E (new %Class);
+$ _E->Reraise(AString);
+$}
+$#ifndef NO_CXX_EXCEPTION
+$void %Class::Throw() const
+${
+$ throw %Class() ;
+$}
+$#endif
+@end;
+
+-- ==============
+-- misc templates
+-- ==============
+
+@template Include(%IClass,%Suffix) is
+$#ifndef _%IClass_HeaderFile
+$#include <%IClass.%Suffix>
+$#endif
+@end;
+
+@template IncludeNoSafe(%IClass,%Suffix) is
+$#include <%IClass.%Suffix>
+@end;
+
+@template Define(%DName,%DValue) is
+$#define %DName %DValue
+@end;
+
+@template ItemDefine(%DName,%DValue,%DBaseValue) is
+$#define %DName %DValue
+$#define %DName_hxx <%DBaseValue.hxx>
+@end;
+
+@template ItemConstraintHandle(%DName,%DValue) is
+$#define Handle_%DName Handle_%DValue
+@end;
+
+@template ItemHandleDefine (%DName,%DValue) is
+$#define Handle_%DName Handle_%DValue
+$#define %DName_Type_() %DValue_Type_()
+@end;
+
+@template Undefine(%DName) is
+$#undef %DName
+@end;
+
+@template ItemUndefine(%DName) is
+$#undef %DName
+$#undef %DName_hxx
+@end;
+
+@template ItemConstraintHandleUndef(%DName) is
+$#undef Handle_%DName
+@end;
+
+@template ItemHandleUndefine(%DName) is
+$#undef Handle_%DName
+$#undef %DName_Type_
+@end;
+
+@template ShortDec(%IClass) is
+$class %IClass;
+@end;
+
+-- ==============================================
+-- Methods templates
+-- ==============================================
+
+@template ConstructorHeader(%Class,%Arguments) is
+$%Class(%Arguments)\^
+@end;
+
+@template MethodHeader(%Virtual,%RetSpec,%Return,%And,%MethodName,%Arguments,%MetSpec) is
+$%Virtual %RetSpec %Return%And %MethodName(%Arguments) %MetSpec\^
+@end;
+
+@template ExternalConstructorHeader(%Class,%Arguments) is
+$%Class::%Class(%Arguments)\^
+@end;
+
+@template ExternalMethodHeader(%Class,%Virtual,%RetSpec,%Return,%And,%MethodName,%Arguments,%MetSpec) is
+$%Virtual %RetSpec %Return%And %Class::%MethodName(%Arguments) %MetSpec\^
+@end;
+
+@template MethodTemplateDec(%Method) is
+$Standard_EXPORT %Method;
+@end;
+
+@template MethodTemplateDecInlineWNT(%Method) is
+$%Method;
+@end;
+
+@template InlineMethodTemplateDec(%Method) is
+$inline %Method\^
+@end;
+
+@template MethodTemplateDef(%Method,%MBody) is
+$%Method
+${
+$ %MBody
+$}
+$
+@end;
+
+@template EmptyDestructorTemplate(%Class) is
+$Standard_EXPORT ~%Class();
+@end;
+
+@template FullEmptyHandleDestructorTemplate(%Class) is
+$Handle_%Class::~Handle_%Class() {}
+@end;
+
+@template FullEmptyDestructorTemplate(%Class) is
+$%Class::~%Class() {}
+@end;
+
+-- ===============
+-- current methods
+-- ===============
+
+-- type management : BEGIN
+
+@template TypeMgtAncestorType(%Nb) is
+$aType%Nb\^
+@end;
+
+@template TypeMgtAncestor(%Nb,%Ancestors) is
+$ static Handle_Standard_Type %Nb = STANDARD_TYPE(%Ancestors);
+$ if ( %Nb.IsNull()) %Nb = STANDARD_TYPE(%Ancestors);
+@end;
+
+@template TypeMgt(%Class,%Inherits,%Ancestors) is
+$
+$Standard_EXPORT Handle_Standard_Type& %Class_Type_()
+${
+$
+$ %Inherits
+$
+$ static Handle_Standard_Transient _Ancestors[]= {%AncestorsNULL};
+$ static Handle_Standard_Type _aType = new Standard_Type("%Class",
+$ sizeof(%Class),
+$ 1,
+$ (Standard_Address)_Ancestors,
+$ (Standard_Address)NULL);
+$
+$ return _aType;
+$}
+@end;
+
+-- type management : END
+
+@template DownCast(%Class,%IClass) is
+$// DownCast method
+$// allow safe downcasting
+$//
+$const Handle(%Class) Handle(%Class)::DownCast(const Handle(%IClass)& AnObject)
+${
+$ Handle(%Class) _anOtherObject;
+$
+$ if (!AnObject.IsNull()) {
+$ if (AnObject->IsKind(STANDARD_TYPE(%Class))) {
+$ _anOtherObject = Handle(%Class)((Handle(%Class)&)AnObject);
+$ }
+$ }
+$
+$ return _anOtherObject ;
+$}
+@end;
+
+@template DynamicType(%Class) is
+$const Handle(Standard_Type)& %Class::DynamicType() const
+${
+$ return STANDARD_TYPE(%Class) ;
+$}
+@end;
+
+@template IsKind(%Class,%IClass) is
+$Standard_Boolean %Class::IsKind(const Handle(Standard_Type)& AType) const
+${
+$ return (STANDARD_TYPE(%Class) == AType || %IClass::IsKind(AType));
+$}
+@end;
--- /dev/null
+-- File: CPPExt_TemplateCSFDB.edl
+-- Author: Kernel
+-- History: Thu Dec 21 08:27:18 1995 Kernel Creation
+-- Copyright: Matra Datavision 1995
+
+-- =================================
+-- extraction of a persistent handle
+-- =================================
+
+@template HandlePersistentCSFDB(%HPName,%HPInherits) is
+$#ifndef _Handle_%HPName_HeaderFile
+$#define _Handle_%HPName_HeaderFile
+$
+$#ifndef _Standard_Macro_HeaderFile
+$#include <Standard_Macro.hxx>
+$#endif
+$
+$#ifndef _Handle_%HPInherits_HeaderFile
+$#include <Handle_%HPInherits.hxx>
+$#endif
+$#ifndef _Standard_HeaderFile
+$#include <Standard.hxx>
+$#endif
+$
+$class Standard_Persistent;
+$class Handle_Standard_Type;
+$class Handle(%HPInherits);
+$class %HPName;
+$Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(%HPName);
+$
+$class Handle(%HPName) : public Handle(%HPInherits) {
+$ public:
+$
+$ inline void* operator new(size_t,void* anAddress)
+$ {
+$ return anAddress;
+$ }
+$ inline void* operator new(size_t size)
+$ {
+$ return StandardCSFDB_Allocate(size);
+$ }
+$ inline void operator delete(void *anAddress, size_t size)
+$ {
+$ if (anAddress) StandardCSFDB_Free((Standard_Address&)anAddress,size);
+$ }
+$
+$ Handle(%HPName)():Handle(%HPInherits)() {}
+$ Handle(%HPName)(const Handle(%HPName)& aHandle) : Handle(%HPInherits)(aHandle)
+$ {
+$ }
+$
+$ Handle(%HPName)(const %HPName* anItem) : Handle(%HPInherits)((%HPInherits *)anItem)
+$ {
+$ }
+$
+$ Handle(%HPName)& operator=(const Handle(%HPName)& aHandle)
+$ {
+$ Assign(aHandle.Access());
+$ return *this;
+$ }
+$
+$ Handle(%HPName)& operator=(const %HPName* anItem)
+$ {
+$ Assign((Standard_Persistent *)anItem);
+$ return *this;
+$ }
+$
+$ %HPName* operator->()
+$ {
+$ return (%HPName *)ControlAccess();
+$ }
+$
+$ %HPName* operator->() const
+$ {
+$ return (%HPName *)ControlAccess();
+$ }
+$
+$ Standard_EXPORT ~Handle(%HPName)();
+$
+$ Standard_EXPORT static const Handle(%HPName) DownCast(const Handle(Standard_Persistent)& AnObject);
+$};
+$#endif
+@end;
+
+@template PersistentCSFDBInstClass(%Class,
+ %Inherits,
+ %TICIncludes,
+ %TICPublicfriends,
+ %TICPublicmets,
+ %TICPublicfriends,
+ %TICProtectedmets,
+ %TICProtectedfields,
+ %TICPrivatemets,
+ %TICPrivatefields,
+ %TICPrivatefriends,
+ %TICDefines,
+ %TICInlineIncludes,
+ %TICUndefines,
+ %TICSuppMethod) is
+$// File generated by CPPExt (Persistent CSFDB)
+$// for CAS.CADE (copyright Matra-Datavision 1995)
+$//
+$#ifndef _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$#ifndef _Handle_%Class_HeaderFile
+$#include <Handle_%Class.hxx>
+$#endif
+$#ifndef _Standard_HeaderFile
+$#include <Standard.hxx>
+$#endif
+$
+$%TICIncludes
+$
+$class %Class : public %Inherits {
+$
+$
+$public:
+$ inline void* operator new(size_t,void* anAddress)
+$ {
+$ return anAddress;
+$ }
+$ inline void* operator new(size_t size)
+$ {
+$ return StandardCSFDB_Allocate(size);
+$ }
+$ inline void operator delete(void *anAddress, size_t size)
+$ {
+$ if (anAddress) StandardCSFDB_Free((Standard_Address&)anAddress,size);
+$ }
+$
+$ // Methods PUBLIC
+$ //
+$%TICPublicmets
+$%TICPublicfriends
+$
+$ // Type management
+$ //
+$ Standard_EXPORT friend Handle_Standard_Type& %Class_Type_();
+$ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+$ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+$
+$protected:
+$
+$ // Methods PROTECTED
+$ //
+$%TICProtectedmets
+$ // Fields PROTECTED
+$ //
+$%TICProtectedfields
+$
+$private:
+$
+$ // Methods PRIVATE
+$ //
+$%TICPrivatemets
+$ // Fields PRIVATE
+$ //
+$%TICPrivatefields
+$%TICPrivatefriends
+$};
+$
+$%TICDefines
+$%TICInlineIncludes
+$%TICUndefines
+$
+$// other inline functions and methods (like "C++: function call" methods)
+$//
+$%TICSuppMethod
+$
+$#endif
+@end;
+
+@template PersistentCSFDBIxx(%Class,%Suffix,%Supplement,%TypeMgt,%Methods) is
+$// File generated by CPPExt (Persistent CSFDB)
+$// 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.
+$//
+$#include <%Class.%Suffix>
+$
+$#ifndef _Standard_TypeMismatch_HeaderFile
+$#include <Standard_TypeMismatch.hxx>
+$#endif
+$
+$%Supplement
+$
+$%TypeMgt
+$
+$%Methods
+@end;
+
+-- ARRAY
+--
+@template DefFuncFieldArray(%CSFDBType,%Field,%NameField,%VarDim,%FDim) is
+$ %CSFDBType& _CSFDB_Get%NameField%Field(%VarDim) { return %Field%FDim; }
+@end;
+
+--
+-- ARRAY
+
+@template DefFuncPField(%CSFDBType,%Field,%NameField) is
+$ Handle(%CSFDBType) _CSFDB_Get%NameField%Field() const { return %Field; }
+$ void _CSFDB_Set%NameField%Field(const Handle(%CSFDBType)& p) { %Field = p; }
+@end;
+
+@template DefFuncSField(%CSFDBType,%Field,%NameField) is
+$ const %CSFDBType& _CSFDB_Get%NameField%Field() const { return %Field; }
+@end;
+
+@template DefFuncPrField(%CSFDBType,%Field,%NameField) is
+$ %CSFDBType _CSFDB_Get%NameField%Field() const { return %Field; }
+$ void _CSFDB_Set%NameField%Field(const %CSFDBType p) { %Field = p; }
+@end;
+
+@template VArrayDeclareCSFDB(%DName,%DValue) is
+$
+@end;
+
+@template ConstructorHeaderCallAncestor(%Class,%Inherits) is
+$%Class(const Storage_stCONSTclCOM& a) : %Inherits(a)\^
+@end;
+
+@template ConstructorHeaderNotCallAncestor(%Class) is
+$%Class(const Storage_stCONSTclCOM&)\^
+@end;
+
+@template VArrayFieldCSFDB(%DValue) is
+$#ifdef CSFDB
+$// DBC_VArray : field
+$//
+$#endif
+@end;
+
--- /dev/null
+-- File: CPPExt_TemplateOBJS.edl
+-- Author: Kernel
+-- History: Thu Dec 21 08:27:18 1995 Kernel Creation
+-- Copyright: Matra Datavision 1995
+
+-- =================================
+-- extraction of a persistent handle
+-- =================================
+
+@template HandlePersistentOBJS(%HPName,%HPName,%HPInherits) is
+$// File generated by CPPExt (Persistent OBJS)
+$//
+$// 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 Handle_%HPName_HeaderFile
+$#define Handle_%HPName_HeaderFile
+$#define %HPNameType %HPName_Type_()
+$
+$#ifndef _%HPName_Pointer
+$#define _%HPName_Pointer
+$class %HPName;
+$class Handle_%HPName;
+$#ifdef DECOSF1
+$#pragma pointer_size save
+$#pragma pointer_size short
+$#endif
+$typedef %HPName* %HPName_ptr;
+$typedef Handle_%HPName* Handle_%HPName_ptr;
+$#ifdef DECOSF1
+$#pragma pointer_size restore
+$#endif
+$#endif
+$
+$#ifndef _Handle_%HPInherits_HeaderFile
+$#include <Handle_%HPInherits.hxx>
+$#endif
+$
+$class Oid_%HPName;
+$class %HPName;
+$
+$class Handle_%HPName: public Handle_%HPInherits {
+$
+$public:
+$
+$ inline Handle_%HPName();
+$ inline Handle_%HPName(const Handle_%HPName& AnObject);
+$ inline Handle_%HPName(const %HPName_ptr AnObject);
+$ Standard_EXPORT ~Handle_%HPName();
+$ inline Handle_%HPName& operator=(const Handle_%HPName& AnObject);
+$ Standard_EXPORT Handle_%HPName& operator=(const %HPName_ptr AnObject);
+$ Standard_EXPORT static const Handle_%HPName DownCast(const Handle_Standard_Persistent&);
+$ inline Standard_Boolean operator==(const Handle_%HPName& AnObject) const ;
+$ inline Standard_Boolean operator!=(const Handle_%HPName& AnObject) const;
+$ inline Oid_%HPName* operator->() const;
+$};
+$
+$
+$inline Handle_%HPName::Handle_%HPName()
+${
+$}
+$
+$inline Handle_%HPName::Handle_%HPName(const Handle_%HPName& AnObject)
+$ : Handle_%HPInherits(AnObject)
+${
+$}
+$
+$inline Handle_%HPName::Handle_%HPName(const %HPName_ptr AnObject)
+$ : Handle_%HPInherits((const %HPInherits_ptr)AnObject)
+${
+$}
+$
+$inline Handle_%HPName& Handle_%HPName::operator=(const Handle_%HPName& AnObject)
+${
+$ Identifier=AnObject.Identifier; return *this;
+$}
+$
+$inline Standard_Boolean Handle_%HPName::operator==(const Handle_%HPName& AnObject)const
+${
+$ return Identifier==AnObject.Identifier;
+$}
+$
+$inline Standard_Boolean Handle_%HPName::operator!=(const Handle_%HPName& AnObject)const
+${
+$ return Identifier!=AnObject.Identifier;
+$}
+$
+$inline Oid_%HPName* Handle_%HPName::operator->() const
+${
+$ return (Oid_%HPName*)(void*)&(((Handle_%HPName_ptr)this)->Identifier);
+$}
+$
+$#endif
+@end;
+
+@template PersistentOBJSInstClass(%Class,
+ %Inherits,
+ %TICIncludes,
+ %TICPublicfriends,
+ %TICOidpubMet,
+ %TICOidproMet,
+ %TICOidpriMet,
+ %TICPublicmets,
+ %TICPublicfriends,
+ %TICProtectedmets,
+ %TICProtectedfields,
+ %TICPrivatemets,
+ %TICPrivatefields,
+ %TICPrivatefriends,
+ %TICDefines,
+ %TICInlineIncludes,
+ %TICUndefines,
+ %TICSuppMethod) is
+$// File generated by CPPExt (Persistent OBJS)
+$// 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 _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$#ifndef _%Class_Pointer
+$#define _%Class_Pointer
+$class %Class;
+$class Handle_%Class;
+$#ifdef DECOSF1
+$#pragma pointer_size save
+$#pragma pointer_size short
+$#endif
+$typedef %Class* %Class_ptr;
+$typedef Handle_%Class* Handle_%Class_ptr;
+$#ifdef DECOSF1
+$#pragma pointer_size restore
+$#endif
+$#endif
+$
+$#ifndef _Handle_%Class_HeaderFile
+$#include <Handle_%Class.hxx>
+$#endif
+$
+$%TICIncludes
+$#ifndef _Standard_ImmutableObject_HeaderFile
+$#include <Standard_ImmutableObject.hxx>
+$#endif
+$
+$class Oid_%Class : public Oid_%Inherits {
+$
+$friend class %Class;
+$%TICPublicfriends
+$
+$public:
+$
+$%TICOidpubMet
+$Oid_%Class() {};
+$~Oid_%Class() {};
+$
+$protected:
+$
+$%TICOidproMet
+$
+$private:
+$
+$%TICOidpriMet
+$};
+$
+$#ifdef OBJS
+$Standard_EXPORT Handle_%Class_ptr Standard_PersistentAllocation(const Handle_%Class&, Standard_Integer size = 1);
+$#endif
+$
+$class %Class : public %Inherits {
+$
+$friend class Oid_%Class;
+$
+$public:
+$
+$ // Methods PUBLIC
+$ //
+$%TICPublicmets
+$
+$%TICPublicfriends
+$
+$ // Type management
+$ //
+$ Standard_EXPORT friend Handle_Standard_Type& %Class_Type_();
+$ Standard_EXPORT friend Handle_%Class_ptr Standard_PersistentAllocation(const Handle_%Class&, Standard_Integer size);
+$ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+$ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+$
+$#ifdef OBJS
+$Standard_EXPORT void* operator new (size_t) ;
+$Standard_EXPORT void* operator new (size_t, Standard_DBHandle);
+$Standard_EXPORT void* operator new (size_t, Standard_Container);
+$Standard_EXPORT void* operator new (size_t, Handle(Standard_Persistent));
+$Standard_EXPORT void operator delete (void*);
+$Standard_EXPORT static os_typespec* get_mdtv_typespec()
+$ {
+$ static os_typespec* mytypespec = NULL;
+$ if (mytypespec == NULL)
+$ mytypespec = new os_typespec("%Class");
+$ return mytypespec;
+$ }
+$Standard_EXPORT virtual Standard_Persistent_ptr allocate_emptyObject(Standard_Integer size = 1) const;
+$#endif
+$
+$protected:
+$
+$ // Methods PROTECTED
+$ //
+$%TICProtectedmets
+$
+$ // Fields PROTECTED
+$ //
+$%TICProtectedfields
+$
+$private:
+$
+$ // Methods PRIVATE
+$ //
+$%TICPrivatemets
+$
+$ // Fields PRIVATE
+$ //
+$%TICPrivatefields
+$%TICPrivatefriends
+$};
+$
+$%TICDefines
+$%TICInlineIncludes
+$%TICUndefines
+$
+$// other inline functions and methods (like "C++: function call or Oid methods" methods)
+$//
+$%TICSuppMethod
+$
+$#endif
+@end;
+
+@template PersistentOBJSIxx(%Class,%Suffix,%Supplement,%TypeMgt,%Methods,%Destructor,%MethodOID) is
+$// File generated by CPPExt (Persistent OBJS)
+$// 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 _Standard_TypeMismatch_HeaderFile
+$#include <Standard_TypeMismatch.hxx>
+$#endif
+$
+$%Supplement
+$
+$#include <%Class.%Suffix>
+$
+$%Destructor
+$
+$%TypeMgt
+$
+$ Handle_%Class& Handle_%Class::operator=(const %Class_ptr AnObject)
+$ {
+$ Identifier = AnObject;
+$ return *this;
+$ }
+$
+$ void* %Class::operator new (size_t ASize) {
+$ return new (Standard_Persistent::PreNew(),%Class::get_mdtv_typespec()) char[(long) ASize] ;
+$ }
+$
+$ // DELETE
+$ void %Class::operator delete (void* _AnAddress) {
+$ ::delete _AnAddress;
+$ }
+$ // DELETEEND
+$
+$ void* %Class::operator new (size_t ASize, Standard_DBHandle db) {
+$ return new (db,%Class::get_mdtv_typespec()) char[(long) ASize] ;
+$ }
+$
+$ void* %Class::operator new (size_t ASize, Standard_Container cont) {
+$ return new (cont,%Class::get_mdtv_typespec()) char[(long) ASize] ;
+$ }
+$
+$ void* %Class::operator new (size_t ASize, Handle(Standard_Persistent) hd) {
+$ return new (os_segment::of(hd->GetOId()),%Class::get_mdtv_typespec()) char[(long) ASize] ;
+$ }
+$
+$%MethodOID
+$%Methods
+@end;
+
+@template ImmutableTestOBJS(%DName,%MethodName) is
+$ if (%DName.IsImmutable()) Standard_ImmutableObject::Raise("Immutable object handle in %MethodName");
+@end;
+
+@template UpdateAccessOBJS(%Class,%MethodName) is
+$ ((%Class_ptr)UpdateAccess())->%MethodName;
+@end;
+
+@template ReadAccessOBJS(%Class,%MethodName) is
+$ ((%Class_ptr)ReadAccess())->%MethodName;
+@end;
+
+
+@template ItemMDTVDefine(%DName,%DValue) is
+$#define %DName %DValue
+$#define %DName_hxx <%DValue.hxx>
+@end;
+
+@template ItemMDTVptrDefine(%DName,%DValue) is
+$#define %DName_ptr %DValue_ptr
+@end;
+
+@template ItemMDTVptrUndef(%DName) is
+$#undef %DName_ptr
+@end;
+
+@template ItemMDTVConstraintHandle(%DName,%DValue) is
+$#define Handle_%DName Handle_%DValue
+@end;
+
+@template ItemMDTVConstraintHandleUndef(%DName) is
+$#undef Handle_%DName
+@end;
+
+@template ItemHandleMDTVDefine(%DName,%DValue) is
+$#define Handle_%DName Handle_%DValue
+$#define %DName_Type_() %DValue_Type_()
+$#define %DName_ptr %DValue_ptr
+@end;
+
+@template ItemMDTVUndefine(%DName) is
+$#undef %DName
+$#undef %DName_hxx
+@end;
+
+@template ItemHandleMDTVUndefine(%DName) is
+$#undef Handle_%DName
+$#undef %DName_Type_
+@end;
+
+@template IncludeMDTVNoSafe(%IClass,%Suffix) is
+$#include <%IClass.%Suffix>
+@end;
+
+@template VArrayFieldOBJS(%DName,%DValue) is
+$#ifdef OBJS
+$DBC_PCLASS_OBJS *myData;
+$#endif
+@end;
+
+@template VArrayDeclareOBJS(%DName,%DValue) is
+$#ifdef OBJS
+$#include <ostore/ostore.hh>
+$#include <ostore/coll.hh>
+$typedef %DValue %DName_%DValue;
+$
+$class P_%DName {
+$public:
+$ static os_typespec* get_mdtv_typespec();
+$
+$ %DValue myValue;
+$};
+$#define P_%DName_use_DBC
+$#ifdef DBC_PCLASS_OBJS
+$#undef DBC_PCLASS_OBJS
+$#endif
+$#define DBC_PCLASS_OBJS P_%DName
+$#endif
+@end;
+
+@template PersistentAllocationOBJS (%Class) is
+$Standard_Persistent_ptr %Class::allocate_emptyObject(Standard_Integer size) const {
+$ if (size == 1 )
+$ return new %Class;
+$ else
+$ return new(Standard_Persistent::PreNew(), %Class::get_mdtv_typespec(), size) %Class[size];
+$}
+$
+$Standard_EXPORT Handle_%Class_ptr Standard_PersistentAllocation(const Handle_%Class& Value, Standard_Integer size) {
+$Handle_%Class_ptr hd;
+$ if (size == 1 ) {
+$ hd = new(Standard_Persistent::PreNew(),Handle_%Class::get_mdtv_typespec()) Handle_%Class(Value);
+$ } else {
+$ hd = new(Standard_Persistent::PreNew(),Handle_%Class::get_mdtv_typespec(), size) Handle_%Class[size];
+$} return hd;
+$}
+$
+@end;
+
+@template PersistentAllocationOBJSDeferred (%Class) is
+$Standard_Persistent_ptr %Class::allocate_emptyObject(Standard_Integer size) const {
+$ Standard_Persistent_ptr dummy = 0L;
+$ return dummy;
+$}
+$
+$Standard_EXPORT Handle_%Class_ptr Standard_PersistentAllocation(const Handle_%Class& Value, Standard_Integer size) {
+$ Handle_%Class_ptr hd = 0L;
+$ return hd;
+$}
+$
+@end;
--- /dev/null
+-- File: CPPExt_TemplateOBJY.edl
+-- Author: Kernel
+-- History: Thu Dec 21 08:27:18 1995 Kernel Creation
+-- Copyright: Matra Datavision 1995
+
+-- =================================
+-- extraction of a persistent handle
+-- =================================
+
+@template HandlePersistentOBJY(%HPName,%HPName,%HPInherits) is
+$// File generated by CPPExt (Persistent OBJY)
+$// for CAS.CADE (copyright Matra-Datavision 1995)
+$//
+$#ifndef Handle_%HPName_HeaderFile
+$#define Handle_%HPName_HeaderFile
+$#define %HPNameType %HPName_Type_()
+$
+$#ifndef _Handle_%HPInherits_HeaderFile
+$#include <Handle_%HPInherits.hxx>
+$#endif
+$
+$class Oid_%HPName;
+$class %HPName;
+$class PHandle_%HPName;
+$
+$class Handle_%HPName: public Handle_%HPInherits {
+$
+$public:
+$
+$ Handle_%HPName(const PHandle_Standard_Persistent& AnObject) : Handle_%HPInherits(AnObject) {}
+$ inline Handle_%HPName();
+$ inline Handle_%HPName(const Handle_%HPName& AnObject);
+$ inline Handle_%HPName(const %HPName* AnObject);
+$ ~Handle_%HPName();
+$ inline Handle_%HPName& operator=(const Handle_%HPName& AnObject);
+$ Handle_%HPName& operator=(const %HPName* AnObject);
+$ static const Handle_%HPName DownCast(const Handle_Standard_Persistent&);
+$ inline Standard_Boolean operator==(const Handle_%HPName& AnObject) const ;
+$ inline Standard_Boolean operator!=(const Handle_%HPName& AnObject) const;
+$ inline Oid_%HPName* operator->() const;
+$};
+$
+$class PHandle_%HPName : public PHandle_%HPInherits {
+$ public:
+$ PHandle_%HPName(){}
+$ PHandle_%HPName (const Handle_%HPName& aHandle) : PHandle_%HPInherits(aHandle){}
+$ Handle(%HPName) operator->(){Handle(%HPName) p(*this);return p;}
+$ Handle(%HPName) operator->() const {Handle(%HPName) p(*this);return p;}
+$};
+$
+$inline Handle_%HPName::Handle_%HPName()
+${
+$}
+$
+$inline Handle_%HPName::Handle_%HPName(const Handle_%HPName& AnObject)
+$ : Handle_%HPInherits(AnObject)
+${
+$}
+$
+$inline Handle_%HPName::Handle_%HPName(const %HPName* AnObject)
+$ : Handle_%HPInherits((const %HPInherits*)AnObject)
+${
+$}
+$
+$inline Handle_%HPName& Handle_%HPName::operator=(const Handle_%HPName& AnObject)
+${
+$ Identifier=AnObject.Identifier; return *this;
+$}
+$
+$inline Standard_Boolean Handle_%HPName::operator==(const Handle_%HPName& AnObject)const
+${
+$ return Identifier==AnObject.Identifier;
+$}
+$
+$inline Standard_Boolean Handle_%HPName::operator!=(const Handle_%HPName& AnObject)const
+${
+$ return Identifier!=AnObject.Identifier;
+$}
+$
+$inline Oid_%HPName* Handle_%HPName::operator->() const
+${
+$ return (Oid_%HPName*)(void*)&(((Handle_%HPName *)this)->Identifier);
+$}
+$
+$#endif
+@end;
+
+@template PersistentOBJYInstClass(%Class,
+ %Inherits,
+ %TICIncludes,
+ %TICPublicfriends,
+ %TICOidpubMet,
+ %TICOidproMet,
+ %TICOidpriMet,
+ %TICPublicmets,
+ %TICPublicfriends,
+ %TICProtectedmets,
+ %TICProtectedfields,
+ %TICPrivatemets,
+ %TICPrivatefields,
+ %TICPrivatefriends,
+ %TICDefines,
+ %TICInlineIncludes,
+ %TICUndefines,
+ %TICSuppMethod) is
+$// File generated by CPPExt (Persistent OBJY)
+$// for CAS.CADE (copyright Matra-Datavision 1995)
+$//
+$#ifndef _%Class_HeaderFile
+$#define _%Class_HeaderFile
+$
+$#ifndef _Handle_%Class_HeaderFile
+$#include <Handle_%Class.hxx>
+$#endif
+$
+$%TICIncludes
+$#ifndef _Standard_ImmutableObject_HeaderFile
+$#include <Standard_ImmutableObject.hxx>
+$#endif
+$
+$class Oid_%Class : public Oid_%Inherits {
+$
+$friend class %Class;
+$%TICPublicfriends
+$
+$public:
+$
+$%TICOidpubMet
+$Oid_%Class() {};
+$~Oid_%Class() {};
+$
+$protected:
+$
+$%TICOidproMet
+$
+$private:
+$
+$%TICOidpriMet
+$};
+$
+$class %Class : public %Inherits {
+$
+$friend class Oid_%Class;
+$
+$public:
+$
+$ // Methods PUBLIC
+$ //
+$%TICPublicmets
+$
+$%TICPublicfriends
+$
+$ // Type management
+$ //
+$ friend Handle_Standard_Type& %Class_Type_();
+$ const Handle(Standard_Type)& DynamicType() const;
+$ Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+$ void* operator new(size_t);
+$
+$protected:
+$
+$ // Methods PROTECTED
+$ //
+$%TICProtectedmets
+$
+$ // Fields PROTECTED
+$ //
+$%TICProtectedfields
+$
+$private:
+$
+$ // Methods PRIVATE
+$ //
+$%TICPrivatemets
+$
+$ // Fields PRIVATE
+$ //
+$%TICPrivatefields
+$%TICPrivatefriends
+$};
+$
+$%TICDefines
+$%TICInlineIncludes
+$%TICUndefines
+$
+$// other inline functions and methods (like "C++: function call or Oid methods" methods)
+$//
+$%TICSuppMethod
+$
+$#endif
+@end;
+
+@template PersistentOBJYIxx(%Class,%Suffix,%Supplement,%TypeMgt,%Methods) is
+$// File generated by CPPExt (Persistent OBJY)
+$// for CAS.CADE (copyright Matra-Datavision 1995)
+$//
+$#include <%Class.%Suffix>
+$
+$#ifndef _Standard_TypeMismatch_HeaderFile
+$#include <Standard_TypeMismatch.hxx>
+$#endif
+$
+$%Supplement
+$
+$%TypeMgt
+$
+$ // new operator
+$ //
+$ void* %Class::operator new (size_t ASize)
+$ {
+$ Standard_Container _aContainer = PreNew();
+$ return (opiNewObj(ASize,ooTypeN(%Class),_aContainer));
+$ }
+$
+$ Handle_%Class& Handle_%Class::operator=(const %Class* AnObject)
+$ {
+$ Identifier = AnObject;
+$ return *this;
+$ }
+$
+$%Methods
+@end;
+
+@template ImmutableTestOBJY(%DName,%MethodName) is
+$ if (%DName.IsImmutable()) Standard_ImmutableObject::Raise("Immutable object handle in %MethodName");
+@end;
+
+@template UpdateAccessOBJY(%Class,%MethodName) is
+$ ((%Class *)UpdateAccess())->%MethodName;
+@end;
+
+@template ReadAccessOBJY(%Class,%MethodName) is
+$ ((%Class *)ReadAccess())->%MethodName;
+@end;
+
+
+@template ItemMDTVDefine(%DName,%DValue) is
+$//MDTV#define %DName %DValue
+$//MDTV#define %DName_hxx <%DValue.hxx>
+@end;
+
+@template ItemMDTVConstraintHandle(%DName,%DValue) is
+$//MDTV#define Handle_%DName Handle_%DValue
+@end;
+
+@template ItemMDTVConstraintHandleUndef(%DName) is
+$//MDTV#undef Handle_%DName
+@end;
+
+@template ItemHandleMDTVDefine(%DName,%DValue) is
+$//MDTV#define Handle_%DName Handle_%DValue
+$//MDTV#define %DName_Type_() %DValue_Type_()
+@end;
+
+@template ItemMDTVUndefine(%DName) is
+$//MDTV#undef %DName
+$//MDTV#undef %DName_hxx
+@end;
+
+@template ItemHandleMDTVUndefine(%DName) is
+$//MDTV#undef Handle_%DName
+$//MDTV#undef %DName_Type_
+@end;
+
+@template IncludeMDTVNoSafe(%IClass,%Suffix) is
+$//MDTV#include <%IClass.%Suffix>
+@end;
+
+@template VArrayDeclareOBJY(%DName,%DValue) is
+$#ifdef OBJY
+$
+$#include <oo.h>
+$#include <ooVArray.h>
+$
+$typedef %DValue %DName_%DValue;
+$declare(ooVArray,%DName_%DValue)
+$
+$#endif
+@end;
+
+@template VArrayFieldOBJY(%DName,%DValue) is
+$#ifdef OBJY
+$
+$ooVArray(%DName_%DValue) myData;
+$
+$#endif
+@end;
--- /dev/null
+// CLE
+//
+// 10/1995
+//
+#include <MS.hxx>
+
+#include <EDL_API.hxx>
+
+#include <MS_MetaSchema.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_InstMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_ExternMet.hxx>
+
+#include <MS_Param.hxx>
+#include <MS_Field.hxx>
+#include <MS_GenType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_PrimType.hxx>
+
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_NoSuchObject.hxx>
+
+#include <CPPExt_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+// Extraction of a transient handle
+//
+void CPP_TransientHandle(const Handle(EDL_API)& api,
+ const Handle(TCollection_HAsciiString)& aClass,
+ const Handle(TCollection_HAsciiString)& aMother,
+ const Handle(TCollection_HAsciiString)& aFileName)
+{
+ // we create the handle...
+ //
+ api->AddVariable("%HTName",aClass->ToCString());
+ api->AddVariable("%HTInherits",aMother->ToCString());
+ api->Apply("%HTHandle","HandleTransient");
+
+ // ...now we write the result
+ //
+ api->OpenFile("HTFile",aFileName->ToCString());
+ api->WriteFile("HTFile","%HTHandle");
+ api->CloseFile("HTFile");
+}
+
+// Extraction of a transient .ixx .jxx and _0.cxx
+// the supplement variable is used for non inline methods generated
+// by the extractor like destructor (added to .ixx ans _0.cxx
+//
+void CPP_TransientDerivated(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Handle(TColStd_HSequenceOfHAsciiString)& inclist,
+ const Handle(TColStd_HSequenceOfHAsciiString)& supplement)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) aFileName = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString;
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ // we do this only on standard classes (not on inst classes)
+ //
+ if (theClass.IsNull()) return;
+
+ api->AddVariable(VClass,aClass->FullName()->ToCString());
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= inclist->Length(); i++) {
+ api->AddVariable(VIClass,inclist->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ // include the hxx of me
+ //
+ api->AddVariable(VIClass,aClass->FullName()->ToCString());
+#ifdef WNT
+ api->Apply(VoutClass,"IncludeNoSafe");
+#else
+ api->Apply(VoutClass,"Include");
+#endif
+ result->AssignCat(api->GetVariableValue(VoutClass));
+
+ api->AddVariable(VoutClass,result->ToCString());
+
+ aFileName->AssignCat(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+ aFileName->AssignCat(".jxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+ result->Clear();
+ outfile->Append(aFileName);
+ }
+
+ CPP_ClassTypeMgt(aMeta,api,aClass,VTypeMgt);
+
+ aFileName = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+ aFileName->AssignCat(aClass->FullName());
+
+ if (theClass->GetMyCreator().IsNull()) {
+ aFileName->AssignCat(".ixx");
+ }
+ else {
+ aFileName->AssignCat("_0.cxx");
+ }
+
+ // Supplement
+ //
+ if (theClass->GetMyCreator().IsNull()) {
+ result->Clear();
+ }
+
+ for (i = 1; i <= supplement->Length(); i++) {
+ result->AssignCat(supplement->Value(i));
+ }
+
+ api->AddVariable(VSupplement,result->ToCString());
+
+ // Methods
+ //
+ result->Clear();
+
+ api->AddVariable(VIClass,MS::GetTransientRootName()->ToCString());
+ api->Apply(VMethods,"DownCast");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"DynamicType");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->AddVariable(VIClass,aClass->GetInheritsNames()->Value(1)->ToCString());
+ api->Apply(VMethods,"IsKind");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ api->Apply(VMethods,"FullEmptyHandleDestructorTemplate");
+ result->AssignCat(api->GetVariableValue(VMethods));
+
+ if (!theClass->GetMyCreator().IsNull()) {
+ CPP_GenericDefine(aMeta,api,theClass->GetMyCreator(),VTICDefines,VTICUndefines,Standard_True);
+ result->AssignCat(api->GetVariableValue(VTICDefines));
+ api->AddVariable(VSuffix,"gxx");
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,theClass->GetMyCreator()->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->Apply(VMethods,"IncludeNoSafe");
+ result->AssignCat(api->GetVariableValue(VMethods));
+ }
+
+ if (theClass->GetMyCreator().IsNull()) {
+ api->AddVariable(VSuffix,"jxx");
+ }
+ else {
+ api->AddVariable(VSuffix,"hxx");
+ }
+
+ api->AddVariable(VMethods,result->ToCString());
+ api->Apply(VoutClass,"TransientIxx");
+
+ CPP_WriteFile(api,aFileName,VoutClass);
+
+ outfile->Append(aFileName);
+}
+
+
+// Extraction of a transient class (inst or std)
+//
+void CPP_TransientClass(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Handle(MS_Class)& aClass,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_StdClass) theClass = Handle(MS_StdClass)::DownCast(aClass);
+
+ if (!theClass.IsNull()) {
+ Standard_Integer i;
+
+ Handle(MS_HSequenceOfMemberMet) methods = theClass->GetMethods();
+ Handle(MS_Method) friendmethod;
+ Handle(TCollection_HAsciiString) publics = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) protecteds = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) privates = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) SuppMethod = new TCollection_HAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) Supplement = new TColStd_HSequenceOfHAsciiString;
+
+ Standard_Boolean HasInlineMethod = Standard_False,
+ HasDestructor = Standard_False;
+
+
+ api->AddVariable(VTICIncludes,"");
+ api->AddVariable(VTICPublicfriends,"");
+ api->AddVariable(VTICProtectedfields,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICDefines,"");
+ api->AddVariable(VTICInlineIncludes,"");
+ api->AddVariable(VTICUndefines,"");
+ api->AddVariable(VTICPrivatefriends,"");
+ api->AddVariable(VTICPrivatefields,"");
+ api->AddVariable(VSuffix,"");
+ api->AddVariable(VTICSuppMethod,"");
+
+ api->AddVariable(VClass,theClass->FullName()->ToCString());
+ api->AddVariable(VInherits,theClass->GetInheritsNames()->Value(1)->ToCString());
+
+ for (i = 1; i <= theClass->GetFriendsNames()->Length(); i++) {
+ publics->AssignCat("friend ");
+ api->AddVariable(VIClass,theClass->GetFriendsNames()->Value(i)->ToCString());
+ api->Apply(VTICPublicfriends,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICPublicfriends));
+ }
+
+ if (!CPP_SetFriendMethod(aMeta,api,theClass->GetFriendMets(),publics)) {
+ ErrorMsg << "CPPExt" << "a friend method was not found..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ api->AddVariable(VTICPublicfriends,publics->ToCString());
+
+ publics->Clear();
+
+ // extraction of the methods
+ //
+ Handle(TCollection_HAsciiString) aliasMethod;
+
+ for (i = 1; i <= methods->Length(); i++) {
+ aliasMethod.Nullify();
+
+ if (methods->Value(i)->IsInline()) {
+ HasInlineMethod = Standard_True;
+ }
+
+ // if the class has no destructor we give it
+ //
+ if (methods->Value(i)->IsDestructor()) {
+ HasDestructor = Standard_True;
+ }
+
+ if (!methods->Value(i)->IsAlias().IsNull() || methods->Value(i)->IsDestructor()) {
+ aliasMethod = CPP_BuildAliasMethod(aMeta,api,methods->Value(i));
+ }
+
+ // Function Call c++ comment :
+ // it s must be in the _0.cxx or ixx file
+ // so we add it in the supplement sequence
+ //
+ if (methods->Value(i)->IsFunctionCall()) {
+ SuppMethod->AssignCat(CPP_BuildAliasMethod(aMeta,api,methods->Value(i)));
+ }
+
+ CPP_BuildMethod(aMeta,api,methods->Value(i),methods->Value(i)->Name());
+
+#ifdef WNT
+ if ( !methods -> Value ( i ) -> IsInline () )
+#endif // WNT
+ api->Apply(VMethod,"MethodTemplateDec");
+#ifdef WNT
+ else
+ api->Apply(VMethod,"MethodTemplateDecInlineWNT" );
+#endif // WNT
+
+ if (methods->Value(i)->Private()) {
+ privates->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ privates->AssignCat(aliasMethod);
+ }
+ }
+ else if ((theClass->Deferred() && methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) ||
+ methods->Value(i)->IsProtected()) {
+ protecteds->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ protecteds->AssignCat(aliasMethod);
+ }
+ }
+ else {
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ if (!aliasMethod.IsNull()) {
+ publics->AssignCat(aliasMethod);
+ }
+ }
+ }
+
+ if (!HasDestructor) {
+ api->Apply(VMethod,"EmptyDestructorTemplate");
+ publics->AssignCat(api->GetVariableValue(VMethod));
+ }
+
+ api->AddVariable(VTICPublicmets,publics->ToCString());
+ api->AddVariable(VTICPrivatemets,privates->ToCString());
+ api->AddVariable(VTICProtectedmets,protecteds->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+
+ // extraction of fields
+ //
+ Handle(MS_HSequenceOfField) fields = theClass->GetFields();
+
+ for (i = 1; i <= fields->Length(); i++) {
+ if (fields->Value(i)->Protected()) {
+ protecteds->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ else {
+ privates->AssignCat(CPP_BuildField(aMeta,fields->Value(i)));
+ }
+ }
+
+ api->AddVariable(VTICPrivatefields,privates->ToCString());
+ api->AddVariable(VTICProtectedfields,protecteds->ToCString());
+
+ publics->Clear();
+ privates->Clear();
+ protecteds->Clear();
+
+ // others inline methods and functions (ex. function call)
+ //
+ api->AddVariable(VTICSuppMethod,SuppMethod->ToCString());
+
+ // include the lxx if the class have inline methods
+ //
+ if (HasInlineMethod) {
+ Handle(MS_InstClass) aCreator = theClass->GetMyCreator();
+
+ if (aCreator.IsNull()) {
+ api->AddVariable(VIClass,theClass->FullName()->ToCString());
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+ }
+ // this part is for class created by instantiations
+ //
+ else {
+ if (theClass->GetMother().IsNull()) {
+ api->AddVariable(VIClass,aCreator->GenClass()->ToCString());
+ }
+ else {
+ api->AddVariable(VIClass,theClass->GetMother()->ToCString());
+ }
+ api->AddVariable(VSuffix,"lxx");
+ api->Apply(VTICInlineIncludes,"IncludeNoSafe");
+
+ CPP_GenericDefine(aMeta,api,aCreator,VTICDefines,VTICUndefines,Standard_True);
+ }
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) List = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) incp = new TColStd_HSequenceOfHAsciiString;
+
+ CPP_UsedTypes(aMeta,theClass,List,incp);
+
+ publics->Clear();
+
+ api->AddVariable(VSuffix,"hxx");
+
+ for (i = 1; i <= List->Length(); i++) {
+ if (!List->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,List->Value(i)->ToCString());
+#ifdef WNT
+ api->Apply(VTICIncludes,"IncludeNoSafe");
+#else
+ api->Apply(VTICIncludes,"Include");
+#endif
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+
+ for (i = 1; i <= incp->Length(); i++) {
+ if (!incp->Value(i)->IsSameString(theClass->FullName())) {
+ api->AddVariable(VIClass,incp->Value(i)->ToCString());
+ api->Apply(VTICIncludes,"ShortDec");
+ publics->AssignCat(api->GetVariableValue(VTICIncludes));
+ }
+ }
+
+ api->AddVariable(VTICIncludes,publics->ToCString());
+
+ api->Apply(VoutClass,"TransientInstClass");
+
+ // we write the .hxx of this class
+ //
+ Handle(TCollection_HAsciiString) aFile = new TCollection_HAsciiString(api->GetVariableValue(VFullPath));
+
+ aFile->AssignCat(theClass->FullName());
+ aFile->AssignCat(".hxx");
+
+ CPP_WriteFile(api,aFile,VoutClass);
+
+ outfile->Append(aFile);
+
+ // .ixx or _0.cxx
+ //
+ if (!HasDestructor) {
+ api->Apply(VMethod,"FullEmptyDestructorTemplate");
+ Supplement->Append(new TCollection_HAsciiString(api->GetVariableValue(VMethod)));
+ }
+
+ CPP_TransientDerivated(aMeta,api,aClass,outfile,incp,Supplement);
+ }
+ else {
+ ErrorMsg << "CPPExt" << "CPP_TransientClass - the class is NULL..." << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
--- /dev/null
+CPPExt.cxx
+CPPExt_Transient.cxx
+CPPExt_PersistentOBJY.cxx
+CPPExt_PersistentCSFDB.cxx
+CPPExt_PersistentOBJS.cxx
+CPPExt_Exception.cxx
+CPPExt_Storable.cxx
+CPPExt_Package.cxx
+CPPExt_MPV.cxx
+CPPExt_Enum.cxx
+CPPExt_Alias.cxx
+CPPExt_Pointer.cxx
+CPPExt_TemplateOBJY.edl
+CPPExt_TemplateCSFDB.edl
+CPPExt_TemplateOBJS.edl
+CPPExt_Template.edl
+CPPExt.hxx
+CPPExt_Define.hxx
+FILES
+CPPExt_Standard.edl