Clone
ssoberni <stefan.sobernig@wu-wien.ac.at>
committed
on 15 Oct 14
Done with basic princexml integration, improve Makefile integration
2-1-0-rc + 45 more
doc/Object.man (+28 -15)
2 2 [manpage_begin nx::Object 3 2.0.0]
3 3
4 4 [comment {For the time being, we do not render keywords & terms; and
5 5 the corresponding reverse index}]
6 6 [proc keywords args {}]
7 7 [proc term v {return $v}]
8 8
9 9 [keywords baseclass]
10 10 [keywords NX]
11 11 [keywords "mixin class"]
12 12 [keywords "re-classification"]
13 13 [keywords "submethod"]
14 14 [keywords "method ensemble"]
15 15 [keywords "linearisation"]
16 16
17 17 [vset SCOPE "object"]
18 18 [vset CMD "obj"]
19 19 [vset MODIFIER "object"]
20 20
21 21 [copyright {2014 Stefan Sobernig <stefan.sobernig@wu.ac.at>, Gustaf Neumann <gustaf.neumann@wu.ac.at>; available under the Creative Commons Attribution 3.0 Austria license (CC BY 3.0 AT).}]
  22
  23 [moddesc "NX API"]
22 24 [titledesc {API reference of the base class in the NX object system}]
23 25
  26
24 27 [description]
25 28 [para]
26 29
27 30 [cmd nx::Object] is the [term "base class"] of the [term NX] object system. All
28 31 objects defined in [term NX] are (direct or indirect) instances of this
29 32 [term "base class"]. The methods provided by the [cmd nx::Object]
30 33 [term "base class"] are available to all objects and to all classes defined in
31 34 NX.
32 35
33 36 [example {
34 37  +---------+
35 38  | ::nx::* |
36 39  +---------+--------------------------------------Y
37 40  |                                                |
38 41  |  +---------+     instance of     +----------+  |
39 42  |  |         |<....................|          |  |
40 43  |  |  Class  |                     |  Object  |  |
41 44  |  |         |....................>|          |  |
42 45  |  +----+----+     subclass of     +-----+----+  |
43 46  |       ^                           ^    ^       |
 
790 793 [enum] As a [emph placeholder] for the currently active object, [cmd nx::current]
791 794        can be used to retrieve the object name.
792 795 [enum] Reading and writing [emph "object variables"] directly (i.e. without getter/setter methods in place) require the use
793 796 of variable names carrying the prefix [const :] ("colon-prefix
794 797 notation"). Internally, colon-prefixed variable names are processed
795 798 using Tcl's variable resolvers. Alternatively, one can provide for getter/setter methods for object variables (see [method property] and [method variable]).
796 799
797 800 [enum] [emph {Self-referential method calls}] can be defined via
798 801 prefixing ([const :]) the method names or, alternatively, via [cmd nx::current]. Internally,
799 802 colon-prefixed method names are processed using Tcl's command
800 803 resolvers. The colon-prefix notation is recommended, also because it
801 804 has a (slight) performance advantage over [cmd nx::current] which
802 805 requires two rather than one command evaluation per method call.
803 806 [list_end]
804 807
805 808 See the following listing for some examples corresponding to use cases 1--3:
806 809
807 810
808 811 [example {
809 812   Object create ::obj {
810     puts [current];                       # 1) print name of currently active object ('::obj')       
811     set :x 1; :object variable y 2;       # 2) object variables
  813     # 1) print name of currently active object ('::obj')
  814     puts [current];
  815     # 2) object variables
  816     set :x 1; :object variable y 2;     
812 817     :public object method print {} {
813       set z 3;                            # 2.a) method-local variable
814       puts ${:x}-${:y}-$z;                # 2.b) variable substitution using '$' and ':'
815       puts [set :x]-[set :y]-[set z];     # 2.c) reading variables using 'set'
816       set :x 1; incr :y;                  # 2.d) writing variables using 'set', 'incr', ...
  818       # 2.a) method-local variable
  819       set z 3;
  820       # 2.b) variable substitution using '$' and ':'
  821       puts ${:x}-${:y}-$z;
  822       # 2.c) reading variables using 'set'
  823       puts [set :x]-[set :y]-[set z];
  824       # 2.d) writing variables using 'set', 'incr', ...
  825       set :x 1; incr :y;                        
817 826     }
818 827     :public object method show {} {
819      :print;                              # 3.a) self-referential method call using ':'   
820      [current] print;                     # 3.b) self-referential method call using 'nx::current'
821      [current object] print;              # 3.c) self-referential method call using 'nx::current object'
  828       # 3.a) self-referential method call using ':'     
  829       :print;
  830       # 3.b) self-referential method call using 'nx::current'
  831       [current] print;
  832       # 3.c) self-referential method call using 'nx::current object'
  833       [current object] print;             
822 834     }
823 835     :show
824   }}]
  836   }
  837 }]
825 838
826 839
827 840 [manpage_end]