SCDoc: Use proper static string constants instead of comparing string literals.
[supercollider.git] / Help / Control / AbstractServerAction.html
blob3d9c99987cdc890672694bcb16cdb36957140b29
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0021e7}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
17 p.p8 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; color: #001bb9; min-height: 14.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; color: #001bb9}
19 p.p10 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
21 p.p12 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
22 p.p13 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #ad140d}
23 p.p14 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #ad140d; min-height: 12.0px}
24 p.p15 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
25 p.p16 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #606060}
26 span.s1 {font: 18.0px Helvetica}
27 span.s2 {color: #001bb9}
28 span.s3 {color: #000000}
29 span.s4 {text-decoration: underline}
30 span.s5 {font: 9.0px Monaco}
31 span.s6 {color: #2c7014}
32 span.s7 {color: #ad140d}
33 span.Apple-tab-span {white-space:pre}
34 </style>
35 </head>
36 <body>
37 <p class="p1"><span class="s1"><b>AbstractServerAction<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>register actions to be taken for a server</b><span class="s1"><b><span class="Apple-tab-span"> </span></b></span></p>
38 <p class="p2"><br></p>
39 <p class="p1"><b>Inherits from: </b><a href="../Core/Object.html"><span class="s2"><b>Object</b></span></a><b> : AbstractSystemAction<span class="Apple-converted-space"> </span></b></p>
40 <p class="p3"><br></p>
41 <p class="p2"><br></p>
42 <p class="p1">This is an <b>abstract superclass</b> for singletons like ServerQuit, which provides a place for registering functions and objects for events that should happen when something happens in the server.<span class="Apple-converted-space"> </span></p>
43 <p class="p1">No direct call to AbstractServerAction is required.</p>
44 <p class="p2"><br></p>
45 <p class="p4"><span class="s3"><b>See also:</b> <a href="../ServerArchitecture/Server.html"><span class="s2">Server</span></a>, <a href="ServerBoot.html"><span class="s4">ServerBoot</span></a>, <a href="ServerTree.html"><span class="s4">ServerTree</span></a>, <a href="ServerQuit.html"><span class="s4">ServerQuit</span></a></span></p>
46 <p class="p2"><br></p>
47 <p class="p2"><br></p>
48 <p class="p5"><b>Note: not fully working on linux and windows.</b></p>
49 <p class="p2"><br></p>
50 <p class="p1">Setting the computer to sleep on these systems causes the actions to be called.</p>
51 <p class="p1">As to date in linux, JACK does not survive a sleep, it nevertheless behaves correctly for the time being.</p>
52 <p class="p2"><br></p>
53 <p class="p2"><br></p>
54 <p class="p5"><b>Class Methods</b></p>
55 <p class="p6"><br></p>
56 <p class="p7"><b><span class="Apple-tab-span"> </span>*functionSelector</b></p>
57 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>subclasses return specific function selectors for objects that implement this as interface.<span class="Apple-converted-space"> </span></p>
58 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>selectors are:</p>
59 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>doOnServerBoot</b> - <span class="Apple-tab-span"> </span><a href="ServerBoot.html"><span class="s2">ServerBoot</span></a></p>
60 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>doOnServerQuit</b> -<span class="Apple-tab-span"> </span><a href="ServerQuit.html"><span class="s2">ServerQuit</span></a></p>
61 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>doOnServerTree</b> - <span class="Apple-tab-span"> </span><a href="ServerTree.html"><span class="s2">ServerTree</span></a></p>
62 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
63 <p class="p7"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>not for registry with a server, but analogous are:<span class="s2"><span class="Apple-tab-span"> </span></span></p>
64 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3"><b>doOnCmdPeriod</b></span> - <span class="Apple-tab-span"> </span><a href="CmdPeriod.html"><span class="s4">CmdPeriod</span></a></p>
65 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3"><b>doOnStartUp</b></span> - <span class="Apple-tab-span"> </span><a href="StartUp.html"><span class="s4">StartUp</span></a></p>
66 <p class="p10"><b><span class="Apple-tab-span"> </span></b></p>
67 <p class="p7"><b><span class="Apple-tab-span"> </span>*add(object, server)</b></p>
68 <p class="p10"><b><span class="Apple-tab-span"> </span></b></p>
69 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Add an action or object for registry</p>
70 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>object </b>- Can either be a <b>function</b> to be evaluated (as first arg the server is passed in),</p>
71 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>or an Object that implements the message returned by <b>functionSelector.</b></p>
72 <p class="p11"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>One object is only registered once</b>, so that multiple additions don't cause multiple calls.</p>
73 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
74 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>server<span class="Apple-converted-space"> </span></b> - Server for which to register.<span class="Apple-converted-space"> </span></p>
75 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>If the symbol <b>\default </b>is passed in, the action is called for the current default server.</p>
76 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>If the symbol <b>\all</b> is passed in, the action is called for all current servers.</p>
77 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>if server is nil, it is added to \default.</p>
78 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
79 <p class="p7"><span class="s5"><span class="Apple-tab-span"> </span></span><b>*remove(object, server)</b></p>
80 <p class="p10"><b><span class="Apple-tab-span"> </span></b></p>
81 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Remove an item or object from registry. If server is nil, remove from <b>default</b> key.</p>
82 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
83 <p class="p7"><span class="Apple-tab-span"> </span><b>*removeServer(server)</b></p>
84 <p class="p10"><b><span class="Apple-tab-span"> </span></b></p>
85 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Remove all items that are registered for a given server</p>
86 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
87 <p class="p7"><span class="s5"><span class="Apple-tab-span"> </span></span><b>*removeAll</b></p>
88 <p class="p10"><b><span class="Apple-tab-span"> </span></b></p>
89 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Remove all items from registry<span class="s5"><span class="Apple-tab-span"> </span></span></p>
90 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
91 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
92 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// examples</p>
93 <p class="p14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
94 <p class="p14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
95 <p class="p14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
96 <p class="p13"><span class="Apple-tab-span"> </span><span class="s3"><span class="Apple-tab-span"> </span></span>// ServerBoot</p>
97 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.boot;</p>
98 <p class="p16"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f = { </span><span class="s2">|server|</span><span class="s3"> </span>"------------The server '%' has booted.------------\n"<span class="s3">.postf(server) };</span></p>
99 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerBoot</span>.add(f, <span class="s6">\default</span>);</p>
100 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.quit; </span>// quit the server and observe the post</p>
101 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.boot;</p>
102 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="s2">ServerBoot</span><span class="s3">.remove(f, </span><span class="s6">\default</span><span class="s3">); </span>// remove it again</p>
103 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.quit;<span class="Apple-converted-space"> </span></p>
104 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.boot;</span>// no post.</p>
105 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerBoot</span>.add(f, <span class="s2">Server</span>.internal);</p>
106 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">Server</span>.internal.quit;</p>
107 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">Server</span>.internal.boot;</p>
108 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerBoot</span>.removeAll; <span class="s7">// clear all</span></p>
109 <p class="p14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
110 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>// ServerQuit</p>
111 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.boot;</p>
112 <p class="p16"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f = { |server| </span>"------------The server '%' has quit.------------\n"<span class="s3">.postf(server) };</span></p>
113 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerQuit</span>.add(f, <span class="s6">\default</span>);</p>
114 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.quit; </span>// quit the server and observe the post</p>
115 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.boot;</p>
116 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="s2">ServerQuit</span><span class="s3">.remove(f, </span><span class="s6">\default</span><span class="s3">); </span>// remove it again</p>
117 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.quit; </span>// no post.</p>
118 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerQuit</span>.add(f, <span class="s2">Server</span>.internal);</p>
119 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">Server</span>.internal.boot;</p>
120 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">Server</span>.internal.quit;</p>
121 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerQuit</span>.removeAll; <span class="s7">// clear all</span></p>
122 <p class="p14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
123 <p class="p14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
124 <p class="p6"><span class="Apple-tab-span"> </span></p>
125 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// ServerTree</p>
126 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.quit;</p>
127 <p class="p16"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f = { </span><span class="s2">|server|</span><span class="s3"> </span>"-------The server '%' has initialised tree.-------\n"<span class="s3">.postf(server) };</span></p>
128 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>g = { <span class="s2">|server|</span> 10.do { <span class="s2">Group</span>(server).postln } };</p>
129 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerBoot</span>.add(f, <span class="s6">\default</span>);</p>
130 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerTree</span>.add(g, <span class="s6">\default</span>);</p>
131 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.boot; </span>// boot and see how the actions are evaluated in order</p>
132 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>// "cmd-period" (or equivalent) resends the grous.</p>
133 <p class="p14"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
134 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerBoot</span>.removeAll; <span class="s7">// clear all</span></p>
135 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">ServerTree</span>.removeAll; <span class="s7">// clear all</span></p>
136 <p class="p6"><br></p>
137 <p class="p10"><b><span class="Apple-tab-span"> </span></b></p>
138 <p class="p10"><b><span class="Apple-tab-span"> </span></b></p>
139 </body>
140 </html>