home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-12-01 | 74.9 KB | 2,915 lines |
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1997 by Cayenne Software, Inc.
- #
- # This software is furnished under a license and may be used only in
- # accordance with the terms of such license and with the inclusion of
- # the above copyright notice. This software or any other copies thereof
- # may not be provided or otherwise made available to any other person.
- # No title to and ownership of the software is hereby transferred.
- #
- # The information in this software is subject to change without notice
- # and should not be construed as a commitment by Cayenne Software, Inc.
- #
- #---------------------------------------------------------------------------
- #
- # File : forteoopl.tcl
- # Author :
- # Original date : November 1997
- # Description : Classes for code generation
- #
- #---------------------------------------------------------------------------
-
-
- # File: @(#)ftgfeature.tcl /main/titanic/5
-
-
- 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
-
- if [isCommand CMFeature] {
- Class FTGFeatureD : {FTGFeature CMFeature} {
- }
- } else {
- Class FTGFeatureD : {FTGFeature OPFeature} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPFeature) FTGFeatureD
-
- selfPromoter OPFeature {this} {
- FTGFeatureD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftggenclas.tcl /main/titanic/11
-
-
- Class FTGGenClass : {Object} {
- constructor
- method destructor
- method promoter
- method generate
- method genClass
- method genInterface
- method genServiceObject
- method genConstant
- method genCursor
- method genStruct
- method genUnion
- method genComposite
- method getClassType
- method getDefSysName
- method getSuperNames
- method warn4inh
- method isDerivable
- method getFinalClass
- method getKind
- method getSpecKind
- attribute classType
- attribute specKind
- attribute superNames
- attribute loopGuard
- }
-
- constructor FTGGenClass {class this name} {
- set this [Object::constructor $class $this $name]
- $this specKind INIT
- $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::promoter {this} {
- $this specKind INIT
- $this loopGuard -1
- }
-
- method FTGGenClass::generate {this model {checkOnly 0}} {
- set msgId $M_GEN_FOR
- if {$checkOnly} {
- set msgId $M_CHK_FOR
- }
- set classType [$this getClassType]
- m4_message $msgId $classType [$this getName]
- if {[info procs FTGGenClass::gen$classType] != ""} {
- $this gen$classType $model
- }
- }
-
- method FTGGenClass::genClass {this model} {
- set name [$this getName]
-
- # one super class (defaults to Framework.Object)
- # zero or more interfaces
- #
- set warn 0
- set superClass ""
- set interfaces {}
- foreach gen [$this genNodeSet] {
- set super [$gen superClass]
- if {[$super getKind] == "Interface"} {
- lappend interfaces $super
- continue
- }
- if {$superClass == ""} {
- set superClass $super
- } elseif {!$warn} {
- set warn 1
- m4_warning $W_N_SUPERS $name [$superClass getDefSysName] [$superClass getName]
- }
- }
-
- if {$superClass == ""} {
- m4_warning $W_CLASS_NO_SUPER $name
- } else {
- if {![$superClass isDerivable]} {
- m4_error $E_ILL_SUPER $name [$superClass getKind] [$superClass getDefSysName] [$superClass getName]
- return
- }
- }
-
- # target class
- #
- set kind [$this getSpecKind]
- set tgtClass [$model findDefinition $name]
- if {$tgtClass == ""} {
- # note: a generic typedef class has no defining system
- set tgtClass [FT${kind}Class new $name $model [$this getDefSysName] 0]
- $tgtClass ooplClass $this
- }
-
- # super
- #
- set tgtSuperType [FTType new]
- if {$superClass == ""} {
- $tgtSuperType classType [FTClassType new "Object" "Framework" "Class" ""]
- } else {
- $tgtSuperType classType [FTClassType new [$superClass getName] [$superClass getDefSysName] "Class" $kind]
- [$tgtSuperType classType] isLocal [expr {![$superClass isExternal]}]
- }
- $tgtClass super $tgtSuperType
-
- foreach superInterface $interfaces {
- set tgtSuperType [FTType new]
- $tgtSuperType classType [FTClassType new [$superInterface getName] [$superInterface getDefSysName] "Interface" ""]
- $tgtClass addInterface $tgtSuperType
- }
-
- # Init, Display methods
- #
- $tgtClass constructor [FTInit new "" "" "" $tgtClass]
- if {$kind == "Win"} {
- FTDisplay new "" "" "" $tgtClass
- }
-
- # features
- #
- foreach feat [$this featureSet] {
- $feat generate $tgtClass
- }
- }
-
- method FTGGenClass::genInterface {this model} {
- set name [$this getName]
-
- # super interface (may be "")
- #
- set superInterface ""
- set warn 0
- foreach gen [$this genNodeSet] {
- set super [$gen superClass]
- if {[$super getKind] != "Interface"} {
- m4_error $E_ILL_ISUPER $name [$super getKind] [$super getDefSysName] [$super getName]
- continue
- }
- if {$superInterface == ""} {
- set superInterface $super
- } elseif {!$warn} {
- set warn 1
- m4_warning $W_N_ISUPERS $name [$superInterface getDefSysName] [$superInterface getName]
- }
- }
-
- # target interface
- #
- set tgtInterface [$model findDefinition $name]
- if {$tgtInterface == ""} {
- # note: a generic typedef class has no defining system
- set tgtInterface [FTInterface new $name $model [$this getDefSysName] 0]
- $tgtInterface ooplClass $this
- }
-
- # super
- #
- if {$superInterface != ""} {
- set tgtSuperType [FTType new]
- $tgtSuperType classType [FTClassType new [$superInterface getName] [$superInterface getDefSysName] "Interface" ""]
- $tgtInterface super $tgtSuperType
- }
-
- # features
- #
- foreach feat [$this featureSet] {
- # check: all public, no attributes
- if {[$feat isA FTGAttribute] && [$feat getKind] == "Cmn"} {
- m4_error $E_ILL_IATTR $name [$feat getName]
- continue
- }
- if {[$feat isA FTGConstructor]} {
- continue
- }
- if {[$feat getAccess] == "private"} {
- m4_error $E_ILL_IACCESS $name [$feat getName]
- continue
- }
- $feat generate $tgtInterface
- }
- }
-
- method FTGGenClass::genServiceObject {this model} {
- set name [$this getName]
- set class [$model findDefinition $name]
- if {$class == ""} {
- $this warn4inh
- 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 == ""} {
- $this warn4inh
- 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 == ""} {
- $this warn4inh
- 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 == ""} {
- $this warn4inh
- 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::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
- }
- if {[$superClass getKind] == "Interface"} {
- continue
- }
- lappend superNames [$superClass getName]
- set newNames [$superClass getSuperNames]
- if {$newNames != {}} {
- eval "lappend superNames $newNames"
- }
- }
- $this superNames $superNames
-
- $this loopGuard 0
- return [$this superNames]
- }
-
- method FTGGenClass::warn4inh {this} {
- if {[$this genNodeSet] != {}} {
- m4_warning $W_IGNORE_INH [$this getKind] [$this getName] specializations
- }
- if {[$this specNodeSet] != {}} {
- m4_warning $W_IGNORE_INH [$this getKind] [$this getName] generalizations
- }
- }
-
- method FTGGenClass::isDerivable {this} {
- set kind [$this getKind]
- return [expr {$kind == "Class" || $kind == "Interface"}]
- }
-
- method FTGGenClass::getFinalClass {this} {
- return $this
- }
-
- method FTGGenClass::getKind {this} {
- return [$this getClassType]
- }
-
- method FTGGenClass::getSpecKind {this} {
- if {[$this specKind] != "INIT"} {
- return [$this specKind]
- }
- if {[$this getClassType] == "Class"} {
- set superNames [List new]
- $superNames contents [$this getSuperNames]
- if {[$superNames search -exact "UserWindow"] != -1} {
- $this specKind Win
- } elseif {[$superNames search -glob "*Nullable"] != -1} {
- $this specKind Dom
- } elseif {[$superNames search -exact "Object"] != -1} {
- $this specKind Cmn
- } else {
- # not derived from 'Object'
- # return
- $this specKind Cmn
- }
- } else {
- $this specKind ""
- }
- return [$this specKind]
- }
-
- # Do not delete this line -- regeneration end marker
-
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftginitial.tcl /main/titanic/4
-
-
- 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
-
- if [isCommand CMInitializer] {
- Class FTGInitializerD : {FTGInitializer CMInitializer} {
- }
- } else {
- Class FTGInitializerD : {FTGInitializer OPInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPInitializer) FTGInitializerD
-
- selfPromoter OPInitializer {this} {
- FTGInitializerD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgoperpar.tcl /main/titanic/6
-
-
- Class FTGOperParameter : {Object} {
- 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
- }
- } else {
- m4_warning $E_NODEFVAL_PAR [$this getName] $forWhat [$tgtMethod name] [[$tgtMethod theClass] name]
- }
- }
- }
-
- 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} {
- # relevant for Method, Event, Event Handler
- # <other>s equal Event
- # Events have no copy option (i.e. 0)
- # 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
-
- if [isCommand CMOperParameter] {
- Class FTGOperParameterD : {FTGOperParameter CMOperParameter} {
- }
- } else {
- Class FTGOperParameterD : {FTGOperParameter OPOperParameter} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPOperParameter) FTGOperParameterD
-
- selfPromoter OPOperParameter {this} {
- FTGOperParameterD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgtype.tcl /main/titanic/8
-
-
- 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 name [$class getName]
- set tgtType [FTType new]
- $tgtType classType [FTClassType new $name [$class getDefSysName] [$class getKind] [$class getSpecKind]]
- [$tgtType classType] isLocal [expr {![$class isExternal]}]
-
- 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
-
- if [isCommand CMType] {
- Class FTGTypeD : {FTGType CMType} {
- }
- } else {
- Class FTGTypeD : {FTGType OPType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPType) FTGTypeD
-
- selfPromoter OPType {this} {
- FTGTypeD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgattribu.tcl /main/titanic/7
-
-
- Class FTGAttribute : {FTGFeature} {
- constructor
- method destructor
- method generate
- method getAccess
- method getAccessorAccess
- method getKind
- 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_visibility]]
- }
- 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_access]]
- 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
- }
-
- method FTGAttribute::getKind {this} {
- return Cmn
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMAttribute] {
- Class FTGAttributeD : {FTGAttribute CMAttribute} {
- }
- } else {
- Class FTGAttributeD : {FTGAttribute OPAttribute} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAttribute) FTGAttributeD
-
- selfPromoter OPAttribute {this} {
- FTGAttributeD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgconstru.tcl /main/titanic/7
-
-
- 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
-
- if [isCommand CMConstructor] {
- Class FTGConstructorD : {FTGConstructor CMConstructor} {
- }
- } else {
- Class FTGConstructorD : {FTGConstructor OPConstructor} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPConstructor) FTGConstructorD
-
- selfPromoter OPConstructor {this} {
- FTGConstructorD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgoperati.tcl /main/titanic/9
-
-
- 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]
-
- 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
- }
-
- # we ignore "Init.*", "Display()" (in window class), "$create.*"
- #
- if {$lowerName == "init"} {
- m4_warning $W_IGNORE_OPER $name [$tgtClass name]
- return
- }
- if {$lowerName == "display" && [$tgtClass isMapped] && $tgtType == "" && [$this parameterSet] == {}} {
- m4_warning $W_IGNORE_OPER $name [$tgtClass name]
- return
- }
- if {$lowerName == "create" && [$this isClassFeature]} {
- if {$tgtType != "" || [$this parameterSet] != {}} {
- m4_warning $W_IGNORE_OPER $name [$tgtClass name]
- }
- return
- }
-
- regsub " " $operType "" operType
- if {[info procs FTGOperation::gen$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} {
- if {$tgtType == "" || [[$tgtType classType] isInterface]} {
- m4_error $E_SERVICE_NO_CLASS [[$tgtClass ooplClass] getName]
- return
- }
- 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
-
- if [isCommand CMOperation] {
- Class FTGOperationD : {FTGOperation CMOperation} {
- }
- } else {
- Class FTGOperationD : {FTGOperation OPOperation} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPOperation) FTGOperationD
-
- selfPromoter OPOperation {this} {
- FTGOperationD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgclass.tcl /main/titanic/4
-
-
- Class FTGClass : {FTGGenClass} {
- 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
-
- if [isCommand CMClass] {
- Class FTGClassD : {FTGClass CMClass} {
- }
- } else {
- Class FTGClassD : {FTGClass OPClass} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClass) FTGClassD
-
- selfPromoter OPClass {this} {
- FTGClassD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgclassen.tcl /main/titanic/10
-
-
- Class FTGClassEnum : {FTGGenClass} {
- constructor
- method destructor
- method generate
- method isDerivable
- method getKind
- method getSpecKind
- }
-
- 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 {checkOnly 0}} {
- set classType [$this getClassType]
- if {$classType != "Class"} {
- # this is not a class enumeration
- $this FTGGenClass::generate $model $checkOnly
- return
- }
-
- set name [$this getName]
- set msgId $M_GEN_FOR
- if {$checkOnly} {
- set msgId $M_CHK_FOR
- }
- m4_message $msgId "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]
- set value [string trim [$feat getPropertyValue initial_value]]
- if {$value != ""} {
- $item value $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"
- }
-
- method FTGClassEnum::getSpecKind {this} {
- if {[$this specKind] != "INIT"} {
- return [$this specKind]
- }
- if {[$this getClassType] != "Class"} {
- # this is not a class enumeration
- return [$this FTGGenClass::getSpecKind]
- }
- $this specKind ""
- return [$this specKind]
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClassEnum] {
- Class FTGClassEnumD : {FTGClassEnum CMClassEnum} {
- }
- } else {
- Class FTGClassEnumD : {FTGClassEnum OPClassEnum} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassEnum) FTGClassEnumD
-
- selfPromoter OPClassEnum {this} {
- FTGClassEnumD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgclassge.tcl /main/titanic/11
-
-
- Class FTGClassGenericTypeDef : {FTGGenClass} {
- constructor
- method destructor
- method promoter
- method generate
- method isDerivable
- method isLegal
- method getKind
- method getSpecKind
- 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::promoter {this} {
- $this _isLegal -1
- $this FTGGenClass::promoter
- }
-
- method FTGClassGenericTypeDef::generate {this model {checkOnly 0}} {
- set classType [$this getClassType]
- if {$classType != "Class"} {
- # this is not a class generic typedef
- $this FTGGenClass::generate $model $checkOnly
- return
- }
-
- set name [$this getName]
- set msgId $M_GEN_FOR
- if {$checkOnly} {
- set msgId $M_CHK_FOR
- }
- m4_message $msgId "Class Generic Typedef" $name
- set class [$model findDefinition $name]
- if {$class == ""} {
- set assocAttr [lindex [$this genAssocAttrSet] 0]
- if {![$this isLegal $assocAttr]} {
- m4_error $E_GTD_NO_GEN [$this getName]
- 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 == ""} {
- return 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 ""} {recCall 0}} {
- if {[$this _isLegal] > -1} {
- return [$this _isLegal]
- }
- if {[$this _isLegal] == -2} {
- # loop
- m4_error $E_GTD_RECURSIVE [$this getName]
- $this _isLegal -1
- return 0
- }
- $this _isLegal -2
-
- if {$assocAttr == ""} {
- set assocAttr [lindex [$this genAssocAttrSet] 0]
- }
- if {$assocAttr == ""} {
- m4_error $E_GTD_NO_TYPE [$this getName]
- $this _isLegal 0
- return 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 "" 1]
- if {![$this _isLegal] && !$recCall} {
- 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"
- }
-
- method FTGClassGenericTypeDef::getSpecKind {this} {
- if {[$this specKind] != "INIT"} {
- return [$this specKind]
- }
- if {[$this getClassType] != "Class"} {
- # this is not a class generic typedef
- return [$this FTGGenClass::getSpecKind]
- }
- $this specKind ""
- if {[$this isDerivable]} {
- $this specKind "Derivable"
- }
- return [$this specKind]
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClassGenericTypeDef] {
- Class FTGClassGenericTypeDefD : {FTGClassGenericTypeDef CMClassGenericTypeDef} {
- }
- } else {
- Class FTGClassGenericTypeDefD : {FTGClassGenericTypeDef OPClassGenericTypeDef} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassGenericTypeDef) FTGClassGenericTypeDefD
-
- selfPromoter OPClassGenericTypeDef {this} {
- FTGClassGenericTypeDefD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgclasstd.tcl /main/titanic/12
-
-
- Class FTGClassTDef : {FTGGenClass} {
- constructor
- method destructor
- method promoter
- method generate
- method isDerivable
- method getType
- method getFinalType
- method getFinalClass
- method getKind
- method getSpecKind
- 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::promoter {this} {
- $this finalType NULL
- $this FTGGenClass::promoter
- }
-
- method FTGClassTDef::generate {this model {checkOnly 0}} {
- set classType [$this getClassType]
- if {$classType != "Class"} {
- # this is not a class typedef
- $this FTGGenClass::generate $model $checkOnly
- return
- }
-
- set name [$this getName]
- set msgId $M_GEN_FOR
- if {$checkOnly} {
- set msgId $M_CHK_FOR
- }
- m4_message $msgId "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"
- }
-
- method FTGClassTDef::getSpecKind {this} {
- if {[$this specKind] != "INIT"} {
- return [$this specKind]
- }
- if {[$this getClassType] != "Class"} {
- # this is not a class typedef
- return [$this FTGGenClass::getSpecKind]
- }
- $this specKind ""
- if {[$this isDerivable]} {
- $this specKind "Derivable"
- }
- return [$this specKind]
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClassTDef] {
- Class FTGClassTDefD : {FTGClassTDef CMClassTDef} {
- }
- } else {
- Class FTGClassTDefD : {FTGClassTDef OPClassTDef} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassTDef) FTGClassTDefD
-
- selfPromoter OPClassTDef {this} {
- FTGClassTDefD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftglinkcla.tcl /main/titanic/5
-
-
- Class FTGLinkClass : {FTGGenClass} {
- constructor
- method destructor
- method generate
- }
-
- 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
- }
-
- method FTGLinkClass::generate {this model {checkOnly 0}} {
- set classType [$this getClassType]
- if {$classType != "Class"} {
- m4_error $E_ILL_LINKCLASS [$this getName] $classType
- return
- }
- $this FTGGenClass::generate $model $checkOnly
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMLinkClass] {
- Class FTGLinkClassD : {FTGLinkClass CMLinkClass} {
- }
- } else {
- Class FTGLinkClassD : {FTGLinkClass OPLinkClass} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPLinkClass) FTGLinkClassD
-
- selfPromoter OPLinkClass {this} {
- FTGLinkClassD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgassocin.tcl /main/titanic/6
-
-
- 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
-
- if [isCommand CMAssocInitializer] {
- Class FTGAssocInitializerD : {FTGAssocInitializer CMAssocInitializer} {
- }
- } else {
- Class FTGAssocInitializerD : {FTGAssocInitializer OPAssocInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAssocInitializer) FTGAssocInitializerD
-
- selfPromoter OPAssocInitializer {this} {
- FTGAssocInitializerD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgattribi.tcl /main/titanic/4
-
-
- 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
-
- if [isCommand CMAttribInitializer] {
- Class FTGAttribInitializerD : {FTGAttribInitializer CMAttribInitializer} {
- }
- } else {
- Class FTGAttribInitializerD : {FTGAttribInitializer OPAttribInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAttribInitializer) FTGAttribInitializerD
-
- selfPromoter OPAttribInitializer {this} {
- FTGAttribInitializerD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftginhkeyi.tcl /main/titanic/4
-
-
- 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
-
- if [isCommand CMInhKeyInitializer] {
- Class FTGInhKeyInitializerD : {FTGInhKeyInitializer CMInhKeyInitializer} {
- }
- } else {
- Class FTGInhKeyInitializerD : {FTGInhKeyInitializer OPInhKeyInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPInhKeyInitializer) FTGInhKeyInitializerD
-
- selfPromoter OPInhKeyInitializer {this} {
- FTGInhKeyInitializerD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgqualini.tcl /main/titanic/6
-
-
- 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
-
- if [isCommand CMQualInitializer] {
- Class FTGQualInitializerD : {FTGQualInitializer CMQualInitializer} {
- }
- } else {
- Class FTGQualInitializerD : {FTGQualInitializer OPQualInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPQualInitializer) FTGQualInitializerD
-
- selfPromoter OPQualInitializer {this} {
- FTGQualInitializerD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgsupercl.tcl /main/titanic/4
-
-
- 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
-
- if [isCommand CMSuperClassInitializer] {
- Class FTGSuperClassInitializerD : {FTGSuperClassInitializer CMSuperClassInitializer} {
- }
- } else {
- Class FTGSuperClassInitializerD : {FTGSuperClassInitializer OPSuperClassInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPSuperClassInitializer) FTGSuperClassInitializerD
-
- selfPromoter OPSuperClassInitializer {this} {
- FTGSuperClassInitializerD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgbasetyp.tcl /main/titanic/6
-
-
- 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]
- 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
-
- if [isCommand CMBaseType] {
- Class FTGBaseTypeD : {FTGBaseType CMBaseType} {
- }
- } else {
- Class FTGBaseTypeD : {FTGBaseType OPBaseType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPBaseType) FTGBaseTypeD
-
- selfPromoter OPBaseType {this} {
- FTGBaseTypeD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgclassty.tcl /main/titanic/6
-
-
- 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
-
- if [isCommand CMClassType] {
- Class FTGClassTypeD : {FTGClassType CMClassType} {
- }
- } else {
- Class FTGClassTypeD : {FTGClassType OPClassType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassType) FTGClassTypeD
-
- selfPromoter OPClassType {this} {
- FTGClassTypeD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgenumtyp.tcl /main/titanic/4
-
-
- 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
-
- if [isCommand CMEnumType] {
- Class FTGEnumTypeD : {FTGEnumType CMEnumType} {
- }
- } else {
- Class FTGEnumTypeD : {FTGEnumType OPEnumType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPEnumType) FTGEnumTypeD
-
- selfPromoter OPEnumType {this} {
- FTGEnumTypeD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgtypedef.tcl /main/titanic/6
-
-
- 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
-
- if [isCommand CMTypeDefType] {
- Class FTGTypeDefTypeD : {FTGTypeDefType CMTypeDefType} {
- }
- } else {
- Class FTGTypeDefTypeD : {FTGTypeDefType OPTypeDefType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPTypeDefType) FTGTypeDefTypeD
-
- selfPromoter OPTypeDefType {this} {
- FTGTypeDefTypeD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgdataatt.tcl /main/titanic/8
-
-
- Class FTGDataAttr : {FTGAttribute} {
- constructor
- method destructor
- method generate
- method genCmnAttrib
- method genVirtAttrib
- method genConstAttrib
- method getKind
- }
-
- 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]]
- $this gen[$this getKind]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 [string trim [$this getInitialValue]]
- if {$value != "" && [$tgtClass constructor] != ""} {
- $sect append "$name = $value;\n"
- }
- $attrib value $value
-
- 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 [string trim [$this getPropertyValue get_expr]]
- if {$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 [string trim [$this getPropertyValue set_expr]]
- if {$setExpr != ""} {
- $attr setExpr $setExpr
- }
- }
-
- method FTGDataAttr::genConstAttrib {this tgtClass tgtType} {
- set name [$this getName]
- set value [string trim [$this getInitialValue]]
- if {$value == ""} {
- m4_error $E_ATTR_HAS_NO "Constant " $name [$tgtClass name] " value"
- return
- }
- FTConstAttrib new $name "" [$this getAccess] $tgtClass $value
- }
-
- method FTGDataAttr::getKind {this} {
- # IMPR: cache
- if {[$this getPropertyValue const] == "1"} {
- set kind Const
- } elseif {[$this isDerived]} {
- set kind Virt
- } else {
- set kind Cmn
- }
- return $kind
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDataAttr] {
- Class FTGDataAttrD : {FTGDataAttr CMDataAttr} {
- }
- } else {
- Class FTGDataAttrD : {FTGDataAttr OPDataAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDataAttr) FTGDataAttrD
-
- selfPromoter OPDataAttr {this} {
- FTGDataAttrD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftggenasso.tcl /main/titanic/10
-
-
- 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 [FTAssocAccMethod new "append[cap $ident]" "" $access $tgtClass [$this tgtAttrib]]
- } else {
- set accessor [FTAssocAccMethod 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 [FTAssocAccMethod 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 [FTAssocAccMethod 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 [FTAssocAccMethod 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 [FTAssocAccMethod 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 [FTClassType new "HashTable" "Framework" "Class" ""]
- } 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 [FTAssocAttrib 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" && [$destClass getClassType] != "Interface"} {
- 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
-
- if [isCommand CMGenAssocAttr] {
- Class FTGGenAssocAttrD : {FTGGenAssocAttr CMGenAssocAttr} {
- }
- } else {
- Class FTGGenAssocAttrD : {FTGGenAssocAttr OPGenAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPGenAssocAttr) FTGGenAssocAttrD
-
- selfPromoter OPGenAssocAttr {this} {
- FTGGenAssocAttrD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgassocat.tcl /main/titanic/6
-
-
- 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
-
- if [isCommand CMAssocAttr] {
- Class FTGAssocAttrD : {FTGAssocAttr CMAssocAttr} {
- }
- } else {
- Class FTGAssocAttrD : {FTGAssocAttr OPAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAssocAttr) FTGAssocAttrD
-
- selfPromoter OPAssocAttr {this} {
- FTGAssocAttrD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftglinkatt.tcl /main/titanic/6
-
-
- 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
-
- if [isCommand CMLinkAttr] {
- Class FTGLinkAttrD : {FTGLinkAttr CMLinkAttr} {
- }
- } else {
- Class FTGLinkAttrD : {FTGLinkAttr OPLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPLinkAttr) FTGLinkAttrD
-
- selfPromoter OPLinkAttr {this} {
- FTGLinkAttrD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgqualatt.tcl /main/titanic/8
-
-
- 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 [FTAssocAccMethod 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 [FTAssocAccMethod 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 [FTAssocAccMethod 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
-
- if [isCommand CMQualAttr] {
- Class FTGQualAttrD : {FTGQualAttr CMQualAttr} {
- }
- } else {
- Class FTGQualAttrD : {FTGQualAttr OPQualAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPQualAttr) FTGQualAttrD
-
- selfPromoter OPQualAttr {this} {
- FTGQualAttrD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgreverse.tcl /main/titanic/6
-
-
- 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
-
- if [isCommand CMReverseLinkAttr] {
- Class FTGReverseLinkAttrD : {FTGReverseLinkAttr CMReverseLinkAttr} {
- }
- } else {
- Class FTGReverseLinkAttrD : {FTGReverseLinkAttr OPReverseLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPReverseLinkAttr) FTGReverseLinkAttrD
-
- selfPromoter OPReverseLinkAttr {this} {
- FTGReverseLinkAttrD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgqualass.tcl /main/titanic/5
-
-
- 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
-
- if [isCommand CMQualAssocAttr] {
- Class FTGQualAssocAttrD : {FTGQualAssocAttr CMQualAssocAttr} {
- }
- } else {
- Class FTGQualAssocAttrD : {FTGQualAssocAttr OPQualAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPQualAssocAttr) FTGQualAssocAttrD
-
- selfPromoter OPQualAssocAttr {this} {
- FTGQualAssocAttrD promote $this
- }
-
-
- #---------------------------------------------------------------------------
- # File: @(#)ftgquallin.tcl /main/titanic/5
-
-
- 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
-
- if [isCommand CMQualLinkAttr] {
- Class FTGQualLinkAttrD : {FTGQualLinkAttr CMQualLinkAttr} {
- }
- } else {
- Class FTGQualLinkAttrD : {FTGQualLinkAttr OPQualLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPQualLinkAttr) FTGQualLinkAttrD
-
- selfPromoter OPQualLinkAttr {this} {
- FTGQualLinkAttrD promote $this
- }
-