Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

visitor::SV< S, P > Class Template Reference

Subclass of Visitor for use as an abstract base class. More...

#include <vv2.h>

List of all members.

Public Methods

void visit (ArgBase &ob)
 Performs the VirtualVisitor's action on the given object.

void visit (ArgBase &ob)
 Performs the VirtualVisitor's action on the given object.


Protected Types

typedef P Parent
 The parent of this SV.

typedef Parent::ArgBase ArgBase
 The base class of the argument.

typedef S ArgSub
 The subclass that the argument may or may not be.

typedef P Parent
 The parent of this SV.

typedef S ArgSub
 The subclass that the argument may or may not be.

typedef Parent::ArgBase ArgBase
 The base class of ArgSub.


Protected Methods

void try_visit (ArgBase &ob)
 If ob can be cast to ArgSub, call do_visit, otherwise try the parent.

virtual void do_visit (ArgSub &ob)=0
 Do the action on objects of type SubType.

void try_visit (ArgBase &ob)
 If ob can be cast to ArgSub, call do_visit, otherwise try this SV's parent.

virtual void do_visit (ArgSub &ob)=0
 Add the requirement to define do_visit(ArgSub &).


Detailed Description

template<typename S, typename P>
class visitor::SV< S, P >

Subclass of Visitor for use as an abstract base class.

Supplies an implementation of try_visit() and visit(), and adds the requirement to provide a do_visit<S>() in subclasses

Parameters:
S  The subclass of ArgBase to perform operations on
P  The parent class (either another SV or a Visitor)


Member Typedef Documentation

template<typename S, typename P>
typedef P visitor::SV< S, P >::Parent [protected]
 

The parent of this SV.

template<typename S, typename P>
typedef Parent::ArgBase visitor::SV< S, P >::ArgBase [protected]
 

The base class of the argument.

template<typename S, typename P>
typedef S visitor::SV< S, P >::ArgSub [protected]
 

The subclass that the argument may or may not be.

template<typename S, typename P>
typedef P visitor::SV< S, P >::Parent [protected]
 

The parent of this SV.

template<typename S, typename P>
typedef S visitor::SV< S, P >::ArgSub [protected]
 

The subclass that the argument may or may not be.

template<typename S, typename P>
typedef Parent::ArgBase visitor::SV< S, P >::ArgBase [protected]
 

The base class of ArgSub.


Member Function Documentation

template<typename S, typename P>
void visitor::SV< S, P >::try_visit ArgBase   ob [inline, protected]
 

If ob can be cast to ArgSub, call do_visit, otherwise try the parent.

Parameters:
ob  The object to try visiting

00077       {
00078     // We dynamically cast pointers because this is probably faster than
00079     // casting references
00080     ArgSub *s=dynamic_cast<ArgSub *>(&ob);
00081     if (s==NULL) Parent::try_visit(ob);
00082     else do_visit(*s);
00083       }

template<typename S, typename P>
virtual void visitor::SV< S, P >::do_visit ArgSub   ob [protected, pure virtual]
 

Do the action on objects of type SubType.

Parameters:
ob  The object to act on

template<typename S, typename P>
void visitor::SV< S, P >::visit ArgBase   ob [inline]
 

Performs the VirtualVisitor's action on the given object.

Parameters:
ob  The object to perform the VirtualVisitor's action on

00097       {
00098     try_visit(ob);
00099       }

template<typename S, typename P>
void visitor::SV< S, P >::try_visit ArgBase   ob [inline, protected]
 

If ob can be cast to ArgSub, call do_visit, otherwise try this SV's parent.

Parameters:
ob  The object to try visiting

00078       {
00079     // We dynamically cast pointers because this is probably faster than
00080     // casting references
00081     ArgSub *s=dynamic_cast<ArgSub *>(&ob);
00082     if (s==NULL) Parent::try_visit(ob);
00083     else do_visit(*s);
00084       }

template<typename S, typename P>
virtual void visitor::SV< S, P >::do_visit ArgSub   ob [protected, pure virtual]
 

Add the requirement to define do_visit(ArgSub &).

Parameters:
ob  The object to act on

template<typename S, typename P>
void visitor::SV< S, P >::visit ArgBase   ob [inline]
 

Performs the VirtualVisitor's action on the given object.

Parameters:
ob  The object to perform the VirtualVisitor's action on

00098       {
00099     try_visit(ob);
00100       }


The documentation for this class was generated from the following files:
Generated on Mon Apr 7 19:44:13 2003 for DuTree by doxygen1.2.18