home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1995
- #
- # File: @(#)semanticbase.tcl /main/hindenburg/5
- # Author: Harm Leijendeckers
- # Description: Base of all report classes which use the
- # semantic model
- #
- #---------------------------------------------------------------------------
- # SccsId = @(#)semanticbase.tcl /main/hindenburg/5 16 Dec 1996 Copyright 1995 Cadre Technologies Inc.
-
-
- Class SemanticBase : {ReportBase} {
- method destructor
- constructor
- method phaseReport
- method systemReport
- method fileReport
-
- method doReport
-
- method objName
- method objType
- method labelValue
- method fullFileName
- }
-
-
- constructor SemanticBase {class this} {
- set this [ReportBase::constructor $class $this]
- OTShRegister::semanticModel
- defineTypes
- return $this
- }
-
-
- method SemanticBase::destructor {this} {
- [$this report] delete
- }
-
-
- method SemanticBase::phaseReport {this} {
- set model [SMPhaseModel new [$this configV] [$this phaseV]]
- set result [$this doReport $model]
- $model delete
- return $result
- }
-
-
- method SemanticBase::systemReport {this} {
- set model [SMSystemModel new [$this configV] [$this systemV]]
- set result [$this doReport $model]
- $model delete
- return $result
- }
-
-
- method SemanticBase::fileReport {this} {
- set model [SMFileModel new [$this configV] [$this fileV]]
- set result [$this doReport $model]
- $model delete
- return $result
- }
-
-
- method SemanticBase::objName {this smObj} {
- set item [$smObj getItem]
- if [$item isNil] {
- return "?"
- }
- return [$item name]
- }
-
-
- method SemanticBase::objType {this smObj} {
- return [[$smObj getSemType] name]
- }
-
-
- method SemanticBase::labelValue {this smObj} {
- set label [$smObj getLabel]
- if [$label isNil] {
- return ""
- }
- set result ""
- foreach item [query $label.itemRefs.item] {
- if [lempty $result] {
- set result [$item name]
- } else {
- set result [concat [$item name] ,$result]
- }
- }
-
- return $result
- }
-
-
- method SemanticBase::fullFileName {this fileVersion} {
- if { [$fileVersion isNil] } { return "unknown" }
- set file [$fileVersion file]
- set result [$file qualifiedName].[$file type].[$fileVersion versionName]
- set cc [ClientContext::global]
- if { [$cc currentLevel] == "Phase" } {
- append result " in system [[$file system] name]"
- }
- return $result
- }
-
-
- # ----------------------------------------------------------------------
- # initialization procedures
-
- proc makeTypeName {method type} {
- regsub -all "\[ \t]\[ \t]*" $type "_" type
- return "[string toupper $method]_$type"
- }
-
-
- proc defineTypes {} {
- set typeIter [SMTypeIter new]
- while {[$typeIter current] != ""} {
- set name [makeTypeName OMT [[$typeIter current] name]]
- global $name
- set $name [$typeIter current]
- $typeIter next
- }
- $typeIter delete
-
- global ANY; set ANY [SMTypeDB::any]
- global NIL; set NIL [SMTypeDB::nil]
-
- return
- }
-