Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > d4089b27bfd3289c6baf8b0975a53f9e > files > 632

poco-doc-1.3.6p1-1.fc13.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::Task</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class Task</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Tasks<br />
<b>Header:</b> Poco/Task.h</p>
<h2>Description</h2>
<div class="description">
<p>A <a href="Poco.Task.html" title="class Poco::Task">Task</a> is a subclass of <a href="Poco.Runnable.html" title="class Poco::Runnable">Runnable</a> that has a name  and supports progress reporting and cancellation. </p>
<p>A <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a> object can be used to take care of the lifecycle of a <a href="Poco.Task.html" title="class Poco::Task">Task</a>. </p>
</div>
<h2>Inheritance</h2>
<p><b>Direct Base Classes: </b><a href="Poco.Runnable.html" title="class Poco::Runnable">Runnable</a>, <a href="Poco.RefCountedObject.html" title="class Poco::RefCountedObject">RefCountedObject</a></p>
<p><b>All Base Classes: </b><a href="Poco.RefCountedObject.html" title="class Poco::RefCountedObject">RefCountedObject</a>, <a href="Poco.Runnable.html" title="class Poco::Runnable">Runnable</a></p>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Task.html#10560" title="Poco::Task::cancel()">cancel</a>, <a href="Poco.Task.html#10574" title="Poco::Task::getOwner()">getOwner</a>, <a href="Poco.Task.html#10561" title="Poco::Task::isCancelled()">isCancelled</a>, <a href="Poco.Task.html#10558" title="Poco::Task::name()">name</a>, <a href="Poco.Task.html#10570" title="Poco::Task::postNotification()">postNotification</a>, <a href="Poco.Task.html#10559" title="Poco::Task::progress()">progress</a>, <a href="Poco.Task.html#10563" title="Poco::Task::reset()">reset</a>, <a href="Poco.Task.html#10565" title="Poco::Task::run()">run</a>, <a href="Poco.Task.html#10564" title="Poco::Task::runTask()">runTask</a>, <a href="Poco.Task.html#10572" title="Poco::Task::setOwner()">setOwner</a>, <a href="Poco.Task.html#10568" title="Poco::Task::setProgress()">setProgress</a>, <a href="Poco.Task.html#10575" title="Poco::Task::setState()">setState</a>, <a href="Poco.Task.html#10566" title="Poco::Task::sleep()">sleep</a>, <a href="Poco.Task.html#10562" title="Poco::Task::state()">state</a></p>
<p><b>Inherited Functions: </b><a href="Poco.RefCountedObject.html#9659" title="Poco::RefCountedObject::duplicate()">duplicate</a>, <a href="Poco.RefCountedObject.html#9661" title="Poco::RefCountedObject::referenceCount()">referenceCount</a>, <a href="Poco.RefCountedObject.html#9660" title="Poco::RefCountedObject::release()">release</a>, <a href="Poco.Runnable.html#9810" title="Poco::Runnable::run()">run</a></p>
<h2>Enumerations</h2>
<h3><a name="10550">TaskState</a></h3>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="10551">TASK_IDLE</a></p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="10552">TASK_STARTING</a></p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="10553">TASK_RUNNING</a></p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="10554">TASK_CANCELLING</a></p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="10555">TASK_FINISHED</a></p>
<div class="description">
<p></p>
</div>
<h2>Constructors</h2>
<h3><a name="10556">Task</a></h3>
<p class="decl"><a href="Poco.Task.html" title="class Poco::Task">Task</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; name<br />);</p>
<div class="description">
<p>Creates the <a href="Poco.Task.html" title="class Poco::Task">Task</a>. </p>
</div>
<h2>Destructor</h2>
<h3><a name="10577">~Task</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" />  <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual ~<a href="Poco.Task.html" title="class Poco::Task">Task</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.Task.html" title="class Poco::Task">Task</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="10560">cancel</a></h3>
<p class="decl">void cancel();</p>
<div class="description">
<p>Requests the task to cancel itself. For cancellation to work, the task's <a href="Poco.Task.html#10564" title="Poco::Task::runTask()">runTask</a>() method must periodically call <a href="Poco.Task.html#10561" title="Poco::Task::isCancelled()">isCancelled</a>() and react accordingly. </p>
</div>
<h3><a name="10561">isCancelled</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool isCancelled() const;</p>
<div class="description">
<p>Returns true if cancellation of the task has been requested.  </p>
<p>A <a href="Poco.Task.html" title="class Poco::Task">Task</a>'s <a href="Poco.Task.html#10564" title="Poco::Task::runTask()">runTask</a>() method should periodically call this method and stop whatever it is doing in an orderly way when this method returns true. </p>
</div>
<h3><a name="10558">name</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const std::string &amp; name() const;</p>
<div class="description">
<p>Returns the task's name.	 </p>
</div>
<h3><a name="10559">progress</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">float progress() const;</p>
<div class="description">
<p>Returns the task's progress. The value will be between 0.0 (just started) and 1.0 (completed). </p>
</div>
<h3><a name="10563">reset</a></h3>
<p class="decl">void reset();</p>
<div class="description">
<p>Sets the task's progress to zero and clears the cancel flag. </p>
</div>
<h3><a name="10565">run</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void run();</p>
<div class="description">
<p>Calls the task's <a href="Poco.Task.html#10564" title="Poco::Task::runTask()">runTask</a>() method and notifies the owner of the task's start and completion. </p>
</div>
<div class="description"><p><b>See also:</b> <a href="Poco.Runnable.html#9810" title="Poco::Runnable::run()">Poco::Runnable::run()</a></p></div>
<h3><a name="10564">runTask</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual void runTask() = 0;</p>
<div class="description">
<p>Do whatever the task needs to do. Must be overridden by subclasses. </p>
</div>
<h3><a name="10562">state</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Task.html#10550" title="enum  Poco::Task::TaskState">TaskState</a> state() const;</p>
<div class="description">
<p>Returns the task's current state. </p>
</div>
<h3><a name="10574">getOwner</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a> * getOwner() const;</p>
<div class="description">
<p>Returns the owner of the task, which may be NULL. </p>
</div>
<h3><a name="10570">postNotification</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" />  <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual void postNotification(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> * pNf<br />);</p>
<div class="description">
<p>Posts a notification to the task manager's notification center. </p>
<p>A task can use this method to post custom notifications about its progress. </p>
</div>
<h3><a name="10572">setOwner</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void setOwner(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a> * pOwner<br />);</p>
<div class="description">
<p>Sets the (optional) owner of the task. </p>
</div>
<h3><a name="10568">setProgress</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void setProgress(<br />&nbsp;&nbsp;&nbsp;&nbsp;float progress<br />);</p>
<div class="description">
<p>Sets the task's progress. The value should be between 0.0 (just started) and 1.0 (completed). </p>
</div>
<h3><a name="10575">setState</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void setState(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Task.html#10550" title="enum  Poco::Task::TaskState">TaskState</a> state<br />);</p>
<div class="description">
<p>Sets the task's state. </p>
</div>
<h3><a name="10566">sleep</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool sleep(<br />&nbsp;&nbsp;&nbsp;&nbsp;long milliseconds<br />);</p>
<div class="description">
<p>Suspends the current thread for the specified amount of time. </p>
<p>If the task is cancelled while it is sleeping, <a href="Poco.Task.html#10566" title="Poco::Task::sleep()">sleep</a>() will return immediately and the return value will be true. If the time interval passes without the task being cancelled, the return value is false. </p>
<p>A <a href="Poco.Task.html" title="class Poco::Task">Task</a> should use this method in favor of <a href="Poco.Thread.html#10853" title="Poco::Thread::sleep()">Thread::sleep</a>(). </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>