1stooop(n)         Simple Tcl Only Object Oriented Programming        stooop(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       stooop - Object oriented extension.
9

SYNOPSIS

11       package require Tcl  8.3
12
13       package require stooop  ?4.4.1?
14
15       ::stooop::class name body
16
17       ::stooop::new class ?arg arg ...?
18
19       ::stooop::delete object ?object ...?
20
21       ::stooop::virtual proc name {this ?arg arg ...?} ?body?
22
23       ::stooop::classof object
24
25       ::stooop::new object
26
27       ::stooop::printObjects ?pattern?
28
29       ::stooop::record
30
31       ::stooop::report ?pattern?
32
33_________________________________________________________________
34

DESCRIPTION

36       This package provides commands to extend Tcl in an object oriented man‐
37       ner, using a familiar C++ like syntax and behaviour. Stooop only intro‐
38       duces  a  few  new  commands:  class, new, delete, virtual and classof.
39       Along with a few coding conventions, that is basically all you need  to
40       know to use stooop. Stooop is meant to be as simple to use as possible.
41
42       This  manual is very succinct and is to be used as a quick reminder for
43       the programmer, who should have read the thorough stooop_man.html  HTML
44       documentation at this point.
45
46       ::stooop::class name body
47              This command creates a class. The body, similar in contents to a
48              Tcl namespace (which a class actually also is), contains  member
49              procedure  definitions.  Member  procedures  can also be defined
50              outside the class body, by prefixing their name with class::, as
51              you would proceed with namespace procedures.
52
53              proc class {this ?arg arg ...?} ?base {?arg arg ...?} ...? body
54                     This  is  the  constructor procedure for the class. It is
55                     invoked following a new invocation on the class. It  must
56                     have  the  same  name  as  the class and a first argument
57                     named this. Any number of  base  classes  specifications,
58                     including  arguments  to  be passed to their constructor,
59                     are allowed before the actual body of the procedure.
60
61              proc ~class {this} body
62                     This is the destructor procedure for  the  class.  It  is
63                     invoked  following  a delete invocation. Its name must be
64                     the concatenation of a single ~ character followed by the
65                     class  name  (as  in C++). It must have a single argument
66                     named this.
67
68              proc name {this ?arg arg ...?} body
69                     This is a member procedure of the  class,  as  its  first
70                     argument is named this. It allows a simple access of mem‐
71                     ber data for the object referenced  by  this  inside  the
72                     procedure. For example:
73
74                        set ($this,data) 0
75
76
77              proc name {?arg arg ...?} body
78                     This  is  a  static  (as  in C++) member procedure of the
79                     class, as its first argument is not  named  this.  Static
80                     (global) class data can be accessed as in:
81
82                        set (data) 0
83
84
85              proc class {this copy} body
86                     This  is  the  optional  copy procedure for the class. It
87                     must have the same name as the class and exactly 2  argu‐
88                     ments  named this and copy. It is invoked following a new
89                     invocation on an existing object of the class.
90
91       ::stooop::new class ?arg arg ...?
92              This command is used to create an object. The first argument  is
93              the  class  name  and is followed by the arguments needed by the
94              corresponding class constructor. A  unique  identifier  for  the
95              object just created is returned.
96
97       ::stooop::delete object ?object ...?
98              This  command is used to delete one or several objects. It takes
99              one or more object identifiers as argument(s).
100
101       ::stooop::virtual proc name {this ?arg arg ...?} ?body?
102              The virtual specifier  may  be  used  on  member  procedures  to
103              achieve dynamic binding. A procedure in a base class can then be
104              redefined (overloaded) in the derived  class(es).  If  the  base
105              class  procedure  is  invoked  on  an object, it is actually the
106              derived class procedure which is invoked, if it exists.  If  the
107              base  class procedure has no body, then it is considered to be a
108              pure virtual and the derived class procedure is always invoked.
109
110       ::stooop::classof object
111              This command returns the class of the existing object passed  as
112              single parameter.
113
114       ::stooop::new object
115              This  command is used to create an object by copying an existing
116              object. The copy  constructor  of  the  corresponding  class  is
117              invoked  if  it  exists,  otherwise  a simple copy of the copied
118              object data members is performed.
119

DEBUGGING

121       Environment variables
122
123              STOOOPCHECKDATA
124                     Setting this variable to any true value will cause stooop
125                     to check for invalid member or class data access.
126
127              STOOOPCHECKPROCEDURES
128                     Setting this variable to any true value will cause stooop
129                     to check for invalid member procedure arguments and  pure
130                     interface classes instanciation.
131
132              STOOOPCHECKALL
133                     Setting this variable to any true value will cause stooop
134                     to activate both procedure and data member checking.
135
136              STOOOPCHECKOBJECTS
137                     Setting this variable to any true value will cause stooop
138                     to  activate object checking. The following stooop names‐
139                     pace procedures  then  become  available  for  debugging:
140                     printObjects, record and report.
141
142              STOOOPTRACEPROCEDURES
143                     Setting  this  environment  variable  to  either  stdout,
144                     stderr or a file name, activates procedure  tracing.  The
145                     stooop  library will then output to the specified channel
146                     1 line of informational text for  each  member  procedure
147                     invocation.
148
149              STOOOPTRACEPROCEDURESFORMAT
150                     Defines  the  trace procedures output format. Defaults to
151                     "class: %C, procedure: %p, object: %O, arguments: %a".
152
153              STOOOPTRACEDATA
154                     Setting  this  environment  variable  to  either  stdout,
155                     stderr or a file name, activates data tracing. The stooop
156                     library will then output to the specified channel 1  line
157                     of informational text for each member data access.
158
159              STOOOPTRACEDATAFORMAT
160                     Defines the trace data output format. Defaults to "class:
161                     %C, procedure: %p, array: %A,  object:  %O,  member:  %m,
162                     operation: %o, value: %v".
163
164              STOOOPTRACEDATAOPERATIONS
165                     When tracing data output, by default, all read, write and
166                     unsetting accesses are reported, but  the  user  can  set
167                     this variable to any combination of the letters r, w, and
168                     u for more specific tracing (please refer  to  the  trace
169                     Tcl manual page for more information).
170
171              STOOOPTRACEALL
172                     Setting  this  environment  variable  to  either  stdout,
173                     stderr or a file name, enables both  procedure  and  data
174                     tracing.
175
176       ::stooop::printObjects ?pattern?
177              Prints  an  ordered list of existing objects, in creation order,
178              oldest first. Each output line contains the class  name,  object
179              identifier and the procedure within which the creation occurred.
180              The optional pattern argument (as in the Tcl string  match  com‐
181              mand) can be used to limit the output to matching class names.
182
183       ::stooop::record
184              When  invoked,  a  snapshot  of  all  existing stooop objects is
185              taken. Reporting can then be used at a later time to  see  which
186              objects were created or deleted in the interval.
187
188       ::stooop::report ?pattern?
189              Prints    the    created   and   deleted   objects   since   the
190              ::stooop::record procedure was invoked  last.  If  present,  the
191              pattern argument limits the output to matching class names.
192

EXAMPLES

194       Please see the full HTML documentation in stooop_man.html.
195

BUGS, IDEAS, FEEDBACK

197       This  document,  and the package it describes, will undoubtedly contain
198       bugs and other problems.  Please report such in the category stooop  of
199       the          Tcllib         SF         Trackers         [http://source
200       forge.net/tracker/?group_id=12883].  Please also report any  ideas  for
201       enhancements you may have for either package and/or documentation.
202

KEYWORDS

204       C++, class, object, object oriented
205
206
207
208stooop                               4.4.1                           stooop(n)
Impressum