<!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> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>C++ API frePPLe: frepple::utils::CommandList Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="../styles.css" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <div id="menubar"> <div id="logo" align="center"> <br/><img src='../frepple.bmp' alt="frepple" /><br/> <a href='http://www.frepple.com/'> <strong>a Free<br/>Production Planning<br/>Library</strong> </a> </div> <div id="menu"> <br/> <h3><a href='../Main/HomePage.html'>Main</a></h3> <h3><a href='../UI/Main.html'>User Manual</a></h3> <h3><a href='../Tutorial/Main.html'>Tutorial</a></h3> <h3><a href='../Frepple/Main.html'>Reference Manual</a></h3> <h3><a href='../Main/FAQ.html'>FAQ</a></h3> <h3><a href='index.html'>C++ API</a></h3> <br/> </div> </div> <div id="content"> <br/> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="a00256.html">frepple</a>::<a class="el" href="a00257.html">utils</a>::<a class="el" href="a00029.html">CommandList</a> </div> </div> <div class="contents"> <h1>frepple::utils::CommandList Class Reference</h1><!-- doxytag: class="frepple::utils::CommandList" --><!-- doxytag: inherits="frepple::utils::Command" --> <p>A container command to group a series of commands together. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="a00252_source.html">utils.h</a>></code></p> <div class="dynheader"> Inheritance diagram for frepple::utils::CommandList:</div> <div class="dynsection"> <div class="center"><img src="a00560.png" border="0" usemap="#frepple_1_1utils_1_1_command_list_inherit__map" alt="Inheritance graph"/></div> <map name="frepple_1_1utils_1_1_command_list_inherit__map" id="frepple_1_1utils_1_1_command_list_inherit__map"> <area shape="rect" id="node5" href="a00174.html" title="This class is a helper class of the SolverMRP class." alt="" coords="5,161,232,189"/> <area shape="rect" id="node2" href="a00025.html" title="Abstract base class for all commands." alt="" coords="40,6,197,34"/> </map> <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div> <p><a href="a00561.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a0b761c0e2f51f84569de4f242e2cb7b4">add</a> (<a class="el" href="a00025.html">Command</a> *c)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#aacb21e2d634fb3e4ab0752fa79fb62d0">CommandList</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#aea05cad9d2ca876d77e09e9bfa3bf4d9">empty</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a3ab89f96275985cb36836157a719cf9a">execute</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a798ef25c5193842556c190dbb522d2dd">getAbortOnError</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00025.html">Command</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#afeac711703a14926b23f431a0e633c81">getFirstCommand</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00025.html">Command</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a392f247416814b845c086ff1f7196ad9">getLastCommand</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a15a952f152aa88bf9db3f55205c8f088">getMaxParallel</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a2eb3d77401534ea3ce7345821888f030">getNumberOfCommands</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a958191669941f0d3ea35f3b6c10fa32a">setAbortOnError</a> (bool b)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a41cde709abae9c54d1c23cc9a770d269">setMaxParallel</a> (int b)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#ab885c9039ba579d508c77403468f661f">undo</a> (<a class="el" href="a00025.html">Command</a> *c)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a6f38f9a190b88a29f63b58a478cbe982">undo</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a0a293d7fe97f31c8fdace6ab4fad9ae1">undoable</a> (const <a class="el" href="a00025.html">Command</a> *c) const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#a8819615c18961ff920b9d1a074b32e4d">undoable</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="a00029.html#ad7bb40051886b1a0238628037c44d033">~CommandList</a> ()</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>A container command to group a series of commands together. </p> <p>This class implements the "composite" design pattern in order to get an efficient and intuitive hierarchical grouping of tasks.<br/> A command list can be executed in three different modes:</p> <ul> <li>Run the commands in parallel with each other, in seperate threads.<br/> This is achieved by setting the sequential field to false.</li> <li>Run the commands in sequence, and abort the command sequence when one of the commands in the list fails.<br/> This mode requires the sequential field to be set to true, and the AbortOnError field to true.</li> <li>Run the commands in sequence, and continue the command sequence when some commands in the sequence fail.<br/> This mode requires the sequential field to be set to true, and the AbortOnError field to false. Currently Pthreads and Windows threads are supported as the implementation of the multithreading. </li> </ul> <p>Definition at line <a class="el" href="a00252_source.html#l03842">3842</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="aacb21e2d634fb3e4ab0752fa79fb62d0"></a><!-- doxytag: member="frepple::utils::CommandList::CommandList" ref="aacb21e2d634fb3e4ab0752fa79fb62d0" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">frepple::utils::CommandList::CommandList </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline, explicit]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Default constructor. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03977">3977</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="ad7bb40051886b1a0238628037c44d033"></a><!-- doxytag: member="frepple::utils::CommandList::~CommandList" ref="ad7bb40051886b1a0238628037c44d033" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">frepple::utils::CommandList::~CommandList </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Destructor.<br/> A commandlist should only be deleted when all of its commands have been committed or undone. If this is not the case a warning will be printed. </p> <p>Definition at line <a class="el" href="a00193_source.html#l00369">369</a> of file <a class="el" href="a00193_source.html">utils/actions.cpp</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a0b761c0e2f51f84569de4f242e2cb7b4"></a><!-- doxytag: member="frepple::utils::CommandList::add" ref="a0b761c0e2f51f84569de4f242e2cb7b4" args="(Command *c)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void frepple::utils::CommandList::add </td> <td>(</td> <td class="paramtype"><a class="el" href="a00025.html">Command</a> * </td> <td class="paramname"> <em>c</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Append an additional command to the end of the list. </p> <p>Definition at line <a class="el" href="a00193_source.html#l00077">77</a> of file <a class="el" href="a00193_source.html">utils/actions.cpp</a>.</p> </div> </div> <a class="anchor" id="aea05cad9d2ca876d77e09e9bfa3bf4d9"></a><!-- doxytag: member="frepple::utils::CommandList::empty" ref="aea05cad9d2ca876d77e09e9bfa3bf4d9" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool frepple::utils::CommandList::empty </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns true if no commands have been added yet to the list. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03974">3974</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a3ab89f96275985cb36836157a719cf9a"></a><!-- doxytag: member="frepple::utils::CommandList::execute" ref="a3ab89f96275985cb36836157a719cf9a" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void frepple::utils::CommandList::execute </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Commits all actions on its list. At the end it also clear the list of actions. </p> <p>Implements <a class="el" href="a00025.html#acc6f6bc4f9a9ce8cfa2de41fd12f3024">frepple::utils::Command</a>.</p> <p>Reimplemented in <a class="el" href="a00174.html#acc70df491327f7ca8e3f7f2f8fe59305">frepple::SolverMRP::SolverMRPdata</a>.</p> <p>Definition at line <a class="el" href="a00193_source.html#l00167">167</a> of file <a class="el" href="a00193_source.html">utils/actions.cpp</a>.</p> </div> </div> <a class="anchor" id="a798ef25c5193842556c190dbb522d2dd"></a><!-- doxytag: member="frepple::utils::CommandList::getAbortOnError" ref="a798ef25c5193842556c190dbb522d2dd" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool frepple::utils::CommandList::getAbortOnError </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Returns whether or not a single failure aborts the complete command list. </p> <p>Definition at line <a class="el" href="a00193_source.html#l00063">63</a> of file <a class="el" href="a00193_source.html">utils/actions.cpp</a>.</p> </div> </div> <a class="anchor" id="afeac711703a14926b23f431a0e633c81"></a><!-- doxytag: member="frepple::utils::CommandList::getFirstCommand" ref="afeac711703a14926b23f431a0e633c81" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00025.html">Command</a>* frepple::utils::CommandList::getFirstCommand </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the first command that was added to the list. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03911">3911</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a392f247416814b845c086ff1f7196ad9"></a><!-- doxytag: member="frepple::utils::CommandList::getLastCommand" ref="a392f247416814b845c086ff1f7196ad9" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00025.html">Command</a>* frepple::utils::CommandList::getLastCommand </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the last command that was added to the list. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03914">3914</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a15a952f152aa88bf9db3f55205c8f088"></a><!-- doxytag: member="frepple::utils::CommandList::getMaxParallel" ref="a15a952f152aa88bf9db3f55205c8f088" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int frepple::utils::CommandList::getMaxParallel </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns whether the command list processes its commands sequentially or in parallel. The default is sequentially, and this field is NOT inherited down nested command list hierarchies. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03950">3950</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a2eb3d77401534ea3ce7345821888f030"></a><!-- doxytag: member="frepple::utils::CommandList::getNumberOfCommands" ref="a2eb3d77401534ea3ce7345821888f030" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int frepple::utils::CommandList::getNumberOfCommands </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the number of commands stored in this list. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03900">3900</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a958191669941f0d3ea35f3b6c10fa32a"></a><!-- doxytag: member="frepple::utils::CommandList::setAbortOnError" ref="a958191669941f0d3ea35f3b6c10fa32a" args="(bool b)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void frepple::utils::CommandList::setAbortOnError </td> <td>(</td> <td class="paramtype">bool </td> <td class="paramname"> <em>b</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>If this field is set to true the failure of a single command in the list will abort the complete list of command.<br/> If set to false, the remaining commands will still be run in case of a failure. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03945">3945</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a41cde709abae9c54d1c23cc9a770d269"></a><!-- doxytag: member="frepple::utils::CommandList::setMaxParallel" ref="a41cde709abae9c54d1c23cc9a770d269" args="(int b)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void frepple::utils::CommandList::setMaxParallel </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>b</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Updates whether the command list process its commands sequentially or in parallel. </p> <p>Definition at line <a class="el" href="a00252_source.html#l03954">3954</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="ab885c9039ba579d508c77403468f661f"></a><!-- doxytag: member="frepple::utils::CommandList::undo" ref="ab885c9039ba579d508c77403468f661f" args="(Command *c)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void frepple::utils::CommandList::undo </td> <td>(</td> <td class="paramtype"><a class="el" href="a00025.html">Command</a> * </td> <td class="paramname"> <em>c</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Undoes all actions in the list beyond the argument and clear the list of actions.<br/> As soon as one of the actions on the list is not undo-able or the execution is not sequential, the undo is aborted and a warning message is printed.<br/> There is no need that the actions have actually been executed before the <a class="el" href="a00029.html#a6f38f9a190b88a29f63b58a478cbe982">undo()</a> is called. </p> <p>Definition at line <a class="el" href="a00193_source.html#l00102">102</a> of file <a class="el" href="a00193_source.html">utils/actions.cpp</a>.</p> </div> </div> <a class="anchor" id="a6f38f9a190b88a29f63b58a478cbe982"></a><!-- doxytag: member="frepple::utils::CommandList::undo" ref="a6f38f9a190b88a29f63b58a478cbe982" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void frepple::utils::CommandList::undo </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Undoes all actions on the list. At the end it also clears the list of actions. If one of the actions on the list is not undo-able, the whole list is non-undoable and a warning message will be printed. </p> <p>Reimplemented from <a class="el" href="a00025.html#a908c201250c653dad3c93f1df886b3fc">frepple::utils::Command</a>.</p> <p>Definition at line <a class="el" href="a00252_source.html#l03920">3920</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <a class="anchor" id="a0a293d7fe97f31c8fdace6ab4fad9ae1"></a><!-- doxytag: member="frepple::utils::CommandList::undoable" ref="a0a293d7fe97f31c8fdace6ab4fad9ae1" args="(const Command *c) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool frepple::utils::CommandList::undoable </td> <td>(</td> <td class="paramtype">const <a class="el" href="a00025.html">Command</a> * </td> <td class="paramname"> <em>c</em></td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Returns true when all commands beyond the argument can be undone. </p> <p>Definition at line <a class="el" href="a00193_source.html#l00140">140</a> of file <a class="el" href="a00193_source.html">utils/actions.cpp</a>.</p> </div> </div> <a class="anchor" id="a8819615c18961ff920b9d1a074b32e4d"></a><!-- doxytag: member="frepple::utils::CommandList::undoable" ref="a8819615c18961ff920b9d1a074b32e4d" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool frepple::utils::CommandList::undoable </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns whether this command can be undone or not. </p> <p>Reimplemented from <a class="el" href="a00025.html#aebd560086e9d6e041a9d5d0fd3d38364">frepple::utils::Command</a>.</p> <p>Definition at line <a class="el" href="a00252_source.html#l03968">3968</a> of file <a class="el" href="a00252_source.html">utils.h</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="a00252_source.html">utils.h</a></li> <li><a class="el" href="a00193_source.html">utils/actions.cpp</a></li> </ul> </div> <hr size="1"/><address style="align: right;"><small>Documentation generated for frePPLe by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"/></a></small></address> </div> </div> </body> </html>