News SF.net Project Frequently Asked Questions Documentation Downloads Mailing Lists How to Contribute

SourceForge.net Logo

Changing the way games are made and played.

tnlRPC.h File Reference

tnlRPC.h File Reference

#include "tnlMethodDispatch.h"
#include "tnlNetEvent.h"

Namespaces

namespace  TNL

Defines

#define TNL_IMPLEMENT_RPC(className, name, args, argNames, groupMask, guaranteeType, eventDirection, rpcVersion)
 Macro used to declare the implementation of an RPC method on an EventConnection subclass.

#define TNL_DECLARE_RPC(name, args)   void name args; void name##_test args; virtual TNL::NetEvent * name##_construct args; virtual void name##_remote args
 Declares an RPC method within a class declaration. Creates two method prototypes - one for the host side of the RPC call, and one for the receiver, which performs the actual method.

#define TNL_DECLARE_RPC_OVERRIDE(name, args)   void name##_remote args
 Declares an override to an RPC method declared in a parent class.

#define TNL_IMPLEMENT_RPC_OVERRIDE(className, name, args)   void className::name##_remote args
 Macro used to declare the body of an overridden RPC method.

#define TNL_RPC_CONSTRUCT_NETEVENT(object, rpcMethod, args)   (object)->rpcMethod##_construct args
 Constructs a NetEvent that will represent the specified RPC invocation.


Define Documentation

#define TNL_IMPLEMENT_RPC className,
name,
args,
argNames,
groupMask,
guaranteeType,
eventDirection,
rpcVersion   ) 
 

Value:

class RPC_##className##_##name : public TNL::RPCEvent { \
public: \
   TNL::FunctorDecl<void (className::*) args > mFunctorDecl;\
   RPC_##className##_##name() : TNL::RPCEvent(guaranteeType, eventDirection), mFunctorDecl(&className::name##_remote) { mFunctor = &mFunctorDecl; } \
   TNL_DECLARE_CLASS( RPC_##className##_##name ); \
   bool checkClassType(TNL::Object *theObject) { return dynamic_cast<className *>(theObject) != NULL; } }; \
   TNL_IMPLEMENT_NETEVENT( RPC_##className##_##name, groupMask, rpcVersion ); \
   void className::name args { RPC_##className##_##name *theEvent = new RPC_##className##_##name; theEvent->mFunctorDecl.set argNames ; postNetEvent(theEvent); } \
   TNL::NetEvent * className::name##_construct args { RPC_##className##_##name *theEvent = new RPC_##className##_##name; theEvent->mFunctorDecl.set argNames ; return theEvent; } \
   void className::name##_test args { RPC_##className##_##name *theEvent = new RPC_##className##_##name; theEvent->mFunctorDecl.set argNames ; TNL::PacketStream ps; theEvent->pack(this, &ps); ps.setBytePosition(0); theEvent->unpack(this, &ps); theEvent->process(this); } \
   void className::name##_remote args
Macro used to declare the implementation of an RPC method on an EventConnection subclass.

The macro should be used in place of a member function parameter declaration, with the body code (to be executed on the remote side of the RPC) immediately following the TNL_IMPLEMENT_RPC macro call.

#define TNL_DECLARE_RPC name,
args   )     void name args; void name##_test args; virtual TNL::NetEvent * name##_construct args; virtual void name##_remote args
 

Declares an RPC method within a class declaration. Creates two method prototypes - one for the host side of the RPC call, and one for the receiver, which performs the actual method.

#define TNL_DECLARE_RPC_OVERRIDE name,
args   )     void name##_remote args
 

Declares an override to an RPC method declared in a parent class.

#define TNL_IMPLEMENT_RPC_OVERRIDE className,
name,
args   )     void className::name##_remote args
 

Macro used to declare the body of an overridden RPC method.

#define TNL_RPC_CONSTRUCT_NETEVENT object,
rpcMethod,
args   )     (object)->rpcMethod##_construct args
 

Constructs a NetEvent that will represent the specified RPC invocation.

This macro is used to construct a single RPC that can then be posted to multiple connections, instead of allocating an RPCEvent for each connection.