home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
cadmodel.tcl
< prev
next >
Wrap
Text File
|
1997-11-26
|
3KB
|
123 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)cadmodel.tcl /main/titanic/1
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cadmodel.tcl /main/titanic/1 26 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require "cadbinarya.tcl"
require "cadclass.tcl"
require "cadinhergr.tcl"
require "cadnassocc.tcl"
require "cadnassocn.tcl"
require "cadmodeltp.tcl"
# End user added include file section
Class CADModel : {Object} {
method destructor
constructor
method load
method loadClasses
method getClasses
method defineSMTypes
method makeSMTypeName
method addClass
method removeClass
attribute loaded
attribute classSet
}
method CADModel::destructor {this} {
# Start destructor user section
# End destructor user section
}
constructor CADModel {class this} {
set this [Object::constructor $class $this $this]
$this loaded 0
$this classSet [List new]
# Define global available SMTypes
$this defineSMTypes
# Add creator scripts to the ObjectFactory
set objFac [$this getObjectFactory]
$objFac addCreatorScript $OMT_CAD_NAssoc \
"return \[CADNAssocNode new $this]"
$objFac addCreatorScript $OMT_CAD_NaryAssocConn \
"return \[CADNAssocConn new $this]"
# Combined types
$objFac addCreatorScript $OMT_CAD_CB_Class \
"return \[CADClass new $this]"
$objFac addCreatorScript $OMT_CAD_CB_Generalization \
"return \[CADInherGroup new $this]"
$objFac addCreatorScript $OMT_CAD_CB_Association \
"return \[CADBinaryAssoc new $this]"
return $this
}
method CADModel::load {this} {
if {[$this loaded] == 1} {
return
}
$this loaded 1
$this loadClasses
}
method CADModel::loadClasses {this} {
set classes [$this getSMObjects $OMT_CAD_CB_Class]
foreach class $classes {
$this addClass $class
}
}
method CADModel::getClasses {this} {
$this load
return [$this classSet]
}
method CADModel::defineSMTypes {this} {
set typeIter [SMTypeIter new]
while {[$typeIter current] != ""} {
set smType [$typeIter current]
if { ![string match CAD* [$smType name]]} {
$typeIter next
continue
}
set name [$this makeSMTypeName [$smType name]]
eval "global $name"
eval "set $name $smType"
$typeIter next
}
$typeIter delete
global anySMType; set anySMType [SMTypeDB::any]
global nilSMType; set nilSMType [SMTypeDB::nil]
return
}
method CADModel::makeSMTypeName {this type} {
regsub -all "\[ \t]+" $type "_" type
return "OMT_$type"
}
# Do not delete this line -- regeneration end marker
method CADModel::addClass {this newClass} {
[$this classSet] append $newClass
}
method CADModel::removeClass {this oldClass} {
[$this classSet] removeValue $oldClass
}