OSDN Git Service

* mkgroup.c (main): Fix test for duplicate domain/machine request.
[pf3gnuchains/pf3gnuchains3x.git] / itcl / itcl / tests / old / toasters / Appliance.tcl
1 # ----------------------------------------------------------------------
2 #  PURPOSE:  Base class for all electrical appliances that interact
3 #            with Outlets.
4 #
5 #   AUTHOR:  Michael J. McLennan       Phone: (610)712-2842
6 #            AT&T Bell Laboratories   E-mail: michael.mclennan@att.com
7 #
8 #      RCS:  $Id$
9 # ----------------------------------------------------------------------
10 #               Copyright (c) 1993  AT&T Bell Laboratories
11 # ======================================================================
12 # Permission to use, copy, modify, and distribute this software and its
13 # documentation for any purpose and without fee is hereby granted,
14 # provided that the above copyright notice appear in all copies and that
15 # both that the copyright notice and warranty disclaimer appear in
16 # supporting documentation, and that the names of AT&T Bell Laboratories
17 # any of their entities not be used in advertising or publicity
18 # pertaining to distribution of the software without specific, written
19 # prior permission.
20 #
21 # AT&T disclaims all warranties with regard to this software, including
22 # all implied warranties of merchantability and fitness.  In no event
23 # shall AT&T be liable for any special, indirect or consequential
24 # damages or any damages whatsoever resulting from loss of use, data or
25 # profits, whether in an action of contract, negligence or other
26 # tortuous action, arising out of or in connection with the use or
27 # performance of this software.
28 # ======================================================================
29
30 itcl_class Appliance {
31
32         method power {power} {
33                 if {[itcl_info objects [info which $outlet]] == ""} {
34                         set outlet {}
35                 }
36                 if {$outlet == ""} {
37                         error "cannot use $this: not plugged in"
38                 }
39                 $outlet use $power
40         }
41
42         public outlet {}
43 }