home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
corbamdl.tcl
< prev
next >
Wrap
Text File
|
1997-12-01
|
48KB
|
1,892 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 : corbamdl.tcl
# Author :
# Original date : November 1997
# Description : Classes for code generation
#
#---------------------------------------------------------------------------
# File: @(#)idgbasetyp.tcl /main/titanic/3
Class IDGBaseType : {Object} {
constructor
method destructor
method generate
}
constructor IDGBaseType {class this} {
# Start constructor user section
# End constructor user section
return $this
}
method IDGBaseType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGBaseType::generate {this {name ""}} {
set type [$this getType3GL]
if {[regexp {\[} $type]} {
set type [[IDGDataMgr::getMgr] getArrayTD $type]
}
if {$name == ""} {
return $type
}
return "$type $name"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMBaseType] {
Class IDGBaseTypeD : {IDGBaseType CMBaseType} {
}
} else {
Class IDGBaseTypeD : {IDGBaseType OPBaseType} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPBaseType) IDGBaseTypeD
selfPromoter OPBaseType {this} {
IDGBaseTypeD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgclassty.tcl /main/titanic/3
Class IDGClassType : {Object} {
constructor
method destructor
method generate
}
constructor IDGClassType {class this} {
# Start constructor user section
# End constructor user section
return $this
}
method IDGClassType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGClassType::generate {this {name ""}} {
set type [$this getName]
if {$type == ""} {
set type "void"
} else {
set class [$this ooplClass]
if {$class == ""} {
m4_error $E_NOT_DEFINED $type
} else {
set system [$class definingSystem]
if {$system == ""} {
m4_error $E_NOT_DEFINED $type
}
set idlMgr [IDGDataMgr::getMgr]
if {$system == [getCurrentSystemName]} {
if {[$class isInterface]} {
$idlMgr addForward $type
} else {
$class generate
}
} else {
if {$system != ""} {
$idlMgr addInclude $system
}
set type "${system}::$type"
}
}
}
return [string trim "$type $name"]
}
# Do not delete this line -- regeneration end marker
if [isCommand CMClassType] {
Class IDGClassTypeD : {IDGClassType CMClassType} {
}
} else {
Class IDGClassTypeD : {IDGClassType OPClassType} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPClassType) IDGClassTypeD
selfPromoter OPClassType {this} {
IDGClassTypeD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgcmnclas.tcl /main/titanic/6
Class IDGCmnClass : {Object} {
constructor
method destructor
method promoter
method generate
method genInterface
method genException
method genStructure
method genUnion
method genSequence
method genFields
method genDescription
method isInterface
method isIDLSpecial
method isDerivable
method definingSystem
attribute isGenerated
attribute _isIDLSpecial
}
constructor IDGCmnClass {class this name} {
set this [Object::constructor $class $this $name]
$this isGenerated 0
$this _isIDLSpecial -1
# Start constructor user section
# End constructor user section
return $this
}
method IDGCmnClass::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGCmnClass::promoter {this} {
$this isGenerated 0
$this _isIDLSpecial -1
}
method IDGCmnClass::generate {this} {
if {[$this isGenerated]} {
return
}
$this isGenerated 1
set classType [$this getPropertyValue class_type]
if {$classType == ""} {
set classType Interface
}
set msg "Generating for"
if {[[IDGDataMgr::getMgr] checkOnly]} {
set msg Checking
}
puts stdout "$msg $classType '[$this getName]'"
if {$msg == "Checking"} {
set allMethods [$this findMethods 1]
foreach oper1 $allMethods {
foreach oper2 $allMethods {
if {$oper1 >= $oper2} {
continue
}
if {[$oper1 getName] == [$oper2 getName]} {
m4_error $E_MBR_OVERLOADED Method [$oper1 getName]
}
}
}
}
if {[info procs IDGCmnClass::gen$classType] != ""} {
$this gen$classType
}
}
method IDGCmnClass::genInterface {this} {
set name [$this getName]
set sect [[IDGDataMgr::getMgr] getSect interface]
# in corba, all supers must be generated first
#
set superList ""
foreach super [$this genNodeSet] {
set superString [$super generate]
if {$superString != ""} {
lappend superList $superString
}
}
# now, we can safely generate this class
#
$this genDescription $sect
$sect append "interface $name"
if {$superList != {}} {
$sect append " : [join $superList {, }]"
}
$sect append "\n\{\n"
$sect indent +
# feature list
foreach feat [$this featureSet] {
$feat generate
}
$sect indent -
$sect append "\};\n\n"
}
method IDGCmnClass::genException {this} {
set name [$this getName]
if {[$this genNodeSet] != {} || [$this specNodeSet] != {}} {
m4_error $E_NO_INHERITANCE Exception $name
}
if {![$this genFields Exception]} {
return
}
set sect [[IDGDataMgr::getMgr] getSect nonInterface]
$this genDescription $sect
$sect append "exception $name \{\n"
$sect indent +
# generate feature list
foreach feat [$this featureSet] {
if {[$feat get_obj_type] == "data_attrib"} {
$feat genMember $sect
}
}
$sect indent -
$sect append "\};\n\n"
}
method IDGCmnClass::genStructure {this} {
set name [$this getName]
if {[$this genNodeSet] != {} || [$this specNodeSet] != {}} {
m4_error $E_NO_INHERITANCE Structure $name
}
if {![$this genFields Structure]} {
return
}
set sect [[IDGDataMgr::getMgr] getSect nonInterface]
$this genDescription $sect
$sect append "struct $name \{\n"
$sect indent +
# generate feature list
foreach feat [$this featureSet] {
if {[$feat get_obj_type] == "data_attrib"} {
$feat genMember $sect
}
}
$sect indent -
$sect append "\};\n\n"
}
method IDGCmnClass::genUnion {this} {
set name [$this getName]
if {[$this genNodeSet] != {} || [$this specNodeSet] != {}} {
m4_error $E_NO_INHERITANCE Union $name
}
if {![$this genFields Union]} {
return
}
set sect [[IDGDataMgr::getMgr] getSect nonInterface]
$this genDescription $sect
set discriminator [string trim [$this getPropertyValue discriminator]]
if {$discriminator == ""} {
set discriminator long
}
$sect append "union $name\nswitch ($discriminator) \{\n"
$sect indent +
set case 0
foreach feat [$this featureSet] {
if {[$feat get_obj_type] == "data_attrib"} {
set caseLabel [string trim [$feat getPropertyValue case_label]]
if {$caseLabel == ""} {
set caseLabel $case
}
if {$caseLabel != "default"} {
set caseLabel "case $caseLabel"
}
$sect append "$caseLabel: "
$feat genMember $sect
incr case
}
}
$sect indent -
$sect append "\};\n\n"
}
method IDGCmnClass::genSequence {this} {
set name [$this getName]
if {[$this get_obj_type] != "class_typedef"} {
m4_error $E_NEED_ONE_ATTRIB $name
return
}
set sect [[IDGDataMgr::getMgr] getSect nonInterface]
$this genDescription $sect
set feat [$this featureSet]
set type [[$feat ooplType] generate]
$sect append "typedef sequence< $type > $name;\n\n"
## can one derive from a sequence in IDL???
if {[$this specNodeSet] != {}} {
m4_error $E_NO_SUBCLASSES Sequence $name ""
}
}
method IDGCmnClass::genFields {this forWhat} {
# define/declare/include types used in feature list
set noError 1
foreach feat [$this featureSet] {
# Check features for validity here
set objType [$feat get_obj_type]
if {$objType == "data_attrib"} {
[$feat ooplType] generate
} elseif {$objType != "constructor"} {
m4_error $E_ONLY_DATA_ATTRS $forWhat [$this getName]
set noError 0
}
}
return $noError
}
method IDGCmnClass::genDescription {this sect} {
set ftext [$this getFreeText]
if {$ftext != ""} {
$sect append "\n"
string_to_oopl_comment $sect $ftext "//"
}
}
method IDGCmnClass::isInterface {this} {
return 0
}
method IDGCmnClass::isIDLSpecial {this} {
# this should be done in promoter, but at this time OPClass (C++) is not
# fully constructed
#
if {[$this _isIDLSpecial] == -1} {
set classType [$this getPropertyValue class_type]
if {$classType != "" && $classType != "Interface"} {
$this _isIDLSpecial 1
} else {
$this _isIDLSpecial 0
}
}
return [$this _isIDLSpecial]
}
method IDGCmnClass::isDerivable {this} {
if {[$this isIDLSpecial]} {
return 0
}
return 1
}
method IDGCmnClass::definingSystem {this} {
set systemV [[$this smNode] getDefiningSystemVersion]
if {![$systemV isNil]} {
return [[$systemV system] name]
}
return ""
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)idgenumtyp.tcl /main/titanic/2
Class IDGEnumType : {Object} {
constructor
method destructor
method generate
}
constructor IDGEnumType {class this} {
# Start constructor user section
# End constructor user section
return $this
}
method IDGEnumType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGEnumType::generate {this {name ""}} {
# in 1st definition section (enum)
#
set type [$this getName]
if {$type == ""} {
set type "void"
} else {
set class [$this ooplClass]
set system [$class definingSystem]
if {$system == ""} {
m4_error $E_NOT_DEFINED $type
}
if {$system != [getCurrentSystemName]} {
set type "${system}::$type"
if {$system != ""} {
[IDGDataMgr::getMgr] addInclude $system
}
}
}
return [string trim "$type $name"]
}
# Do not delete this line -- regeneration end marker
if [isCommand CMEnumType] {
Class IDGEnumTypeD : {IDGEnumType CMEnumType} {
}
} else {
Class IDGEnumTypeD : {IDGEnumType OPEnumType} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPEnumType) IDGEnumTypeD
selfPromoter OPEnumType {this} {
IDGEnumTypeD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idginhgrou.tcl /main/titanic/2
Class IDGInhGroup : {Object} {
constructor
method destructor
method generate
}
constructor IDGInhGroup {class this} {
# Start constructor user section
# End constructor user section
return $this
}
method IDGInhGroup::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGInhGroup::generate {this} {
set access [$this inherAccess]
if {$access != "Public" && $access != ""} {
return ""
}
set class [$this superClass]
set name [$class getName]
set idlMgr [IDGDataMgr::getMgr]
if {[$class isExternal]} {
set system [$class definingSystem]
if {$system == ""} {
m4_error $E_NOT_DEFINED $name
} else {
$idlMgr addInclude $system
}
set name "$system::$name"
} else {
# local
if {$name != ""} {
$class generate
}
}
return $name
}
# Do not delete this line -- regeneration end marker
if [isCommand CMInhGroup] {
Class IDGInhGroupD : {IDGInhGroup CMInhGroup} {
}
} else {
Class IDGInhGroupD : {IDGInhGroup OPInhGroup} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPInhGroup) IDGInhGroupD
selfPromoter OPInhGroup {this} {
IDGInhGroupD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgobject.tcl /main/titanic/2
Class IDGObject : {Object} {
constructor
method destructor
method genDescription
}
constructor IDGObject {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGObject::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGObject::genDescription {this sect} {
set ftext [$this getFreeText]
if {$ftext != ""} {
string_to_oopl_comment $sect $ftext "//"
}
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)idgtypedef.tcl /main/titanic/2
Class IDGTypeDefType : {Object} {
constructor
method destructor
method generate
}
constructor IDGTypeDefType {class this} {
# Start constructor user section
# End constructor user section
return $this
}
method IDGTypeDefType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGTypeDefType::generate {this {name ""}} {
set type [$this getName]
if {$type == ""} {
set type "void"
} else {
set class [$this ooplClass]
set system [$class definingSystem]
if {$system == ""} {
m4_error $E_NOT_DEFINED $type
}
set idlMgr [IDGDataMgr::getMgr]
if {$system == [getCurrentSystemName]} {
if {[$class isInterface]} {
$idlMgr addForward $type
} else {
$class generate
}
} else {
set type "${system}::$type"
if {$system != ""} {
$idlMgr addInclude $system
}
}
}
return [string trim "$type $name"]
}
# Do not delete this line -- regeneration end marker
if [isCommand CMTypeDefType] {
Class IDGTypeDefTypeD : {IDGTypeDefType CMTypeDefType} {
}
} else {
Class IDGTypeDefTypeD : {IDGTypeDefType OPTypeDefType} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPTypeDefType) IDGTypeDefTypeD
selfPromoter OPTypeDefType {this} {
IDGTypeDefTypeD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgdatamgr.tcl /main/titanic/3
Class IDGDataMgr : {GCObject} {
constructor
method destructor
method write
method addInclude
method addForward
method removeSect
method getArrayTD
method delMgr
method addArrayTD
method removeArrayTD
method getSect
attribute checkOnly
attribute sectNameSet
attribute includeSet
attribute forwardSet
attribute arrayTDSet
attribute sect
}
global IDGDataMgr::mgr
set IDGDataMgr::mgr NULL
constructor IDGDataMgr {class this} {
set this [GCObject::constructor $class $this]
$this checkOnly 0
$this sectNameSet [List new]
$this includeSet [List new]
$this forwardSet [List new]
$this arrayTDSet [List new]
$this sect [Dictionary new]
# Start constructor user section
[$this sectNameSet] contents {
fileHeader
includes
header
forwardDecl
enum
nonInterface
interface
moduleTrailer
trailer
fileTrailer
}
[$this sectNameSet] foreach sect {
set newSect [TextSection new]
[$this sect] set $sect $newSect
$newSect indent 1 "\t"
}
foreach sect {includes header trailer fileHeader fileTrailer} {
[[$this sect] set $sect] indent 0 "\t"
}
# End constructor user section
return $this
}
method IDGDataMgr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGDataMgr::write {this fileName} {
[$this sectNameSet] foreach sect {
[[$this sect] set $sect] write $fileName
}
}
method IDGDataMgr::addInclude {this name {pathCompletion 1}} {
if {$name == ""} {
return
}
if {$pathCompletion} {
set name "\"[location .. $name ${name}.idl]\""
}
if {[[$this includeSet] search -exact $name] == -1} {
[$this includeSet] append $name
}
}
method IDGDataMgr::addForward {this name} {
if {$name == ""} {
return
}
if {[[$this forwardSet] search -exact $name] == -1} {
[$this forwardSet] append $name
}
}
method IDGDataMgr::removeSect {this name} {
[$this sect] unset $name
[$this sectNameSet] removeValue $name
}
method IDGDataMgr::getArrayTD {this type} {
regexp {\[([0-9]*)\]} $type dummy index
regsub {\[.*} $type "" type
set name arr_$type$index
set i [[$this arrayTDSet] search -exact $name]
if {$i == -1} {
[$this arrayTDSet] append $name
[$this getSect nonInterface] append "typedef $type $name\[$index];\n\n"
}
return $name
}
proc IDGDataMgr::getMgr {} {
global IDGDataMgr::mgr
if {${IDGDataMgr::mgr} == "NULL"} {
set IDGDataMgr::mgr [IDGDataMgr new]
}
return ${IDGDataMgr::mgr}
}
method IDGDataMgr::delMgr {this} {
global IDGDataMgr::mgr
set IDGDataMgr::mgr NULL
}
# Do not delete this line -- regeneration end marker
method IDGDataMgr::addArrayTD {this newArrayTD} {
[$this arrayTDSet] append $newArrayTD
}
method IDGDataMgr::removeArrayTD {this oldArrayTD} {
[$this arrayTDSet] removeValue $oldArrayTD
}
method IDGDataMgr::getSect {this name} {
return [[$this sect] set $name]
}
#---------------------------------------------------------------------------
# File: @(#)idgclass.tcl /main/titanic/2
Class IDGClass : {IDGCmnClass} {
constructor
method destructor
method isInterface
}
constructor IDGClass {class this name} {
set this [IDGCmnClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGClass::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGClass::isInterface {this} {
return [expr ![$this isIDLSpecial]]
}
# Do not delete this line -- regeneration end marker
if [isCommand CMClass] {
Class IDGClassD : {IDGClass CMClass} {
}
} else {
Class IDGClassD : {IDGClass OPClass} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPClass) IDGClassD
selfPromoter OPClass {this} {
IDGClassD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgclassen.tcl /main/titanic/2
Class IDGClassEnum : {IDGCmnClass} {
constructor
method destructor
method genInterface
method isDerivable
}
constructor IDGClassEnum {class this name} {
set this [IDGCmnClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGClassEnum::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGClassEnum::genInterface {this} {
set name [$this getName]
set sect [[IDGDataMgr::getMgr] getSect enum]
$this genDescription $sect
$sect append "enum $name \{\n"
$sect indent +
set featList {}
foreach feat [$this featureSet] {
lappend featList [$feat getName]
}
$sect append [join $featList ",\n"]
$sect append "\n"
$sect indent -
$sect append "\};\n\n"
## can one derive from an enum in IDL???
if {[$this specNodeSet] != {} && ![$this isDerivable]} {
m4_error $E_NO_SUBCLASSES "Enumeration Class" $name ""
}
}
method IDGClassEnum::isDerivable {this} {
return 0
}
# Do not delete this line -- regeneration end marker
if [isCommand CMClassEnum] {
Class IDGClassEnumD : {IDGClassEnum CMClassEnum} {
}
} else {
Class IDGClassEnumD : {IDGClassEnum OPClassEnum} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPClassEnum) IDGClassEnumD
selfPromoter OPClassEnum {this} {
IDGClassEnumD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgclassge.tcl /main/titanic/4
Class IDGClassGenericTypeDef : {IDGCmnClass} {
constructor
method destructor
method isInterface
}
constructor IDGClassGenericTypeDef {class this name} {
set this [IDGCmnClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGClassGenericTypeDef::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGClassGenericTypeDef::isInterface {this} {
return [expr ![$this isIDLSpecial]]
}
# Do not delete this line -- regeneration end marker
if [isCommand CMClassGenericTypeDef] {
Class IDGClassGenericTypeDefD : {IDGClassGenericTypeDef CMClassGenericTypeDef} {
}
} else {
Class IDGClassGenericTypeDefD : {IDGClassGenericTypeDef OPClassGenericTypeDef} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPClassGenericTypeDef) IDGClassGenericTypeDefD
selfPromoter OPClassGenericTypeDef {this} {
IDGClassGenericTypeDefD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgclasstd.tcl /main/titanic/2
Class IDGClassTDef : {IDGCmnClass} {
constructor
method destructor
method genInterface
method isDerivable
}
constructor IDGClassTDef {class this name} {
set this [IDGCmnClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGClassTDef::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGClassTDef::genInterface {this} {
set name [$this getName]
set sect [[IDGDataMgr::getMgr] getSect nonInterface]
set feat [$this featureSet]
set initialValue [$feat getInitialValue]
if {$initialValue == ""} {
# typedef
$this genDescription $sect
$sect append "typedef [[$feat ooplType] generate $name];\n\n"
if {[$this specNodeSet] != {}} {
if {![$this isDerivable]} {
m4_error $E_NO_SUBCLASSES "Typedef Class" $name "since it is a standard type"
}
}
} else {
# constant
$this genDescription $sect
$sect append "const [[$feat ooplType] generate [$feat getName]] = $initialValue;\n\n"
if {[$this specNodeSet] != {}} {
m4_error $E_NO_SUBCLASSES "Constant definition" [$this getName] ""
}
}
}
method IDGClassTDef::isDerivable {this} {
set attrib [lindex [$this featureSet] 0]
if {[[$attrib ooplType] getType3GL] == ""} {
return 1
}
return 0
}
# Do not delete this line -- regeneration end marker
if [isCommand CMClassTDef] {
Class IDGClassTDefD : {IDGClassTDef CMClassTDef} {
}
} else {
Class IDGClassTDefD : {IDGClassTDef OPClassTDef} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPClassTDef) IDGClassTDefD
selfPromoter OPClassTDef {this} {
IDGClassTDefD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idglinkcla.tcl /main/titanic/4
Class IDGLinkClass : {IDGCmnClass} {
constructor
method destructor
method generate
method genInterface
method isInterface
}
constructor IDGLinkClass {class this name} {
set this [IDGCmnClass::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGLinkClass::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGLinkClass::generate {this} {
if {![$this isInterface]} {
m4_error $E_ILL_LINKCLASS [$this getName] [$this getPropertyValue class_type]
return
}
$this IDGCmnClass::generate
}
method IDGLinkClass::genInterface {this} {
if {[$this getName] == ""} {
m4_error $E_NO_NAME "Link Class"
return
}
$this IDGCmnClass::genInterface
}
method IDGLinkClass::isInterface {this} {
return [expr ![$this isIDLSpecial]]
}
# Do not delete this line -- regeneration end marker
if [isCommand CMLinkClass] {
Class IDGLinkClassD : {IDGLinkClass CMLinkClass} {
}
} else {
Class IDGLinkClassD : {IDGLinkClass OPLinkClass} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPLinkClass) IDGLinkClassD
selfPromoter OPLinkClass {this} {
IDGLinkClassD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgcmnattr.tcl /main/titanic/1
Class IDGCmnAttr : {IDGObject} {
constructor
method destructor
method splitAccessMode
method genAccess
method isLegalDest
method isAccessible
method genAccessers
}
constructor IDGCmnAttr {class this name} {
set this [IDGObject::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGCmnAttr::destructor {this} {
# Start destructor user section
# End destructor user section
$this IDGObject::destructor
}
method IDGCmnAttr::splitAccessMode {this access mode} {
if {$access == ""} {
return Public
}
set rwAccessList [split $access -]
if {[llength $rwAccessList] == 2} {
if {$mode == "r"} {
return [lindex $rwAccessList 0]
}
return [lindex $rwAccessList 1]
}
return $access
}
method IDGCmnAttr::genAccess {this access} {
if {$access == ""} {
return Public
} else {
return $access
}
}
method IDGCmnAttr::isLegalDest {this type opposite} {
# !! Implement this function !!
}
method IDGCmnAttr::isAccessible {this readAccess writeAccess} {
# !! Implement this function !!
}
method IDGCmnAttr::genAccessers {this funcName funcType sect keyName keyType} {
# !! Implement this function !!
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)idgconstru.tcl /main/titanic/2
Class IDGConstructor : {IDGObject} {
constructor
method destructor
method generate
}
constructor IDGConstructor {class this name} {
set this [IDGObject::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGConstructor::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGConstructor::generate {this} {
# no constructors in idl
#
return
}
# Do not delete this line -- regeneration end marker
if [isCommand CMConstructor] {
Class IDGConstructorD : {IDGConstructor CMConstructor} {
}
} else {
Class IDGConstructorD : {IDGConstructor OPConstructor} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPConstructor) IDGConstructorD
selfPromoter OPConstructor {this} {
IDGConstructorD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgoperati.tcl /main/titanic/3
Class IDGOperation : {IDGObject} {
constructor
method destructor
method generate
}
constructor IDGOperation {class this name} {
set this [IDGObject::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGOperation::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGOperation::generate {this} {
set name [$this getName]
if {$name == "create"} {
# this is another constructor
return
}
set type [$this ooplType]
if {$type != "" && [$type getName] != ""} {
set typeString [string trim [$type generate]]
} else {
set typeString "void"
}
set access [$this getPropertyValue method_access]
# only public operations are exported
if {$access != "Public" && $access != ""} {
return
}
set paramList {}
foreach param [$this parameterSet] {
lappend paramList [$param generate]
}
set exceptions [string trim [$this getPropertyValue exceptions]]
set oneway ""
if {$typeString == "void" && $exceptions == "" && [$this getPropertyValue oneway] != "Off"} {
set oneway "oneway "
foreach param $paramList {
set dir [lindex $param 0]
if {$dir != "in" && $dir != ""} {
set oneway ""
break
}
}
}
set sect [[IDGDataMgr::getMgr] getSect interface]
$this genDescription $sect
$sect append "${oneway}$typeString ${name}("
$sect append [join $paramList ", "]
$sect append ")"
if {$exceptions != ""} {
$sect append " raises($exceptions)"
}
set context [$this getPropertyValue context]
if {$context != ""} {
$sect append " context($context)"
}
$sect append ";\n\n"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMOperation] {
Class IDGOperationD : {IDGOperation CMOperation} {
}
} else {
Class IDGOperationD : {IDGOperation OPOperation} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPOperation) IDGOperationD
selfPromoter OPOperation {this} {
IDGOperationD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgoperpar.tcl /main/titanic/2
Class IDGOperParameter : {IDGObject} {
constructor
method destructor
method generate
}
constructor IDGOperParameter {class this name} {
set this [IDGObject::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGOperParameter::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGOperParameter::generate {this} {
set name [$this getName]
set type [$this ooplType]
set typeString [$type generate]
set direction [$this getPropertyValue direction]
if {$direction == ""} {
set direction "in"
}
return "$direction $typeString $name"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMOperParameter] {
Class IDGOperParameterD : {IDGOperParameter CMOperParameter} {
}
} else {
Class IDGOperParameterD : {IDGOperParameter OPOperParameter} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPOperParameter) IDGOperParameterD
selfPromoter OPOperParameter {this} {
IDGOperParameterD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgassocat.tcl /main/titanic/5
Class IDGAssocAttr : {IDGCmnAttr} {
constructor
method destructor
method generate
}
constructor IDGAssocAttr {class this name} {
set this [IDGCmnAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGAssocAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGAssocAttr::generate {this} {
set name [$this getName]
set type [$this ooplType]
set opposite [$this opposite]
if {[$type get_obj_type] != "base_type"} {
if {[$type ooplClass] == "" || [[$type ooplClass] isIDLSpecial]} {
m4_error $E_ILL_DESTINATION [[$this ooplClass] get_obj_type] [[$this ooplClass] getName] [$type getPropertyValue class_type] [[$opposite ooplClass] getName]
return
}
}
set access [$this getPropertyValue assoc_access]
set readAccess [$this genAccess [$this splitAccessMode $access r]]
set writeAccess [$this genAccess [$this splitAccessMode $access w]]
if {$readAccess != "Public" && $writeAccess != "Public" && $opposite == ""} {
return
}
[IDGDataMgr::getMgr] addForward [$type getName]
set sect [[IDGDataMgr::getMgr] getSect interface]
$this genDescription $sect
set oneway ""
if {[$this getPropertyValue oneway] != "Off"} {
set oneway "oneway "
}
set typeString [$type generate]
set funcName [cap $name]
if {[$this getMultiplicity] == "one"} {
if {$readAccess == "Public"} {
$sect append "$typeString get${funcName}();\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void set${funcName}(in $typeString new${funcName});\n"
if {![$this isMandatory]} {
$sect append "${oneway}void remove${funcName}();\n"
}
}
} else {
# generate attribute if readable or someone else needs to write it
regsub -all ":" $typeString "_" typeName
set typeName "$typeName${funcName}Set"
$sect append "typedef sequence<$typeString> $typeName;\n"
if {$readAccess == "Public"} {
$sect append "$typeName get${funcName}Set();\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void add${funcName}(in $typeString new${funcName});\n"
$sect append "${oneway}void remove${funcName}(in $typeString old${funcName});\n"
}
}
$sect append "\n"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMAssocAttr] {
Class IDGAssocAttrD : {IDGAssocAttr CMAssocAttr} {
}
} else {
Class IDGAssocAttrD : {IDGAssocAttr OPAssocAttr} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPAssocAttr) IDGAssocAttrD
selfPromoter OPAssocAttr {this} {
IDGAssocAttrD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgdataatt.tcl /main/titanic/2
Class IDGDataAttr : {IDGCmnAttr} {
constructor
method destructor
method generate
method genMember
}
constructor IDGDataAttr {class this name} {
set this [IDGCmnAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGDataAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGDataAttr::generate {this} {
set name [$this getName]
set type [$this ooplType]
set typeString [$type generate $name]
set readAccess [$this splitAccessMode [$this getPropertyValue attrib_access] r]
set writeAccess [$this splitAccessMode [$this getPropertyValue attrib_access] w]
set const [$this getPropertyValue const]
set initialValue [$this getInitialValue]
if {$const == 1 && $initialValue == ""} {
m4_error $E_NO_INIT_VALUE $name
return
}
# only public attributes are exported
if {$readAccess != "Public" && $readAccess != "" && $writeAccess != "Public" && $writeAccess != ""} {
return
}
set sect [[IDGDataMgr::getMgr] getSect interface]
$this genDescription $sect
if {$const != 1} {
if {$writeAccess != "Public" && $writeAccess != ""} {
set readonly "readonly "
} else {
set readonly ""
}
$sect append "${readonly}attribute $typeString;"
} else {
$sect append "const $typeString = $initialValue;"
}
$sect append "\n\n"
}
method IDGDataAttr::genMember {this {sect ""}} {
if {[$this get_obj_type] == "constructor"} {
return
}
if {$sect == ""} {
set sect [[IDGDataMgr::getMgr] getSect interface]
}
$this genDescription $sect
set name [$this getName]
set type [$this ooplType]
set typeString [$type generate $name]
$sect append "$typeString;\n"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMDataAttr] {
Class IDGDataAttrD : {IDGDataAttr CMDataAttr} {
}
} else {
Class IDGDataAttrD : {IDGDataAttr OPDataAttr} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPDataAttr) IDGDataAttrD
selfPromoter OPDataAttr {this} {
IDGDataAttrD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idglinkatt.tcl /main/titanic/5
Class IDGLinkAttr : {IDGCmnAttr} {
constructor
method destructor
method generate
}
constructor IDGLinkAttr {class this name} {
set this [IDGCmnAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGLinkAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGLinkAttr::generate {this} {
set name [$this getName]
set type [$this ooplType]
set opposite [$this opposite]
if {[$type get_obj_type] != "base_type"} {
if {[$type ooplClass] == "" || [[$type ooplClass] isIDLSpecial]} {
set oppName ""
if {$opposite != ""} {
set oppName [[$opposite ooplClass] getName]
}
m4_error $E_ILL_DESTINATION [[$this ooplClass] get_obj_type] [[$this ooplClass] getName] [$type getPropertyValue class_type] $oppName
return
}
}
set access [$this getPropertyValue assoc_access]
set readAccess [$this genAccess [$this splitAccessMode $access r]]
set writeAccess [$this genAccess [$this splitAccessMode $access w]]
if {$readAccess != "Public" && $writeAccess != "Public" && $opposite == ""} {
return
}
[IDGDataMgr::getMgr] addForward [$type getName]
set sect [[IDGDataMgr::getMgr] getSect interface]
$this genDescription $sect
set oneway ""
if {[$this getPropertyValue oneway] != "Off"} {
set oneway "oneway "
}
set assocTypeName [$type getName]
set assocFuncName [cap $assocTypeName]
set roleFuncName [cap $name]
set funcName "${assocFuncName}Of${roleFuncName}"
if {[$this getMultiplicity] == "one"} {
if {$readAccess == "Public"} {
$sect append "$assocTypeName get${funcName}();\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void set${funcName}(in $assocTypeName new${funcName});\n"
if {![$this isMandatory]} {
$sect append "${oneway}void remove${funcName}();\n"
}
}
} else {
# generate attribute if readable or someone else needs to write it
$sect append "typedef sequence<${assocTypeName}> ${funcName}Set;\n"
if {$readAccess == "Public"} {
$sect append "${funcName}Set get${funcName}Set();\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void add${funcName}(in $assocTypeName new${funcName});\n"
$sect append "${oneway}void remove${funcName}(in $assocTypeName old${funcName});\n"
}
}
$sect append "\n"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMLinkAttr] {
Class IDGLinkAttrD : {IDGLinkAttr CMLinkAttr} {
}
} else {
Class IDGLinkAttrD : {IDGLinkAttr OPLinkAttr} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPLinkAttr) IDGLinkAttrD
selfPromoter OPLinkAttr {this} {
IDGLinkAttrD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgqualass.tcl /main/titanic/5
Class IDGQualAssocAttr : {IDGCmnAttr} {
constructor
method destructor
method generate
}
constructor IDGQualAssocAttr {class this name} {
set this [IDGCmnAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGQualAssocAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGQualAssocAttr::generate {this} {
set name [$this getName]
set type [$this ooplType]
set opposite [$this opposite]
if {[$type get_obj_type] != "base_type"} {
if {[$type ooplClass] == "" || [[$type ooplClass] isIDLSpecial]} {
m4_error $E_ILL_DESTINATION [[$this ooplClass] get_obj_type] [[$this ooplClass] getName] [$type getPropertyValue class_type] [[$opposite ooplClass] getName]
return
}
}
set access [$this getPropertyValue assoc_access]
set readAccess [$this genAccess [$this splitAccessMode $access r]]
set writeAccess [$this genAccess [$this splitAccessMode $access w]]
if {$readAccess != "Public" && $writeAccess != "Public" && $opposite == ""} {
return
}
[IDGDataMgr::getMgr] addForward [$type getName]
set sect [[IDGDataMgr::getMgr] getSect interface]
$this genDescription $sect
set oneway ""
if {[$this getPropertyValue oneway] != "Off"} {
set oneway "oneway "
}
set funcName [cap $name]
set typeString [$type generate]
set key [$this qualifier]
set keyName [$key getName]
set keyType [[$key ooplType] generate]
if {[$this getMultiplicity] == "one"} {
# generate attribute if readable or someone else needs to write it
if {$readAccess == "Public"} {
$sect append "$typeString get${funcName}(in $keyType $keyName);\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void set${funcName}(in $keyType $keyName, in $typeString new$funcName);\n"
if {![$this isMandatory]} {
$sect append "${oneway}void remove${funcName}(in $keyType $keyName);\n"
}
}
} else {
# generate attribute if readable or someone else needs to write it
regsub -all ":" $typeString "_" typeName
set typeName "$typeName${funcName}Set"
$sect append "typedef sequence<$typeString> $typeName;\n"
if {$readAccess == "Public"} {
$sect append "$typeName get${funcName}Set(in $keyType $keyName);\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void add${funcName}(in $keyType $keyName, in $typeString new${funcName});\n"
$sect append "${oneway}void remove${funcName}(in $keyType $keyName, in $typeString old${funcName});\n"
}
}
$sect append "\n"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMQualAssocAttr] {
Class IDGQualAssocAttrD : {IDGQualAssocAttr CMQualAssocAttr} {
}
} else {
Class IDGQualAssocAttrD : {IDGQualAssocAttr OPQualAssocAttr} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPQualAssocAttr) IDGQualAssocAttrD
selfPromoter OPQualAssocAttr {this} {
IDGQualAssocAttrD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgquallin.tcl /main/titanic/7
Class IDGQualLinkAttr : {IDGCmnAttr} {
constructor
method destructor
method generate
}
constructor IDGQualLinkAttr {class this name} {
set this [IDGCmnAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGQualLinkAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGQualLinkAttr::generate {this} {
set name [$this getName]
set type [$this ooplType]
set opposite [$this opposite]
if {[$type get_obj_type] != "base_type"} {
if {[$type ooplClass] == "" || [[$type ooplClass] isIDLSpecial]} {
set oppName ""
if {$opposite != ""} {
set oppName [[$opposite ooplClass] getName]
}
m4_error $E_ILL_DESTINATION [[$this ooplClass] get_obj_type] [[$this ooplClass] getName] [$type getPropertyValue class_type] $oppName
return
}
}
set access [$this getPropertyValue assoc_access]
set readAccess [$this genAccess [$this splitAccessMode $access r]]
set writeAccess [$this genAccess [$this splitAccessMode $access w]]
if {$readAccess != "Public" && $writeAccess != "Public" && $opposite == ""} {
return
}
[IDGDataMgr::getMgr] addForward [$type getName]
set sect [[IDGDataMgr::getMgr] getSect interface]
$this genDescription $sect
set oneway ""
if {[$this getPropertyValue oneway] != "Off"} {
set oneway "oneway "
}
set assocTypeName [$type getName]
set assocFuncName [cap $assocTypeName]
set roleFuncName [cap $name]
set funcName "${assocFuncName}Of${roleFuncName}"
set key [$this qualifier]
set keyName [$key getName]
set keyType [[$key ooplType] generate]
if {[$this getMultiplicity] == "one"} {
if {$readAccess == "Public"} {
$sect append "$assocTypeName get${funcName}(in $keyType $keyName);\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void set${funcName}(in $keyType $keyName, in $assocTypeName new${funcName});\n"
if {![$this isMandatory]} {
$sect append "${oneway}void remove${funcName}(in $keyType $keyName);\n"
}
}
} else {
# generate attribute if readable or someone else needs to write it
$sect append "typedef sequence<${assocTypeName}> ${funcName}Set;\n"
if {$readAccess == "Public"} {
$sect append "${funcName}Set get${funcName}Set(in $keyType $keyName);\n"
}
if {$writeAccess == "Public" || $opposite != ""} {
$sect append "${oneway}void add${funcName}(in $keyType $keyName, in $assocTypeName new${funcName});\n"
$sect append "${oneway}void remove${funcName}(in $keyType $keyName, in $assocTypeName old${funcName});\n"
}
}
$sect append "\n"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMQualLinkAttr] {
Class IDGQualLinkAttrD : {IDGQualLinkAttr CMQualLinkAttr} {
}
} else {
Class IDGQualLinkAttrD : {IDGQualLinkAttr OPQualLinkAttr} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPQualLinkAttr) IDGQualLinkAttrD
selfPromoter OPQualLinkAttr {this} {
IDGQualLinkAttrD promote $this
}
#---------------------------------------------------------------------------
# File: @(#)idgreverse.tcl /main/titanic/2
Class IDGReverseLinkAttr : {IDGCmnAttr} {
constructor
method destructor
method generate
}
constructor IDGReverseLinkAttr {class this name} {
set this [IDGCmnAttr::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method IDGReverseLinkAttr::destructor {this} {
# Start destructor user section
# End destructor user section
}
method IDGReverseLinkAttr::generate {this} {
set access [$this getPropertyValue assoc_access]
set readAccess [$this genAccess [$this splitAccessMode $access r]]
if {$readAccess != "Public"} {
return
}
set type [$this ooplType]
[IDGDataMgr::getMgr] addForward [$type getName]
set sect [[IDGDataMgr::getMgr] getSect interface]
$this genDescription $sect
# generate attribute if readable or someone else needs to write it
set typeString [$type generate]
set name [$this getName]
$sect append "$typeString get[cap $name]();\n\n"
}
# Do not delete this line -- regeneration end marker
if [isCommand CMReverseLinkAttr] {
Class IDGReverseLinkAttrD : {IDGReverseLinkAttr CMReverseLinkAttr} {
}
} else {
Class IDGReverseLinkAttrD : {IDGReverseLinkAttr OPReverseLinkAttr} {
}
}
global mostDerivedOOPL ; set mostDerivedOOPL(OPReverseLinkAttr) IDGReverseLinkAttrD
selfPromoter OPReverseLinkAttr {this} {
IDGReverseLinkAttrD promote $this
}