Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > d5e74628f0e673bb8680aebce32b2c04 > files > 11714

itk-doc-3.12.0-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ITK: itk::fem::VisitorDispatcher&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt; Class Template Reference</title>
<link href="DoxygenStyle.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">


<!--  Section customized for INSIGHT : Tue Jul 17 01:02:45 2001 -->
<center>
<a href="index.html" class="qindex">Main Page</a>&nbsp;&nbsp; 
<a href="modules.html" class="qindex">Groups</a>&nbsp;&nbsp;
<a href="namespaces.html" class="qindex">Namespace List</a>&nbsp;&nbsp;
<a href="hierarchy.html" class="qindex">Class Hierarchy</a>&nbsp;&nbsp;
<a href="classes.html" class="qindex">Alphabetical List</a>&nbsp;&nbsp;
<a href="annotated.html" class="qindex">Compound List</a>&nbsp;&nbsp; 
<a href="files.html" class="qindex">File
List</a>&nbsp;&nbsp; 
<a href="namespacemembers.html" class="qindex">Namespace Members</a>&nbsp;&nbsp; 
<a href="functions.html" class="qindex">Compound Members</a>&nbsp;&nbsp; 
<a href="globals.html" class="qindex">File Members</a>&nbsp;&nbsp;
<a href="pages.html" class="qindex">Concepts</a></center>


<!-- Generated by Doxygen 1.5.9 -->
  <div class="navpath"><a class="el" href="namespaceitk.html">itk</a>::<a class="el" href="namespaceitk_1_1fem.html">fem</a>::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">VisitorDispatcher</a>
  </div>
<div class="contents">
<h1>itk::fem::VisitorDispatcher&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt; Class Template Reference</h1><!-- doxytag: class="itk::fem::VisitorDispatcher" -->This class provides the functionality needed to apply the correct visitor function to object of some class. The specific visitor function is choosen, based on a given pointer to some object.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>&gt;</code>
<p>
<div class="dynheader">
Collaboration diagram for itk::fem::VisitorDispatcher&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;:</div>
<div class="dynsection">
<p><center><img src="classitk_1_1fem_1_1VisitorDispatcher__coll__graph.png" border="0" usemap="#itk_1_1fem_1_1VisitorDispatcher_3_01TVisitedClass_00_01TVisitorBase_00_01TVisitFunctionPointerType_01_4__coll__map" alt="Collaboration graph"></center>
<map name="itk_1_1fem_1_1VisitorDispatcher_3_01TVisitedClass_00_01TVisitorBase_00_01TVisitFunctionPointerType_01_4__coll__map">
<area shape="rect" id="node2" href="classitk_1_1SimpleFastMutexLock.html" title="Critical section locking class that can be allocated on the stack." alt="" coords="205,5,400,35"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="classitk_1_1fem_1_1VisitorDispatcher-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3eeb9e5d40db2e96a28f7e87a1cd7525">ClassIDType</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef TVisitedClass&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#64d1b5951871170dc17fe8b9482b9f27">VisitedClass</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="itkFEMMacro_8h.html#68fafcc6909430ccd70cbc4aeee0107c">VisitedClass::ConstPointer</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#f22adae01df8c9471f975f5ba89810d7">VisitedClassConstPointer</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">VisitedClass::Pointer</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3cf1dfe39946c298e07324191a4b4c88">VisitedClassPointer</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef TVisitFunctionPointerType&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef TVisitorBase&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#1a6a273d8dd7d6fb986008983a37346c">VisitorBase</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">VisitorBase::Pointer</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#0220e3b0e160b3214ff23e1fbdb3c5e1">VisitorBasePointer</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <br class="typebreak">
VisitorsArrayType::value_type&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#4b177839573127a782a225f8cbed6027">VisitorsArray_value_type</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef std::map&lt; <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3eeb9e5d40db2e96a28f7e87a1cd7525">ClassIDType</a>, <br class="typebreak">
<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a> &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#fdfe4fcafeb424c112e4ed9159bad497">VisitorsArrayType</a></td></tr>

<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;class TVisitorClass &gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static bool&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#ca466353dc410bde826aea7397292450">RegisterVisitor</a> (TVisitorClass *, <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a> visitor_function)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#b02a2fab0b4f1415c02b27a18e2c9535">Visit</a> (<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#0220e3b0e160b3214ff23e1fbdb3c5e1">VisitorBasePointer</a> l)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;class TVisitedClass, class TVisitorBase, class TVisitFunctionPointerType = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt;<br>
 class itk::fem::VisitorDispatcher&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;</h3>

This class provides the functionality needed to apply the correct visitor function to object of some class. The specific visitor function is choosen, based on a given pointer to some object. 
<p>
<a class="el" href="classA.html">A</a> visitor function is a function, that can perform various operations on objects of various classes. Usually we want this operation applied on any of the polymorphic derived classes. The specific operation is defined in visitor functions.<p>
For example: calculating the area of Shape objects. In this case the function that calculates the area of a specific shape, is called the visitor function. <a class="el" href="classA.html">A</a> specific version of this function must be defined for each class, on which you want the perform the operation (Area(Circle*); Area(Square*); ...).<p>
Now suppose that you want different operations performed on the shape objects. Which operation will be performed is specified by the class of the Visitor object. If the Visitor object is of class Area, then the area of objects will be calculated. If the visitor is object of class Circumference, then the circumference of the shapes will be calculated...<p>
In order to be able to do that and provide the framework to easily add new Visitor as well as Visited classes, we create the <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html" title="This class provides the functionality needed to apply the correct visitor function...">VisitorDispatcher</a> class. It is implemented as a singelton. It stores pointers to Visitor functions together with the information about which Visitor function must be called in order to perform an operation specified by Visitor class on objects of Visited class.<p>
To make a specific base class and all its derived classes visitable, you must make the following changes to your code:<p>
1. Declare the folowing virtual member function in the base class:<p>
class BaseVisitable { ... virtual ReturnType AcceptVisitor( VisitorBase* ) = 0; ... };<p>
2. Implement this function in ALL derived classes like this:<p>
class MyVisitableClass : public BaseVisitable { ... virtual ReturnType AcceptVisitor( VisitorBase* l ) { return VisitorDispatcher&lt;MyVisitableClass,VisitorBase,VisitFunctionPointerType&gt;::Visit( &lt;parameters&gt; ); } ... };<p>
Since this code is the same for all derived element classes, you should probably put it in the macro.<p>
3. Register each visitor class with the <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html" title="This class provides the functionality needed to apply the correct visitor function...">VisitorDispatcher</a> class before it is called. This is done by calling the member function RegisterVisitor of the <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html" title="This class provides the functionality needed to apply the correct visitor function...">VisitorDispatcher</a> class and providing the pointer to the Visitor function that performs the required task. The visitor function must be declared according to the VisitFunctionPointerType template parameter.<p>
ReturnType MyVisitor_Function( ... );<p>
Once all this is done, you can perform various operations on objects of all derived classes by simply calling the Visit function on the pointer to base class and providing a pointer to the specific Visitor object:<p>
object-&gt;AcceptVisitor(visitor);<p>
The Visitor class is templated over several classes that make its use generic and simple.<p>
<ul>
<li>TVisitedClass Class of objects that will be visited.</li></ul>
<p>
<ul>
<li>TVisitorBase Base class of Visitor objects. Objects of class TVisitedClass will be visited by object of any registered class that is derived from TVisitorBase.</li></ul>
<p>
<ul>
<li>TVisitFunctionPointerType Type of visit functions. Visitor dispatcher stores an array of pointers to these functions. Default function pointer type is provided.</li></ul>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Template parameter TVisitFunctionPointerType in general doesn't have to be a pointer to function. In fact, it can be any type <a class="el" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a> of this type will be returned, when calling the <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#b02a2fab0b4f1415c02b27a18e2c9535">VisitorDispatcher::Visit</a> function. </dd></dl>

<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00131">131</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="3eeb9e5d40db2e96a28f7e87a1cd7525"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::ClassIDType" ref="3eeb9e5d40db2e96a28f7e87a1cd7525" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef int <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3eeb9e5d40db2e96a28f7e87a1cd7525">ClassIDType</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Type that holds class IDs. 
<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00162">162</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="64d1b5951871170dc17fe8b9482b9f27"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitedClass" ref="64d1b5951871170dc17fe8b9482b9f27" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef TVisitedClass <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#64d1b5951871170dc17fe8b9482b9f27">VisitedClass</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
TVisitedClass is class to which visitor functions will be applied. 
<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00139">139</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="f22adae01df8c9471f975f5ba89810d7"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitedClassConstPointer" ref="f22adae01df8c9471f975f5ba89810d7" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="itkFEMMacro_8h.html#68fafcc6909430ccd70cbc4aeee0107c">VisitedClass::ConstPointer</a> <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#f22adae01df8c9471f975f5ba89810d7">VisitedClassConstPointer</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00151">151</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="3cf1dfe39946c298e07324191a4b4c88"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitedClassPointer" ref="3cf1dfe39946c298e07324191a4b4c88" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">VisitedClass::Pointer</a> <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3cf1dfe39946c298e07324191a4b4c88">VisitedClassPointer</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00150">150</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="3bf241cc37137a7746999dd02b00aec6"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitFunctionPointerType" ref="3bf241cc37137a7746999dd02b00aec6" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef TVisitFunctionPointerType <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Type that holds pointers to visit functions 
<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00157">157</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="1a6a273d8dd7d6fb986008983a37346c"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitorBase" ref="1a6a273d8dd7d6fb986008983a37346c" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef TVisitorBase <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#1a6a273d8dd7d6fb986008983a37346c">VisitorBase</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
TVisitorBase is base class for visitor objects. Any class derived from TVisitorBase could in general be applied to TVisitedClass. 
<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00145">145</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="0220e3b0e160b3214ff23e1fbdb3c5e1"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitorBasePointer" ref="0220e3b0e160b3214ff23e1fbdb3c5e1" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">VisitorBase::Pointer</a> <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#0220e3b0e160b3214ff23e1fbdb3c5e1">VisitorBasePointer</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00152">152</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="4b177839573127a782a225f8cbed6027"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitorsArray_value_type" ref="4b177839573127a782a225f8cbed6027" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef VisitorsArrayType::value_type <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#4b177839573127a782a225f8cbed6027">VisitorsArray_value_type</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00172">172</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="fdfe4fcafeb424c112e4ed9159bad497"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::VisitorsArrayType" ref="fdfe4fcafeb424c112e4ed9159bad497" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef std::map&lt;<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3eeb9e5d40db2e96a28f7e87a1cd7525">ClassIDType</a>, <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a>&gt; <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#fdfe4fcafeb424c112e4ed9159bad497">VisitorsArrayType</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Type that holds array of pairs of class ID and pointer to visit functions.<p>
FIXME: Maybe std::map is not the most efficient way of storing these pointers. 
<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00171">171</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="ca466353dc410bde826aea7397292450"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::RegisterVisitor" ref="ca466353dc410bde826aea7397292450" args="(TVisitorClass *, VisitFunctionPointerType visitor_function)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType  = typename VisitorDispatcherTemplateHelper&lt;TVisitedClass, TVisitorBase&gt;::FunctionPointerType&gt; </div>
<div class="memtemplate">
template&lt;class TVisitorClass &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">static bool <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::RegisterVisitor           </td>
          <td>(</td>
          <td class="paramtype">TVisitorClass *&nbsp;</td>
          <td class="paramname">, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a>&nbsp;</td>
          <td class="paramname"> <em>visitor_function</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Adds function visitor_function to the <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html" title="This class provides the functionality needed to apply the correct visitor function...">VisitorDispatcher</a> class and associates this function with the class TVisitorClass. This means that when member function Visit(e,l) is called, the fucntion visitor_function will be called, if object pointed to by l is of class TVisitorClass.<p>
To automatically register visitor on library initialization, you would call this function immediatly after defining an implementation function class.<p>
Visitor class must define a static member function "int CLID()" that returns the class ID and a virtual member int ClassID() that does the same.<p>
bool Dummy = <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#ca466353dc410bde826aea7397292450">VisitorDispatcher&lt;Bar,Load&gt;::RegisterVisitor</a>((LoadGrav*)0, &amp;LoadGravImpl);<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>visitor_function</em>&nbsp;</td><td>Pointer to a visitor function.</td></tr>
  </table>
</dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Dummy class pointer must be passed as a first parameter to automatically deduct the correct template parameter TVisitorClass. Technically we would like to call the this function as <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html" title="This class provides the functionality needed to apply the correct visitor function...">VisitorDispatcher</a>&lt;...&gt;RegisterVisitor&lt;MyVisitorClass&gt;(...), but MS C compiler crashes if we do this. This is a work around. You should pass null pointer casted to the TVisitorClass when calling this function.</dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#b02a2fab0b4f1415c02b27a18e2c9535">Visit</a> </dd></dl>

<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00204">204</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

<p>References <a class="el" href="classitk_1_1SimpleFastMutexLock.html#523045202556fb2b3f29e28728d312bf">itk::SimpleFastMutexLock::Lock()</a>, and <a class="el" href="classitk_1_1SimpleFastMutexLock.html#1e02c08e74981429e5a8919632cf2fa4">itk::SimpleFastMutexLock::Unlock()</a>.</p>

</div>
</div><p>
<a class="anchor" name="b02a2fab0b4f1415c02b27a18e2c9535"></a><!-- doxytag: member="itk::fem::VisitorDispatcher::Visit" ref="b02a2fab0b4f1415c02b27a18e2c9535" args="(VisitorBasePointer l)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class TVisitedClass , class TVisitorBase , class TVisitFunctionPointerType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::<a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#3bf241cc37137a7746999dd02b00aec6">VisitFunctionPointerType</a> <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html">itk::fem::VisitorDispatcher</a>&lt; TVisitedClass, TVisitorBase, TVisitFunctionPointerType &gt;::Visit           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#0220e3b0e160b3214ff23e1fbdb3c5e1">VisitorBasePointer</a>&nbsp;</td>
          <td class="paramname"> <em>l</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the pointer to the correct implementation of the visit function. based on the class of object passed in l.<p>
Before this function can be called, the visitor functions must be added to the <a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html" title="This class provides the functionality needed to apply the correct visitor function...">VisitorDispatcher</a> class for visitor class that is derived from TVisitorBase.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>l</em>&nbsp;</td><td>Pointer to an object. Class of this object determines which pointer to visit function will be returned.</td></tr>
  </table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classitk_1_1fem_1_1VisitorDispatcher.html#ca466353dc410bde826aea7397292450">RegisterVisitor</a> </dd></dl>

<p>Definition at line <a class="el" href="itkVisitorDispatcher_8h_source.html#l00294">294</a> of file <a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a>.</p>

<p>Referenced by <a class="el" href="itkFEMElementBase_8h_source.html#l00071">itk::fem::GetLoadVector()</a>.</p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="itkVisitorDispatcher_8h_source.html">itkVisitorDispatcher.h</a></ul>
</div>
<hr><address><small>
Generated at Fri May 8 08:53:32 2009 for ITK  by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img 
src="http://www.stack.nl/~dimitri/doxygen/doxygen.png" alt="doxygen"
align="middle" border=0 width=110 height=53>
</a> 1.5.9 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2000</small></address>
</body>
</html>