home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # 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 : @(#)csoopl.tcl /main/titanic/4 5 Sep 1997
- # Original date : Fri Sep 5 12:02:36 MET DST 1997
- # Description : Constraint satisfaction module
- # OOPL derived customizations
- #
- #---------------------------------------------------------------------------
-
- require "cgcustom.tcl"
- require "csconst.tcl"
-
- Class CSOperation : [customizeOOPLModel OPOperation CSOperation] {
- method generate
- }
-
- method CSOperation::generate {this class} {
- global CSOperation::super
- set oper [$this ${CSOperation::super}::generate $class]
- $oper ensure [$this getPropertyValue "ensure"]
- $oper require [$this getPropertyValue "require"]
- if {[$oper ensure] != "" || [$oper require] != ""} {
- $class addExtIncl "ConstraintSections.hxx"
- }
- return $oper
- }
-
- selfPromoter OPOperation {this} {
- CSOperation promote $this
- }
-
- Class CSDataAttr : [customizeOOPLModel OPDataAttr CSDataAttr] {
- method generate
- }
-
- method CSDataAttr::generate {this class} {
- global CSDataAttr::super
- set attr [$this ${CSDataAttr::super}::generate $class]
- set assertions [$this getPropertyValue "invariant"]
- if {$assertions != ""} {
- $attr invariant $assertions
- $class addExtIncl "ConstraintSections.hxx"
- [$class featureSet] foreach f {
- if [$f isA CppAccMethod] {
- if {([$f belongsTo] == $attr) &&
- ([string first "get" [$f name]] == 0)} {
- [$f genCodeSet] remove 0
- set genCode [CppGenCode new $f]
- $genCode append "invariant(${assertions});\n"
- $genCode append "return [$attr name];\n"
- }
- }
- }
- }
- return $attr
- }
-
- selfPromoter OPDataAttr {this} {
- CSDataAttr promote $this
- }
-