JniProxyVisitTableBase Class Reference

#include <JniProxy.h>

Inheritance diagram for JniProxyVisitTableBase:

JniProxyVisitTable< Visitor > List of all members.

Public Types

typedef boost::shared_ptr<
VisitorMethod
SharedVisitorMethod
 Use shared_ptr to manage allocation of VisitorMethods.
typedef std::map< std::string,
SharedVisitorMethod
MethodMap
 Dispatch table type.

Public Member Functions

void addMethod (jclass jClass, SharedVisitorMethod pMethod)
 Called by generated code once for each proxy class.
void accept (JniProxyVisitor &visitor, JniProxy &proxy)
 Accepts a visitor to a proxy object, redirecting it to the correct visit method.

Public Attributes

MethodMap methodMap
 The dispatch table.

Classes

struct  VisitorMethod
 Abstract functor for calling the correct visit method. More...

Detailed Description

Definition at line 230 of file JniProxy.h.


Member Typedef Documentation

typedef boost::shared_ptr<VisitorMethod> JniProxyVisitTableBase::SharedVisitorMethod

Use shared_ptr to manage allocation of VisitorMethods.

Definition at line 248 of file JniProxy.h.

typedef std::map<std::string,SharedVisitorMethod> JniProxyVisitTableBase::MethodMap

Dispatch table type.

The key is the Java class name, and the value is the corresponding visit functor to be called.

Definition at line 254 of file JniProxy.h.


Member Function Documentation

void JniProxyVisitTableBase::addMethod ( jclass  jClass,
SharedVisitorMethod  pMethod 
) [inline]

Called by generated code once for each proxy class.

Parameters:
jClass java.lang.Class for the Java interface being proxied
pMethod corresponding visit method to call

Definition at line 268 of file JniProxy.h.

References JniUtil::getClassName().

Referenced by staticInitFem().

00269     {
00270         assert(pMethod);
00271         methodMap[JniUtil::getClassName(jClass)] = pMethod;
00272     }

void JniProxyVisitTableBase::accept ( JniProxyVisitor visitor,
JniProxy proxy 
) [inline]

Accepts a visitor to a proxy object, redirecting it to the correct visit method.

Parameters:
visitor the visitor to call
proxy the proxy object to visit; the type of this object determines the visit overload to call

Definition at line 284 of file JniProxy.h.

References JniProxy::getInterfaceName().

00285     {
00286         // NOTE:  it's OK to use operator [] here since it's an error to call
00287         // with the wrong proxy type, so in the non-error case we should always
00288         // find something
00289         std::string className = proxy.getInterfaceName();
00290         SharedVisitorMethod pMethod = methodMap[className];
00291         if (!pMethod) {
00292             throw std::logic_error(
00293                 std::string("error: unknown method for proxy class '") +
00294                 className + "'");
00295         }
00296         pMethod->execute(visitor,proxy);
00297     }


Member Data Documentation

MethodMap JniProxyVisitTableBase::methodMap

The dispatch table.

Definition at line 259 of file JniProxy.h.


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:33 2009 for Fennel by  doxygen 1.5.1