HaveDaemon (Daemon property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
 
 
(12 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<span style="font-size:120%"><b>Checks whether user has a daemon.</b></span>
{{Template:Daemon:HaveDaemon subtitle}}
<var>HaveDaemon</var> returns a <var>[[Boolean enumeration]]</var> that indicates whether the daemon thread associated with the <var>[[Daemon class|Daemon]]</var> method object is accessible.


HaveDaemon is a member of the [[Daemon class]]
==Syntax==
{{Template:Daemon:HaveDaemon syntax}}
===Syntax terms===
<table class="syntaxTable">
<tr><th>%boolean</th>
<td>A <var>Boolean</var> enumeration to contain the returned value of <var>HaveDaemon</var>.
<p><var>HaveDaemon</var> returns <code>True</code> unless the daemon thread logged off, for whatever reason.</p> </td></tr>
<tr><th>daemon</th>
<td>A <var>Daemon</var> object.</td></tr>
</table>


This method returns a Boolean enumeration that indicates whether the daemon thread associated with the Daemon method object is accessible.
==Examples==
In the following example, a global daemon updates an XML document, then <var>HaveDaemon</var> verifies the continued existence of the daemon.
<p class="code">begin
  %speed is object daemon global
  %list is object stringList
  %tiny is object xmlDoc
  %bool is enumeration boolean
  %speed = new
  %speed:run('*LOWER')
 
  %list = new
  text to %list
      begin
        %doc is object xmlDoc
        %(daemon):getInputObject(%doc)
        %doc:selectSingleNode('/out/in'):addAttribute('foo','bar')
        %(daemon):returnObject(%doc)
      end
  end text


  %tiny = new
  %tiny:loadXml('<out><in></in></out>')
  %speed:run(%list, %tiny, %tiny)
  %tiny:print


==HaveDaemon Syntax==
  %bool = %speed:havedaemon
<pre>
  print '%bool is ' %bool:tostring
%bool = %daem:HaveDaemon
</pre>
 
===Syntax Terms===
<dl>
<dt>%bool  
<dd>A declared enumeration object of type Boolean to contain the returned value of HaveDaemon.
<dt>%daem
<dd>A previously defined and instantiated Daemon object.
</dl>
HaveDaemon returns <tt>True</tt> unless the daemon thread logged off, for whatever reason.
 
==Example==
In the following example, a global daemon updates an XML document, then HaveDaemon verifies the continued existence of the daemon.
 
<pre>
b
%speed is object daemon global
%list is object stringList
%tiny is object xmlDoc
%bool is enumeration boolean
%speed = new
%speed:run('*LOWER')
 
%list = new
text to %list
b
%doc is object xmlDoc
%(daemon):getInputObject(%doc)
%doc:selectSingleNode('/out/in'):addAttribute('foo','bar')
%(daemon):returnObject(%doc)
end
end
end text
</p>
 
%tiny = new
%tiny:loadXml('<out><in></in></out>')
%speed:run(%list, %tiny, %tiny)
%tiny:print
 
%bool = %speed:havedaemon
Print '%bool is ' %bool:tostring
end
</pre>
The example above returns this result:
The example above returns this result:
<p class="code"><out><in foo="bar"/></out>%bool is True
</p>


<pre>
==See also==
<out><in foo="bar"/></out>%bool is True
{{Template:Daemon:HaveDaemon footer}}
</pre>
 
 
[[Category:Daemon class|HaveDaemon]]
[[Category:System methods]]

Latest revision as of 02:14, 8 July 2012

Is the thread associated with this Daemon accessible? (Daemon class)

HaveDaemon returns a Boolean enumeration that indicates whether the daemon thread associated with the Daemon method object is accessible.

Syntax

%boolean = daemon:HaveDaemon

Syntax terms

%boolean A Boolean enumeration to contain the returned value of HaveDaemon.

HaveDaemon returns True unless the daemon thread logged off, for whatever reason.

daemon A Daemon object.

Examples

In the following example, a global daemon updates an XML document, then HaveDaemon verifies the continued existence of the daemon.

begin %speed is object daemon global %list is object stringList %tiny is object xmlDoc %bool is enumeration boolean %speed = new %speed:run('*LOWER') %list = new text to %list begin %doc is object xmlDoc  %(daemon):getInputObject(%doc) %doc:selectSingleNode('/out/in'):addAttribute('foo','bar')  %(daemon):returnObject(%doc) end end text %tiny = new %tiny:loadXml('<out><in></in></out>') %speed:run(%list, %tiny, %tiny) %tiny:print %bool = %speed:havedaemon print '%bool is ' %bool:tostring end

The example above returns this result:

<out><in foo="bar"/></out>%bool is True

See also