home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
forteoopl.tcl
< prev
next >
Wrap
Text File
|
1997-04-18
|
62KB
|
2,400 lines
#--------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: %W%
# Author: <generated>
#
#--------------------------------------------------------------------------
# File: @(#)ftgfeature.tcl /main/hindenburg/2
Class FTGFeature : {Object} {
constructor
method destructor
method generate
}
constructor FTGFeature {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGFeature::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGFeature::generate {this class} {
# empty
}
# Do not delete this line -- regeneration end marker
Class FTGFeatureD : {FTGFeature OPFeature} {
}
selfPromoter OPFeature {this} {
FTGFeatureD promote $this
}
# File: @(#)ftggenclas.tcl /main/hindenburg/8
Class FTGGenClass : {Object} {
constructor
method destructor
method generate
method genClass
method genServiceObject
method genConstant
method genCursor
method genStruct
method genUnion
method genComposite
method isExternal
method getClassType
method getDefSysName
method getSuperNames
method isDerivable
method getFinalClass
method getKind
attribute classType
attribute superNames
attribute loopGuard
}
constructor FTGGenClass {class this name} {
set this [Object::constructor $class $this $name]
$this loopGuard -1
# Start constructor user section
# End constructor user section
return $this
}
method FTGGenClass::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGGenClass::generate {this model} {
set classType [$this getClassType]
m4_message $M_GEN_FOR $classType [$this getName]
$this gen$classType $model
}
method FTGGenClass::genClass {this model} {
set name [$this getName]
# super class (may be "")
#
set genNodes [$this genNodeSet]
set superIsClass 1
if {[llength $genNodes] == 0} {
m4_warning $W_CLASS_NO_SUPER $name
set superClass ""
} else {
set superClass [[lindex $genNodes 0] superClass]
if {[llength $genNodes] > 1} {
m4_warning $W_N_SUPERS $name [$superClass getDefSysName] [$superClass getName]
}
if {![$superClass isDerivable]} {
m4_error $E_ILL_SUPER $name [$superClass getKind] [$superClass getDefSysName] [$superClass getName]
return
}
if {!([$superClass isA FTGClass] || [$superClass isA FTGLinkClass])} {
set superIsClass 0
}
}
# kind, i.e. Cmn, Win, or Dom
#
set superNames [List new]
$superNames contents [$this getSuperNames]
if {[$superNames search -exact "UserWindow"] != -1} {
set kind Win
} elseif {[$superNames search -glob "*Nullable"] != -1} {
set kind Dom
} elseif {[$superNames search -exact "Object"] != -1} {
set kind Cmn
} else {
# not derived from 'Object'
# return
set kind Cmn
}
# target class
#
set class [$model findDefinition $name]
if {$class == ""} {
# note: a generic typedef class has no defining system
set class [FT${kind}Class new $name $model [$this getDefSysName] 0]
$class ooplClass $this
}
set tgtSuperType [FTType new]
if {$superClass == ""} {
set tgtSuperClass [FTCmnClass new "Object" $model "Framework" 1]
} else {
set tgtSuperClass [FTCmnClass new [$superClass getName] $model [$superClass getDefSysName] 1]
}
if {$kind == "Win"} {
$tgtSuperClass isMapped 1
}
$tgtSuperType classType $tgtSuperClass
$tgtSuperType isClass $superIsClass
$class super $tgtSuperType
# Init, Display methods
#
$class constructor [FTInit new "" "" "" $class]
if {$kind == "Win"} {
FTDisplay new "" "" "" $class
}
# features
#
foreach feat [$this featureSet] {
$feat generate $class
}
}
method FTGGenClass::genServiceObject {this model} {
set name [$this getName]
set class [$model findDefinition $name]
if {$class == ""} {
if {[llength [$this operationSet]] == 0} {
m4_error $E_SERVICE_OBJ1 $name
return
} elseif {[llength [$this operationSet]] > 1 || [llength [$this attributeSet]] != 0} {
m4_warning $W_SERVICE_OBJ2 $name
}
set oper [lindex [$this operationSet] 0]
set class [FTServiceObject new $name $model [$this getDefSysName] 0]
$class ooplClass $this
$oper generate $class Service
}
}
method FTGGenClass::genConstant {this model} {
set name [$this getName]
set class [$model findDefinition $name]
if {$class == ""} {
if {[llength [$this attributeSet]] == 0} {
m4_error $E_CONSTANT1 $name
return
} elseif {[llength [$this attributeSet]] > 1 || [llength [$this operationSet]] != 0} {
m4_warning $W_CONSTANT2 $name
}
set attr [lindex [$this attributeSet] 0]
set value [string trim [$attr getPropertyValue initial_value]]
if {$value == ""} {
m4_error $E_CONSTANT3 $name
return
}
set class [FTConstant new $name $model [$this getDefSysName] 0 $value]
$class ooplClass $this
}
}
method FTGGenClass::genCursor {this model} {
set name [$this getName]
set class [$model findDefinition $name]
if {$class == ""} {
if {[llength [$this operationSet]] == 0} {
m4_error $E_CURSOR1 $name
return
} elseif {[llength [$this operationSet]] > 1 || [llength [$this attributeSet]] != 0} {
m4_warning $W_CURSOR2 $name
}
set oper [lindex [$this operationSet] 0]
set class [FTCursor new $name $model [$this getDefSysName] 0]
$class ooplClass $this
$oper generate $class CursorDef
}
}
method FTGGenClass::genStruct {this model} {
$this genComposite Struct $model
}
method FTGGenClass::genUnion {this model} {
$this genComposite Union $model
}
method FTGGenClass::genComposite {this kind model} {
set name [$this getName]
set class [$model findDefinition $name]
if {$class == ""} {
set class [FT$kind new $name $model [$this getDefSysName] 0]
$class ooplClass $this
foreach attrib [$this dataAttrSet] {
FTCompItem new [$attrib getName] [[$attrib ooplType] getType $model] $class
}
}
}
method FTGGenClass::isExternal {this} {
if {[$this OPClass::isExternal]} {
return 1
}
return 0
}
method FTGGenClass::getClassType {this} {
if {[$this classType] != ""} {
return [$this classType]
}
set classType [$this getPropertyValue class_type]
# IMPR: FTGGenClass::getClassType: default prop
if {$classType == ""} {
set classType Class
}
regsub -all " " $classType "" classType
$this classType $classType
return [$this classType]
}
method FTGGenClass::getDefSysName {this} {
set systemV [[$this smNode] getDefiningSystemVersion]
if {![$systemV isNil]} {
return [[$systemV system] name]
}
return ""
}
method FTGGenClass::getSuperNames {this} {
if {[$this loopGuard] == 0} {
# superNames of this class have been retrieved yet
return [$this superNames]
}
if {[$this loopGuard] == 1} {
# inheritance loop
return {}
}
$this loopGuard 1
set superNames {}
foreach gen [$this genNodeSet] {
set superClass [$gen superClass]
set finalClass [$superClass getFinalClass]
if {$finalClass != ""} {
set superClass $finalClass
}
lappend superNames [$superClass getName]
set newNames [$superClass getSuperNames]
if {$newNames != {}} {
eval "lappend superNames $newNames"
}
# no multiple inheritance supported
# (classes in Framework library are!)
break
}
$this superNames $superNames
$this loopGuard 0
return [$this superNames]
}
method FTGGenClass::isDerivable {this} {
set classType [$this getClassType]
if {$classType == "Class"} {
return 1
}
return 0
}
method FTGGenClass::getFinalClass {this} {
return $this
}
method FTGGenClass::getKind {this} {
return [$this getClassType]
}
# Do not delete this line -- regeneration end marker
# File: @(#)ftginitial.tcl /main/hindenburg/1
Class FTGInitializer : {Object} {
constructor
method destructor
method generate
method genCode
}
constructor FTGInitializer {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGInitializer::generate {this ctor} {
# empty
}
method FTGInitializer::genCode {this ctor} {
if {$ctor == ""} {
return
}
set sect [$ctor genCode]
$sect append "-- ! the user must initialize attribute '[$this getName]'\n"
$sect append "-- ! when constructing this object\n"
$sect append "--\n"
}
# Do not delete this line -- regeneration end marker
Class FTGInitializerD : {FTGInitializer OPInitializer} {
}
selfPromoter OPInitializer {this} {
FTGInitializerD promote $this
}
# File: @(#)ftgoperpar.tcl /main/hindenburg/3
Class FTGOperParameter : {Object OPOperParameter} {
constructor
method destructor
method generate
method getMechanism
method getCopy
}
constructor FTGOperParameter {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGOperParameter::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGOperParameter::generate {this tgtMethod forWhat} {
# forWhat is one of: Method, Event, Event Handler, Service, CursorDef
#
set type [$this ooplType]
if {$type != "" && $forWhat != "Service"} {
set tgtType [$type getType [[$tgtMethod theClass] model]]
} else {
set tgtType ""
}
set mechanism [$this getMechanism $forWhat]
set param [FTParameter new [$this getName] $mechanism $tgtMethod $tgtType]
$param asCopy [$this getCopy $forWhat]
# the following parameters may have a default value:
# - 'input' parameters
# - parameters of Events
# - parameters of Services, CursorDefs
#
# - class type parameters may have only the NIL value
#
set defaultVal [string trim [$this getPropertyValue default_value]]
if {$defaultVal != ""} {
if {$mechanism == "input" || $forWhat == "Event" || $forWhat == "Service" || $forWhat == "CursorDef"} {
if {[$type refersClass] && [string tolower $defaultVal] != "nil"} {
if {$forWhat == "Service"} {
set forWhat2 "Service Object"
} elseif {$forWhat == "CursorDef"} {
set forWhat2 Cursor
} else {
set forWhat2 Class
}
m4_error $E_DEFVAL_PAR [$this getName] $forWhat [$tgtMethod name] $forWhat2 [[$tgtMethod theClass] name] $defaultVal
} else {
$param defaultVal $defaultVal
}
}
}
}
method FTGOperParameter::getMechanism {this forWhat} {
# input output input output
# --------------------------------------------------------------
# Method * * *
# Event - - -
# EventHandler * - -
# <other> -> Event
#
# Events have no mechanism (i.e. "")
# defaults for rest to "input"
#
if {$forWhat == "Event" || ($forWhat != "EventHandler" && $forWhat != "Method")} {
return ""
}
set mechanism [string tolower [$this getPropertyValue mechanism]]
if {$mechanism == ""} {
set mechanism input
}
if {$forWhat == "EventHandler" && $mechanism != "input"} {
set mechanism input
}
return $mechanism
}
method FTGOperParameter::getCopy {this forWhat} {
# Events have no copy option (i.e. "")
# defaults to 0
#
if {$forWhat == "Event" || ($forWhat != "EventHandler" && $forWhat != "Method")} {
return 0
}
set copy [$this getPropertyValue copy]
if {$copy == ""} {
set copy 0
}
return $copy
}
# Do not delete this line -- regeneration end marker
selfPromoter OPOperParameter {this} {
FTGOperParameter promote $this
}
# File: @(#)ftgtype.tcl /main/hindenburg/3
Class FTGType : {Object} {
constructor
method destructor
method getType
method getModifier
method setOtherModifier
method isClassType
method refersClass
}
constructor FTGType {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGType::getType {this model} {
set class [$this ooplClass]
if {$class == ""} {
return ""
}
set tgtType [FTType new]
if {[$class getClassType] != "Class"} {
$tgtType name "[$class getDefSysName].[$class getName]"
$tgtType isClass 0
} else {
$tgtType classType [FTCmnClass new [$class getName] $model [$class getDefSysName] 1]
$tgtType isClass [$this isClassType]
set modifier [$this getModifier]
if {$modifier == "Array"} {
$tgtType arraySize 255
} elseif {$modifier == "LargeArray"} {
$tgtType arraySize 256
} elseif {$modifier == "Pointer"} {
$tgtType isPointer 1
} elseif {$modifier == "Other"} {
$this setOtherModifier $tgtType
}
}
return $tgtType
}
method FTGType::getModifier {this} {
return [$this getPropertyValue modifier]
}
method FTGType::setOtherModifier {this tgtType} {
set otherModifier [string trim [$this getPropertyValue other_modifier]]
if {$otherModifier != ""} {
$tgtType otherModifier $otherModifier
}
}
method FTGType::isClassType {this} {
return 0
}
method FTGType::refersClass {this} {
return 0
}
# Do not delete this line -- regeneration end marker
Class FTGTypeD : {FTGType OPType} {
}
selfPromoter OPType {this} {
FTGTypeD promote $this
}
# File: @(#)ftgattribu.tcl /main/hindenburg/2
Class FTGAttribute : {FTGFeature} {
constructor
method destructor
method generate
method getAccess
method getAccessorAccess
attribute access
attribute accessorAccess
}
constructor FTGAttribute {class this name} {
set this [FTGFeature::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGAttribute::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGAttribute::generate {this tgtClass} {
# empty
}
method FTGAttribute::getAccess {this} {
if {[$this access] != ""} {
return [$this access]
} else {
set access [string tolower [$this getPropertyValue attrib_access]]
}
if {$access == ""} {
return private
}
return $access
}
method FTGAttribute::getAccessorAccess {this mode} {
if {[$this accessorAccess] != ""} {
set manip [$this accessorAccess]
} else {
set manip [string tolower [$this getPropertyValue attrib_manipulator]]
if {$manip == ""} {
return public
}
}
set rwAccessList [split $manip -]
if {[llength $rwAccessList] == 2} {
if {$mode == "r"} {
return [lindex $rwAccessList 0]
}
return [lindex $rwAccessList 1]
}
return $manip
}
# Do not delete this line -- regeneration end marker
Class FTGAttributeD : {FTGAttribute OPAttribute} {
}
selfPromoter OPAttribute {this} {
FTGAttributeD promote $this
}
# File: @(#)ftgconstru.tcl /main/hindenburg/4
Class FTGConstructor : {FTGFeature} {
constructor
method destructor
method generate
}
constructor FTGConstructor {class this name} {
set this [FTGFeature::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGConstructor::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGConstructor::generate {this tgtClass} {
set ctor [$tgtClass constructor]
if {$ctor == ""} {
return
}
set class [$this ooplClass]
set sect [$ctor genCode]
foreach assoc [$class genAssocAttrSet] {
set var [$assoc getAssocVariable]
if {[$assoc isQualified] || [$assoc getMultiplicity] == "many"} {
$sect append "$var = new;\n"
}
set opposite [$assoc opposite]
if {$opposite != "" && [$assoc isMandatory]} {
# currently ignore...
#
# $sect append "-- > [$opposite extendAssoc $var]"
}
}
foreach ini [$this initializerSet] {
$ini generate $ctor
}
}
# Do not delete this line -- regeneration end marker
Class FTGConstructorD : {FTGConstructor OPConstructor} {
}
selfPromoter OPConstructor {this} {
FTGConstructorD promote $this
}
# File: @(#)ftgoperati.tcl /main/hindenburg/4
Class FTGOperation : {FTGFeature} {
constructor
method destructor
method generate
method genMethod
method genEvent
method genEventHandler
method genService
method genCursorDef
method genParams
method getAccess
}
constructor FTGOperation {class this name} {
set this [FTGFeature::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGOperation::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGOperation::generate {this tgtClass {operType ""}} {
set name [$this getName]
set lowerName [string tolower $name]
if {$lowerName == "create" || $lowerName == "init" || ($lowerName == "display" && [$tgtClass isMapped])} {
m4_warning $W_IGNORE_OPER $name [$tgtClass name]
return
}
set type [$this ooplType]
if {$type != ""} {
set tgtType [$type getType [$tgtClass model]]
} else {
set tgtType ""
}
if {$operType == ""} {
set operType [$this getPropertyValue oper_type]
}
if {$operType == ""} {
set operType Method
}
regsub " " $operType "" operType
$this gen${operType} $tgtClass $tgtType
}
method FTGOperation::genMethod {this tgtClass tgtType} {
set method [FTUserMethod new [$this getName] $tgtType [$this getAccess] $tgtClass]
set copy [$this getPropertyValue copy]
if {$copy == "1"} {
$method hasCopyType 1
}
$method returnEvent [string trim [$this getPropertyValue return_event]]
$method exceptEvent [string trim [$this getPropertyValue except_event]]
$this genParams $method Method
}
method FTGOperation::genEvent {this tgtClass tgtType} {
set event [FTEvent new [$this getName] "" [$this getAccess] $tgtClass]
$this genParams $event Event
}
method FTGOperation::genEventHandler {this tgtClass tgtType} {
set evHandler [FTEventHandler new [$this getName] "" [$this getAccess] $tgtClass]
$this genParams $evHandler EventHandler
}
method FTGOperation::genService {this tgtClass tgtType} {
set service [FTService new [$this getName] $tgtType "" $tgtClass]
$this genParams $service Service
}
method FTGOperation::genCursorDef {this tgtClass tgtType} {
set cursorDef [FTCursorDef new [$tgtClass name] "" "" $tgtClass]
$this genParams $cursorDef CursorDef
}
method FTGOperation::genParams {this tgtMethod forWhat} {
foreach param [$this parameterSet] {
$param generate $tgtMethod $forWhat
}
}
method FTGOperation::getAccess {this} {
return [string tolower [$this getPropertyValue method_access]]
}
# Do not delete this line -- regeneration end marker
Class FTGOperationD : {FTGOperation OPOperation} {
}
selfPromoter OPOperation {this} {
FTGOperationD promote $this
}
# File: @(#)ftgclass.tcl /main/hindenburg/1
Class FTGClass : {FTGGenClass OPClass} {
constructor
method destructor
}
constructor FTGClass {class this name} {
set this [FTGGenClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGClass::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
selfPromoter OPClass {this} {
FTGClass promote $this
}
# File: @(#)ftgclassen.tcl /main/hindenburg/5
Class FTGClassEnum : {FTGGenClass OPClassEnum} {
constructor
method destructor
method generate
method isDerivable
method getKind
}
constructor FTGClassEnum {class this name} {
set this [FTGGenClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGClassEnum::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGClassEnum::generate {this model} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class enumeration
$this FTGGenClass::generate $model
return
}
set name [$this getName]
m4_message $M_GEN_FOR "Class Enumeration" $name
set class [$model findDefinition $name]
if {$class == ""} {
set class [FTEnum new $name $model [$this getDefSysName] 0]
$class ooplClass $this
foreach feat [$this featureSet] {
set item [FTEnumItem new [$feat getName] $class]
if {[string trim [$feat getPropertyValue initial_value]] != ""} {
$item value [$feat getPropertyValue initial_value]
}
}
}
}
method FTGClassEnum::isDerivable {this} {
return 0
}
method FTGClassEnum::getKind {this} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class enumeration
return $classType
}
return "Class Enumeration"
}
# Do not delete this line -- regeneration end marker
selfPromoter OPClassEnum {this} {
FTGClassEnum promote $this
}
# File: @(#)ftgclassge.tcl /main/hindenburg/6
Class FTGClassGenericTypeDef : {FTGGenClass OPClassGenericTypeDef} {
constructor
method destructor
method generate
method isDerivable
method isLegal
method getKind
attribute _isLegal
}
constructor FTGClassGenericTypeDef {class this name} {
set this [FTGGenClass::constructor $class $this $name]
$this _isLegal -1
# Start constructor user section
# End constructor user section
return $this
}
method FTGClassGenericTypeDef::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGClassGenericTypeDef::generate {this model} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class generic typedef
$this FTGGenClass::generate $model
return
}
set name [$this getName]
m4_message $M_GEN_FOR "Class Generic Typedef" $name
set class [$model findDefinition $name]
if {$class == ""} {
set assocAttr [lindex [$this genAssocAttrSet] 0]
if {![$this isLegal $assocAttr]} {
return
}
set class [FTTypeDef new $name $model [$this getDefSysName] 0 ""]
$class ooplClass $this
$assocAttr genAssocVariable $class
$class type [[$assocAttr tgtAttrib] type]
if {![$assocAttr isQualified] && [$assocAttr getMultiplicity] == "one" && ![$assocAttr isMandatory]} {
[$class type] isPointer 1
}
}
}
method FTGClassGenericTypeDef::isDerivable {this} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class generic typedef (and no class too)
return 0
}
set assocAttr [lindex [$this genAssocAttrSet] 0]
if {[[$assocAttr ooplType] getType3GL] != ""} {
return 0
}
if {[$this isLegal $assocAttr] && ([$assocAttr getMultiplicity] == "many" || [$assocAttr isQualified])} {
return 1
}
return 0
}
method FTGClassGenericTypeDef::isLegal {this {assocAttr ""}} {
if {[$this _isLegal] != -1} {
return [$this _isLegal]
}
if {$assocAttr == ""} {
set assocAttr [lindex [$this genAssocAttrSet] 0]
}
if {![$assocAttr hasLegalDest]} {
m4_error $E_GTD_2ILL_TYPE [$this getName]
$this _isLegal 0
return 0
}
set destClass [[$assocAttr ooplType] ooplClass]
if {$destClass == ""} {
m4_error $E_GTD_2ILL_TYPE [$this getName]
$this _isLegal 0
return 0
}
if {[$destClass isA FTGClassTDef]} {
set type [$destClass getFinalType]
if {$type == ""} {
m4_error $E_GTD_2ILL_TYPE [$this getName]
$this _isLegal 0
return 0
}
if {[$type getName] == [$this getName]} {
m4_error $E_GTD_RECURSIVE [$this getName]
$this _isLegal 0
return 0
}
} elseif {[$destClass isA FTGClassGenericTypeDef]} {
$this _isLegal [$destClass isLegal]
if {![$this _isLegal]} {
m4_error $E_GTD_2ILL_GTD [$this getName] [$destClass getName]
}
return [$this _isLegal]
}
$this _isLegal 1
return 1
}
method FTGClassGenericTypeDef::getKind {this} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class generic typedef
return $classType
}
return "Class Generic Typedef"
}
# Do not delete this line -- regeneration end marker
selfPromoter OPClassGenericTypeDef {this} {
FTGClassGenericTypeDef promote $this
$this _isLegal -1
}
# File: @(#)ftgclasstd.tcl /main/hindenburg/9
Class FTGClassTDef : {FTGGenClass OPClassTDef} {
constructor
method destructor
method generate
method isDerivable
method getType
method getFinalType
method getFinalClass
method getKind
attribute cid
attribute finalType
}
global FTGClassTDef::gid
set FTGClassTDef::gid 0
constructor FTGClassTDef {class this name} {
set this [FTGGenClass::constructor $class $this $name]
$this finalType null
# Start constructor user section
# End constructor user section
return $this
}
method FTGClassTDef::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGClassTDef::generate {this model} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class typedef
$this FTGGenClass::generate $model
return
}
set name [$this getName]
m4_message $M_GEN_FOR "Class Typedef" $name
set class [$model findDefinition $name]
if {$class == ""} {
set type [$this getType]
if {$type == ""} {
m4_error $E_TD_NO_TYPE $name
return
}
set class [FTTypeDef new $name $model [$this getDefSysName] 0 [$type getType $model]]
$class ooplClass $this
}
}
method FTGClassTDef::isDerivable {this} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class typedef (and no class too)
return 0
}
set type [$this getFinalType]
if {$type != ""} {
# note: we don't use method OPType::getType3GL()
# note: we have an OPTypeDefType in case of a typedef that refers to
# itself
#
if {[$type isA OPBaseType] || [$type isA OPTypeDefType] || [$type isA OPEnumType]} {
return 0
}
if {[$type isA OPClassType] && [[$type ooplClass] getClassType] != "Class"} {
return 0
}
return 1
}
return 0
}
method FTGClassTDef::getType {this} {
# note: this method should have been a member of OPClassTDef
#
set attr [lindex [$this dataAttrSet] 0]
if {$attr == ""} {
return ""
}
# hack: if attr has no type, the OOPL model returns an OPClassType without
# an OPCLass... or an OPClass having no name... !!!
#
set type [$attr ooplType]
if {[$type isA OPClassType]} {
if {[$type ooplClass] == "" || [[$type ooplClass] getName] == ""} {
return ""
}
}
return $type
}
method FTGClassTDef::getFinalType {this} {
# return the (final) type to which this typedef really refers, i.e. resolve
# the typedef trail until a non-typedef is discovered
# note: this func returns an OPTypeDefType in case of a typedef that refers
# to itself
# currently, this is done non-recursively...
#
if {[$this finalType] != "null"} {
return [$this finalType]
}
global FTGClassTDef::gid
incr FTGClassTDef::gid
set id ${FTGClassTDef::gid}
$this cid $id
set type [$this getType]
while {1} {
if {$type == ""} {
$this finalType ""
return ""
}
if {![$type isA OPTypeDefType]} {
$this finalType $type
return $type
}
set class [$type ooplClass]
if {$class == ""} {
$this finalType ""
return ""
}
if {[$class getClassType] != "Class" || ![$class isA OPClassTDef]} {
$this finalType $type
return $type
}
if {$id == [$class cid]} {
# loop detected
$this finalType $type
return $type
}
if {[$class getName] == ""} {
$this finalType ""
return ""
}
$class cid $id
set type [$class getType]
}
}
method FTGClassTDef::getFinalClass {this} {
# return the final class to which this typedef refers, or ""
# this class is a real class, i.e. its class_type equals "Class"
#
set type [$this getFinalType]
if {$type != "" && [$type isA OPClassType] && [[$type ooplClass] getClassType] == "Class"} {
return [$type ooplClass]
}
return ""
}
method FTGClassTDef::getKind {this} {
set classType [$this getClassType]
if {$classType != "Class"} {
# this is not a class typedef
return $classType
}
return "Class Typedef"
}
# Do not delete this line -- regeneration end marker
selfPromoter OPClassTDef {this} {
FTGClassTDef promote $this
$this finalType null
}
# File: @(#)ftglinkcla.tcl /main/hindenburg/1
Class FTGLinkClass : {FTGGenClass OPLinkClass} {
constructor
method destructor
}
constructor FTGLinkClass {class this name} {
set this [FTGGenClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGLinkClass::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
selfPromoter OPLinkClass {this} {
FTGLinkClass promote $this
}
# File: @(#)ftgassocin.tcl /main/hindenburg/3
Class FTGAssocInitializer : {FTGInitializer} {
constructor
method destructor
method generate
}
constructor FTGAssocInitializer {class this name} {
set this [FTGInitializer::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGAssocInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGAssocInitializer::generate {this ctor} {
# currently not supported...
#
return
$this genCode $ctor
}
# Do not delete this line -- regeneration end marker
Class FTGAssocInitializerD : {FTGAssocInitializer OPAssocInitializer} {
}
selfPromoter OPAssocInitializer {this} {
FTGAssocInitializerD promote $this
}
# File: @(#)ftgattribi.tcl /main/hindenburg/1
Class FTGAttribInitializer : {FTGInitializer} {
constructor
method destructor
}
constructor FTGAttribInitializer {class this name} {
set this [FTGInitializer::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGAttribInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
Class FTGAttribInitializerD : {FTGAttribInitializer OPAttribInitializer} {
}
selfPromoter OPAttribInitializer {this} {
FTGAttribInitializerD promote $this
}
# File: @(#)ftginhkeyi.tcl /main/hindenburg/1
Class FTGInhKeyInitializer : {FTGInitializer} {
constructor
method destructor
}
constructor FTGInhKeyInitializer {class this name} {
set this [FTGInitializer::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGInhKeyInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
Class FTGInhKeyInitializerD : {FTGInhKeyInitializer OPInhKeyInitializer} {
}
selfPromoter OPInhKeyInitializer {this} {
FTGInhKeyInitializerD promote $this
}
# File: @(#)ftgqualini.tcl /main/hindenburg/3
Class FTGQualInitializer : {FTGInitializer} {
constructor
method destructor
method generate
}
constructor FTGQualInitializer {class this name} {
set this [FTGInitializer::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGQualInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGQualInitializer::generate {this ctor} {
# currently not supported...
}
# Do not delete this line -- regeneration end marker
Class FTGQualInitializerD : {FTGQualInitializer OPQualInitializer} {
}
selfPromoter OPQualInitializer {this} {
FTGQualInitializerD promote $this
}
# File: @(#)ftgsupercl.tcl /main/hindenburg/1
Class FTGSuperClassInitializer : {FTGInitializer} {
constructor
method destructor
}
constructor FTGSuperClassInitializer {class this name} {
set this [FTGInitializer::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGSuperClassInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
Class FTGSuperClassInitializerD : {FTGSuperClassInitializer OPSuperClassInitializer} {
}
selfPromoter OPSuperClassInitializer {this} {
FTGSuperClassInitializerD promote $this
}
# File: @(#)ftgbasetyp.tcl /main/hindenburg/2
Class FTGBaseType : {FTGType} {
constructor
method destructor
method getType
}
constructor FTGBaseType {class this name} {
set this [FTGType::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGBaseType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGBaseType::getType {this model} {
set tgtType [FTType new]
$tgtType isClass 0
set type [$this getType3GL]
set size ""
regexp {\[([0-9]*)\]$} $type dummy size
regsub {\[[0-9]*\]$} $type "" type
$tgtType name $type
if {$size != ""} {
$tgtType arraySize $size
}
set modifier [$this getModifier]
if {$modifier == "Pointer"} {
$tgtType isPointer 1
} elseif {$modifier == "Other"} {
$this setOtherModifier $tgtType
}
return $tgtType
}
# Do not delete this line -- regeneration end marker
Class FTGBaseTypeD : {FTGBaseType OPBaseType} {
}
selfPromoter OPBaseType {this} {
FTGBaseTypeD promote $this
}
# File: @(#)ftgclassty.tcl /main/hindenburg/3
Class FTGClassType : {FTGType} {
constructor
method destructor
method isClassType
method refersClass
}
constructor FTGClassType {class this name} {
set this [FTGType::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGClassType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGClassType::isClassType {this} {
return 1
}
method FTGClassType::refersClass {this} {
return 1
}
# Do not delete this line -- regeneration end marker
Class FTGClassTypeD : {FTGClassType OPClassType} {
}
selfPromoter OPClassType {this} {
FTGClassTypeD promote $this
}
# File: @(#)ftgenumtyp.tcl /main/hindenburg/1
Class FTGEnumType : {FTGType} {
constructor
method destructor
}
constructor FTGEnumType {class this name} {
set this [FTGType::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGEnumType::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
Class FTGEnumTypeD : {FTGEnumType OPEnumType} {
}
selfPromoter OPEnumType {this} {
FTGEnumTypeD promote $this
}
# File: @(#)ftgtypedef.tcl /main/hindenburg/3
Class FTGTypeDefType : {FTGType} {
constructor
method destructor
method refersClass
}
constructor FTGTypeDefType {class this name} {
set this [FTGType::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGTypeDefType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGTypeDefType::refersClass {this} {
# find out whether this type is an alias for a class type
#
# note the difference between this method and method refersClass
# this method decides whether this IS a class type, i.e. if it may appear
# in the forward section
#
set class [$this ooplClass]
if {$class == ""} {
return 0
}
if {[$class isDerivable]} {
return 1
}
return 0
}
# Do not delete this line -- regeneration end marker
Class FTGTypeDefTypeD : {FTGTypeDefType OPTypeDefType} {
}
selfPromoter OPTypeDefType {this} {
FTGTypeDefTypeD promote $this
}
# File: @(#)ftgdataatt.tcl /main/hindenburg/4
Class FTGDataAttr : {FTGAttribute} {
constructor
method destructor
method generate
method genCmnAttrib
method genVirtAttrib
method genConstAttrib
}
constructor FTGDataAttr {class this name} {
set this [FTGAttribute::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGDataAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGDataAttr::generate {this tgtClass} {
set tgtType [[$this ooplType] getType [$tgtClass model]]
set const [$this getPropertyValue const]
if {$const == 1} {
set kind Const
} elseif {[$this isDerived]} {
set kind Virt
} else {
set kind Cmn
}
$this gen${kind}Attrib $tgtClass $tgtType
}
method FTGDataAttr::genCmnAttrib {this tgtClass tgtType} {
set name [$this getName]
if {$tgtType == ""} {
m4_error $E_ATTR_HAS_NO "" $name [$tgtClass name] " type"
return
}
set attrib [FTCmnAttrib new $name $tgtType [$this getAccess] $tgtClass]
set sect [[$tgtClass constructor] genCode]
if {[$tgtType isClassType]} {
$sect append "$name = new;\n"
}
set value [$this getInitialValue]
if {[string trim $value] != "" && [$tgtClass constructor] != ""} {
$sect append "$name = $value;\n"
}
set access [$this getAccessorAccess r]
if {$access != "none"} {
set accessor [FTAccMethod new "get[cap $name]" $tgtType $access $tgtClass $attrib]
if {[$tgtType isClassType]} {
$accessor hasCopyType 1
}
set sect [$accessor genCode]
$sect append "return $name;\n"
}
set access [$this getAccessorAccess w]
if {$access != "none"} {
set accessor [FTAccMethod new "set[cap $name]" "" $access $tgtClass $attrib]
set param [FTParameter new "new[cap $name]" input $accessor $tgtType]
if {[$tgtType isClassType]} {
$param asCopy 1
}
set sect [$accessor genCode]
$sect append "$name = new[cap $name];\n"
}
}
method FTGDataAttr::genVirtAttrib {this tgtClass tgtType} {
set name [$this getName]
if {$tgtType == ""} {
m4_error $E_ATTR_HAS_NO "Virtual " $name [$tgtClass name] " type"
return
}
set getExpr [$this getPropertyValue get_expr]
if {[string trim $getExpr] == ""} {
m4_error $E_ATTR_HAS_NO "Virtual " $name [$tgtClass name] " get expression"
return
}
set attr [FTVirtAttrib new $name $tgtType [$this getAccess] $tgtClass $getExpr]
set setExpr [$this getPropertyValue set_expr]
if {[string trim $setExpr] != ""} {
$attr setExpr $setExpr
}
}
method FTGDataAttr::genConstAttrib {this tgtClass tgtType} {
set name [$this getName]
set value [$this getInitialValue]
if {[string trim $value] == ""} {
m4_error $E_ATTR_HAS_NO "Constant " $name [$tgtClass name] " value"
return
}
FTConstAttrib new $name "" [$this getAccess] $tgtClass $value
}
# Do not delete this line -- regeneration end marker
Class FTGDataAttrD : {FTGDataAttr OPDataAttr} {
}
selfPromoter OPDataAttr {this} {
FTGDataAttrD promote $this
}
# File: @(#)ftggenasso.tcl /main/hindenburg/5
Class FTGGenAssocAttr : {FTGAttribute} {
constructor
method destructor
method generate
method genAddAccessor
method genGetAccessor
method genGetManyAccessor
method genRemoveAccessor
method genSetAccessor
method genAssocVariable
method getAssocIdentifier
method getAssocVariable
method extendAssoc
method reduceAssoc
method setAssoc
method getMaxVolume
method overruleAccess
method hasLegalDest
attribute tgtAttrib
}
constructor FTGGenAssocAttr {class this name} {
set this [FTGAttribute::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGGenAssocAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGGenAssocAttr::generate {this tgtClass} {
# empty
}
method FTGGenAssocAttr::genAddAccessor {this tgtClass} {
set access [$this getAccessorAccess w]
if {$access == "none"} {
return
}
set ident [$this getAssocIdentifier]
if {[$this isOrdered]} {
set accessor [FTAccMethod new "append[cap $ident]" "" $access $tgtClass [$this tgtAttrib]]
} else {
set accessor [FTAccMethod new "add[cap $ident]" "" $access $tgtClass [$this tgtAttrib]]
}
if {[$this isQualified]} {
set qualifier [$this qualifier]
set qualType [[$qualifier ooplType] getType [$tgtClass model]]
set qualId "[$qualifier getName]Key"
FTParameter new $qualId input $accessor $qualType
}
set opposite [$this opposite]
if {$opposite != "" && [$opposite isQualified]} {
# update other side
#
set qualifier [$opposite qualifier]
set qualType [[$qualifier ooplType] getType [$tgtClass model]]
set qualId "[$qualifier getName]Key"
FTParameter new $qualId input $accessor $qualType
}
set paramId "new[cap $ident]"
set paramType [[$this ooplType] getType [$tgtClass model]]
FTParameter new $paramId input $accessor $paramType
set sect [$accessor genCode]
$sect append "if ($paramId = NIL) then\n"
$sect append " return;\n";
$sect append "end if;\n";
if {$opposite != ""} {
if {[$opposite getMultiplicity] == "one" &&
![$opposite isQualified] && ![$this isQualified]} {
$sect append [$opposite setAssoc $paramId]
}
$sect append [$opposite extendAssoc $paramId]
}
if {[$this isQualified]} {
set varName [$this getAssocVariable]
set contType [[$this ooplType] getType [$tgtClass model]]
if {[$this getMultiplicity] == "many"} {
$contType arraySize [$this getMaxVolume]
}
set contName [$contType getTypeName $tgtClass]
$tgtClass addInclude Framework
$tgtClass addForward Object
$sect append "theSet : $contName;\n"
$sect append "obj : Framework.Object = $varName.Find($qualId);\n"
$sect append "if (obj = NIL) then\n"
$sect append " theSet = new;\n"
$sect append " $varName.Enter(theSet, $qualId);\n"
$sect append "else\n"
$sect append " theSet = ($contName) (obj);\n"
$sect append "end if;\n"
if {[$this isOrdered]} {
$sect append "theSet.AppendRow($paramId);\n"
} else {
$sect append "if (theSet.FindRowForObject($paramId) = 0) then\n"
$sect append " theSet.AppendRow($paramId);\n"
$sect append "end if;\n"
}
} else {
$sect append [$this extendAssoc "" $paramId]
}
}
method FTGGenAssocAttr::genGetAccessor {this tgtClass} {
set access [$this getAccessorAccess r]
if {$access == "none"} {
return
}
set varName [$this getAssocVariable]
set accType [[$this ooplType] getType [$tgtClass model]]
set accessor [FTAccMethod new "get[cap $varName]" $accType $access $tgtClass [$this tgtAttrib]]
set sect [$accessor genCode]
$sect append "return $varName;\n"
}
method FTGGenAssocAttr::genGetManyAccessor {this tgtClass} {
set access [$this getAccessorAccess r]
if {$access == "none"} {
return
}
set varName [$this getAssocVariable]
set accType [[$this ooplType] getType [$tgtClass model]]
$accType arraySize [$this getMaxVolume]
set accessor [FTAccMethod new "get[cap $varName]" $accType $access $tgtClass [$this tgtAttrib]]
set sect [$accessor genCode]
$sect append "return $varName;\n"
}
method FTGGenAssocAttr::genRemoveAccessor {this tgtClass} {
set access [$this getAccessorAccess w]
if {$access == "none"} {
return
}
set ident [$this getAssocIdentifier]
set accessor [FTAccMethod new "remove[cap $ident]" "" $access $tgtClass [$this tgtAttrib]]
set opposite [$this opposite]
if {$opposite != "" && [$opposite isQualified]} {
set qualifier [$opposite qualifier]
set qualType [[$qualifier ooplType] getType [$tgtClass model]]
set qualId "[$qualifier getName]Key"
FTParameter new $qualId input $accessor $qualType
}
set paramId "old[cap $ident]"
set paramType [[$this ooplType] getType [$tgtClass model]]
FTParameter new $paramId input $accessor $paramType
set sect [$accessor genCode]
$sect append "if ($paramId = NIL) then\n"
$sect append " return;\n"
$sect append "end if;\n";
if {$opposite != ""} {
$sect append [$opposite reduceAssoc $paramId]
}
$sect append [$this reduceAssoc "" $paramId]
}
method FTGGenAssocAttr::genSetAccessor {this tgtClass} {
set access [$this getAccessorAccess w]
if {$access == "none"} {
return
}
set ident [$this getAssocIdentifier]
set accessor [FTAccMethod new "set[cap $ident]" "" $access $tgtClass [$this tgtAttrib]]
set opposite [$this opposite]
if {$opposite != "" && [$opposite isQualified]} {
set qualifier [$opposite qualifier]
set qualType [[$qualifier ooplType] getType [$tgtClass model]]
set qualId "[$qualifier getName]Key"
FTParameter new $qualId input $accessor $qualType
}
set paramId "new[cap $ident]"
set paramType [[$this ooplType] getType [$tgtClass model]]
FTParameter new $paramId input $accessor $paramType
set sect [$accessor genCode]
if {$opposite != ""} {
set oppName [$opposite getName]
if {[$opposite isQualified]} {
$sect append "if ($paramId != NIL) then\n"
$sect append " [$opposite extendAssoc $paramId]"
$sect append "end if;\n";
} else {
$sect append "if ($ident != NIL) then\n"
$sect append " [$opposite reduceAssoc $ident]"
$sect append "end if;\n";
if {[$opposite getMultiplicity] == "one"} {
$sect append "if ($paramId != NIL) then\n"
$sect append " [$opposite setAssoc $paramId]"
$sect append " [$opposite extendAssoc $paramId]"
$sect append "end if;\n"
} else {
$sect append "if ($paramId != NIL) then\n"
$sect append " [$opposite extendAssoc $paramId]"
$sect append "end if;\n"
}
}
}
$sect append "$ident = $paramId;\n"
}
method FTGGenAssocAttr::genAssocVariable {this tgtClass} {
if {[$this isQualified]} {
set tgtType [FTType new]
$tgtType classType [FTCmnClass new "HashTable" [$tgtClass model] "Framework" 1]
} else {
set tgtType [[$this ooplType] getType [$tgtClass model]]
if {[$this getMultiplicity] == "many"} {
$tgtType arraySize [$this getMaxVolume]
}
}
if {[$this opposite] != ""} {
set access public
} else {
set access [$this getAccess]
}
set name [$this getAssocVariable]
# if {[$this isQualified]} { set name "${name}Dict" }
$this tgtAttrib [FTCmnAttrib new $name $tgtType $access $tgtClass]
}
method FTGGenAssocAttr::getAssocIdentifier {this} {
if {[$this isLinkAttr]} {
return [uncap [[$this ooplType] getName]Of[cap [$this getName]]]
}
return [$this getName]
}
method FTGGenAssocAttr::getAssocVariable {this} {
set name [$this getAssocIdentifier]
if {[$this getMultiplicity] == "many"} {
set name "${name}Set"
}
return $name
}
method FTGGenAssocAttr::extendAssoc {this {prefix ""} {element "self"}} {
if {$prefix != ""} {
set prefix "${prefix}."
}
set varName [$this getAssocVariable]
if {[$this isQualified]} {
set qualId "[[$this qualifier] getName]Key"
if {[$this getMultiplicity] == "one"} {
return "$prefix$varName.Enter($element, $qualId);\n"
}
set ident [$this getAssocIdentifier]
if {[$this isOrdered]} {
return "${prefix}append[cap $ident]($qualId, $element);\n"
}
return "${prefix}add[cap $ident]($qualId, $element);\n"
}
if {[$this getMultiplicity] == "one"} {
return "$prefix$varName = $element;\n"
}
if {[$this isOrdered]} {
return "$prefix$varName.AppendRow($element);\n"
}
return "if ($prefix$varName.FindRowForObject($element) = 0) then\n $prefix$varName.AppendRow($element);\nend if;\n"
}
method FTGGenAssocAttr::reduceAssoc {this {prefix ""} {element "self"}} {
if {$prefix != ""} {
set prefix "${prefix}."
}
set varName [$this getAssocVariable]
if {[$this isQualified]} {
set qualId "[[$this qualifier] getName]Key"
if {[$this getMultiplicity] == "one"} {
return "$prefix$varName.Remove($qualId);\n"
}
set ident [$this getAssocIdentifier]
return "${prefix}remove[cap $ident]($qualId, $element);\n"
}
if {[$this getMultiplicity] == "one"} {
return "$prefix$varName = NIL;\n"
}
return "$prefix$varName.DeleteRow(object = $element);\n"
}
method FTGGenAssocAttr::setAssoc {this {prefix ""} {element "NIL"}} {
if {$prefix != ""} {
set prefix "${prefix}."
}
return "${prefix}set[cap [$this getAssocIdentifier]]($element);\n"
}
method FTGGenAssocAttr::getMaxVolume {this} {
# should be called for 'many' side only
# defaults to 255
#
set maxVol [$this getPropertyValue assoc_volume]
if {$maxVol == "" || $maxVol < 1} {
return 255
}
return $maxVol
}
method FTGGenAssocAttr::overruleAccess {this} {
# makes sure that the access for bidirectional assoc's and mandatory sides
# is 'public'
#
if {[$this isMandatory]} {
$this access public
}
if {[$this opposite] != ""} {
$this accessorAccess public-public
[$this opposite] accessorAccess public-public
}
}
method FTGGenAssocAttr::hasLegalDest {this} {
if {[[$this ooplType] isA OPBaseType]} {
m4_error $E_STDT_DEST [[$this ooplClass] getKind] [[$this ooplClass] getName] [[$this ooplType] getName]
return 0
}
set destClass [[$this ooplType] ooplClass]
if {$destClass == ""} {
# class without name on other side
return 0
}
if {[$destClass getClassType] != "Class"} {
m4_error $E_ILL_DEST [[$this ooplClass] getKind] [[$this ooplClass] getName] [$destClass getKind] [$destClass getDefSysName] [$destClass getName]
return 0
}
return 1
}
# Do not delete this line -- regeneration end marker
Class FTGGenAssocAttrD : {FTGGenAssocAttr OPGenAssocAttr} {
}
selfPromoter OPGenAssocAttr {this} {
FTGGenAssocAttrD promote $this
}
# File: @(#)ftgassocat.tcl /main/hindenburg/3
Class FTGAssocAttr : {FTGGenAssocAttr} {
constructor
method destructor
method generate
}
constructor FTGAssocAttr {class this name} {
set this [FTGGenAssocAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGAssocAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGAssocAttr::generate {this tgtClass} {
if {![$this hasLegalDest]} {
return
}
$this genAssocVariable $tgtClass
$this overruleAccess
if {[$this getMultiplicity] == "one"} {
$this genGetAccessor $tgtClass
$this genSetAccessor $tgtClass
} else {
$this genAddAccessor $tgtClass
$this genRemoveAccessor $tgtClass
$this genGetManyAccessor $tgtClass
}
}
# Do not delete this line -- regeneration end marker
Class FTGAssocAttrD : {FTGAssocAttr OPAssocAttr} {
}
selfPromoter OPAssocAttr {this} {
FTGAssocAttrD promote $this
}
# File: @(#)ftglinkatt.tcl /main/hindenburg/3
Class FTGLinkAttr : {FTGGenAssocAttr} {
constructor
method destructor
method generate
}
constructor FTGLinkAttr {class this name} {
set this [FTGGenAssocAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGLinkAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGLinkAttr::generate {this tgtClass} {
if {![$this hasLegalDest]} {
return
}
$this genAssocVariable $tgtClass
$this overruleAccess
if {[$this getMultiplicity] == "one"} {
$this genGetAccessor $tgtClass
} else {
$this genGetManyAccessor $tgtClass
}
}
# Do not delete this line -- regeneration end marker
Class FTGLinkAttrD : {FTGLinkAttr OPLinkAttr} {
}
selfPromoter OPLinkAttr {this} {
FTGLinkAttrD promote $this
}
# File: @(#)ftgqualatt.tcl /main/hindenburg/5
Class FTGQualAttr : {FTGGenAssocAttr} {
constructor
method destructor
method generate
method genGetQualifiedAccessor
method genRemoveQualifiedAccessor
method genSetQualifiedAccessor
}
constructor FTGQualAttr {class this name} {
set this [FTGGenAssocAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGQualAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGQualAttr::generate {this tgtClass} {
if {![$this hasLegalDest]} {
return
}
$this overruleAccess
$this genAssocVariable $tgtClass
$this genGetQualifiedAccessor $tgtClass
if {[$this getMultiplicity] == "one"} {
$this genSetQualifiedAccessor $tgtClass
} else {
$this genAddAccessor $tgtClass
}
$this genRemoveQualifiedAccessor $tgtClass
}
method FTGQualAttr::genGetQualifiedAccessor {this tgtClass} {
set access [$this getAccessorAccess r]
if {$access == "none"} {
return
}
set varName [$this getAssocVariable]
set accType [[$this ooplType] getType [$tgtClass model]]
if {[$this getMultiplicity] == "many"} {
$accType arraySize [$this getMaxVolume]
}
set accessor [FTAccMethod new "get[cap $varName]" $accType public $tgtClass [$this tgtAttrib]]
set qualifier [$this qualifier]
set qualType [[$qualifier ooplType] getType [$tgtClass model]]
set qualId "[$qualifier getName]Key"
FTParameter new $qualId input $accessor $qualType
if {[$tgtClass constructor] != ""} {
set sect [[$tgtClass constructor] genCode]
$sect append "-- ! the user should initialize HashTable '$varName' properly\n"
$sect append "-- ! by calling ``$varName.Setup(...)'' in the user section\n"
$sect append "--\n"
m4_message $M_INITIALIZE [$tgtClass name] $varName [$tgtClass name]
}
set sect [$accessor genCode]
$tgtClass addInclude Framework
$tgtClass addForward Object
$sect append "obj : Framework.Object = $varName.Find($qualId);\n"
$sect append "if (obj != NIL) then\n"
$sect append " return ([$accType getTypeName $tgtClass]) (obj);\n"
$sect append "end if;\n"
$sect append "return NIL;\n"
}
method FTGQualAttr::genRemoveQualifiedAccessor {this tgtClass} {
set access [$this getAccessorAccess w]
if {$access == "none"} {
return
}
set ident [$this getAssocIdentifier]
set accessor [FTAccMethod new "remove[cap $ident]" "" $access $tgtClass [$this tgtAttrib]]
set qualifier [$this qualifier]
set qualType [[$qualifier ooplType] getType [$tgtClass model]]
set qualId "[$qualifier getName]Key"
FTParameter new $qualId input $accessor $qualType
set paramId "old[cap $ident]"
set opposite [$this opposite]
set varName [$this getAssocVariable]
set sect [$accessor genCode]
set contType [[$this ooplType] getType [$tgtClass model]]
if {[$this getMultiplicity] == "one"} {
$tgtClass addInclude Framework
$tgtClass addForward Object
$sect append "obj : Framework.Object = $varName.Find($qualId);\n"
$sect append "if (obj = NIL) then\n"
$sect append " return;\n"
$sect append "end if;\n"
$sect append [$this reduceAssoc]
if {$opposite != ""} {
set contName [$contType getTypeName $tgtClass]
$sect append "$paramId : $contName = ($contName) (obj);\n"
}
} else {
FTParameter new $paramId input $accessor [[$this ooplType] getType [$tgtClass model]]
$contType arraySize [$this getMaxVolume]
set contName [$contType getTypeName $tgtClass]
$tgtClass addInclude Framework
$tgtClass addForward Object
$sect append "if ($paramId = NIL) then\n"
$sect append " return;\n"
$sect append "end if;\n"
$sect append "obj : Framework.Object = $varName.Find($qualId);\n";
$sect append "if (obj != NIL) then\n";
$sect append " theSet : $contName = ($contName) (obj);\n";
$sect append " theSet.DeleteRow(object = $paramId);\n"
$sect append "end if;\n"
}
if {$opposite != ""} {
$sect append [$opposite reduceAssoc $paramId]
}
}
method FTGQualAttr::genSetQualifiedAccessor {this tgtClass} {
set access [$this getAccessorAccess w]
if {$access == "none"} {
return
}
set ident [$this getAssocIdentifier]
set accessor [FTAccMethod new "set[cap $ident]" "" $access $tgtClass [$this tgtAttrib]]
set qualifier [$this qualifier]
set qualType [[$qualifier ooplType] getType [$tgtClass model]]
set qualId "[$qualifier getName]Key"
FTParameter new $qualId input $accessor $qualType
set paramId "new[cap $ident]"
FTParameter new $paramId input $accessor [[$this ooplType] getType [$tgtClass model]]
set sect [$accessor genCode]
$sect append "if ($paramId = NIL) then\n"
$sect append " return;\n"
$sect append "end if;\n";
$sect append "$ident.Enter($paramId, $qualId);\n"
set opposite [$this opposite]
if {$opposite != ""} {
$sect append [$opposite extendAssoc $paramId]
}
}
# Do not delete this line -- regeneration end marker
Class FTGQualAttrD : {FTGQualAttr OPQualAttr} {
}
selfPromoter OPQualAttr {this} {
FTGQualAttrD promote $this
}
# File: @(#)ftgreverse.tcl /main/hindenburg/3
Class FTGReverseLinkAttr : {FTGGenAssocAttr} {
constructor
method destructor
method generate
}
constructor FTGReverseLinkAttr {class this name} {
set this [FTGGenAssocAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGReverseLinkAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FTGReverseLinkAttr::generate {this tgtClass} {
if {![$this hasLegalDest]} {
return
}
$this genAssocVariable $tgtClass
$this overruleAccess
if {[$this getMultiplicity] == "one"} {
$this genGetAccessor $tgtClass
} else {
$this genGetManyAccessor $tgtClass
}
}
# Do not delete this line -- regeneration end marker
Class FTGReverseLinkAttrD : {FTGReverseLinkAttr OPReverseLinkAttr} {
}
selfPromoter OPReverseLinkAttr {this} {
FTGReverseLinkAttrD promote $this
}
# File: @(#)ftgqualass.tcl /main/hindenburg/2
Class FTGQualAssocAttr : {FTGQualAttr} {
constructor
method destructor
}
constructor FTGQualAssocAttr {class this name} {
set this [FTGQualAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGQualAssocAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
Class FTGQualAssocAttrD : {FTGQualAssocAttr OPQualAssocAttr} {
}
selfPromoter OPQualAssocAttr {this} {
FTGQualAssocAttrD promote $this
}
# File: @(#)ftgquallin.tcl /main/hindenburg/2
Class FTGQualLinkAttr : {FTGQualAttr} {
constructor
method destructor
}
constructor FTGQualLinkAttr {class this name} {
set this [FTGQualAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method FTGQualLinkAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
Class FTGQualLinkAttrD : {FTGQualLinkAttr OPQualLinkAttr} {
}
selfPromoter OPQualLinkAttr {this} {
FTGQualLinkAttrD promote $this
}