[Opentnl-cvs] tnl/test server.cpp,1.3,1.4 testGame.cpp,1.8,1.9 testGame.h,1.5,1.6 TNLTest.dsp,1.3,NO
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2005-02-21 07:48:23
|
Update of /cvsroot/opentnl/tnl/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24496/test Modified Files: server.cpp testGame.cpp testGame.h Removed Files: TNLTest.dsp server.dsp Log Message: Added template-based RPC marshalling Updated master, masterclient and test projects to use new RPC format Removed VC6 projects due to template incompatibility Index: testGame.h =================================================================== RCS file: /cvsroot/opentnl/tnl/test/testGame.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testGame.h 19 Aug 2004 21:20:14 -0000 1.5 --- testGame.h 21 Feb 2005 07:48:13 -0000 1.6 *************** *** 32,35 **** --- 32,36 ---- #include "../tnl/tnlLog.h" #include "../tnl/tnlRPC.h" + #include "../tnl/tnlString.h" /// TNL Graphical Test Application. *************** *** 142,146 **** /// rpcPlayerWillMove is used in TNLTest to demonstrate ghost->parent NetObject RPCs. ! TNL_DECLARE_RPC(rpcPlayerWillMove, (const char *testString)); /// rpcPlayerDidMove is used in TNLTest to demostrate a broadcast RPC from the server --- 143,147 ---- /// rpcPlayerWillMove is used in TNLTest to demonstrate ghost->parent NetObject RPCs. ! TNL_DECLARE_RPC(rpcPlayerWillMove, (TNL::StringPtr testString)); /// rpcPlayerDidMove is used in TNLTest to demostrate a broadcast RPC from the server *************** *** 263,267 **** /// that's possible using TNL's RPC. This RPC also sends bool and StringTableEntry data, /// as well as showing the use of the TNL_DECLARE_RPC_ENUM macro. ! TNL_DECLARE_RPC(rpcGotPlayerPos, (bool b1, bool b2, TNL::StringTableEntryRef string, TNL::Float<PlayerPosReplyBitSize> x, TNL::Float<PlayerPosReplyBitSize> y)); /// TNL_DECLARE_NETCONNECTION is used to declare that TestConnection is a valid connection class to the --- 264,268 ---- /// that's possible using TNL's RPC. This RPC also sends bool and StringTableEntry data, /// as well as showing the use of the TNL_DECLARE_RPC_ENUM macro. ! TNL_DECLARE_RPC(rpcGotPlayerPos, (bool b1, bool b2, TNL::StringTableEntry string, TNL::Float<PlayerPosReplyBitSize> x, TNL::Float<PlayerPosReplyBitSize> y)); /// TNL_DECLARE_NETCONNECTION is used to declare that TestConnection is a valid connection class to the Index: server.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/test/server.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** server.cpp 19 Aug 2004 21:20:14 -0000 1.3 --- server.cpp 21 Feb 2005 07:48:13 -0000 1.4 *************** *** 94,125 **** /// Test RPC function for long argument lists, especially useful in debugging architectures that pass some arguments in registers, and some on the stack. ! TNL_DECLARE_RPC(rpcLongArgChainTest, (Float<7> i1, Float<6> i2, F32 i3, F32 i4, RangedU32<0,40> i5, F32 i6, F32 i7, F32 i8, F32 i9, F32 i10, F32 i11, F32 i12, F32 i13, F32 i14, F32 i15, U32 i16, U32 i17, F32 i18, F32 i19, F32 i20, F32 i21, F32 i22)); ! TNL_DECLARE_RPC(rpcVectorTest, (IPAddressRef theIP, ByteBufferRef buf, const Vector<IPAddress> &v0, const Vector<const char *> &v1, const Vector<F32> &v2)); ! TNL_DECLARE_RPC(rpcSTETest, (StringTableEntryRef e1, const Vector<StringTableEntry> &v2)); }; ! TNL_IMPLEMENT_RPC(RPCTestConnection, rpcLongArgChainTest, (Float<7> i1, Float<6> i2, F32 i3, F32 i4, RangedU32<0,40> i5, F32 i6, F32 i7, F32 i8, F32 i9, F32 i10, F32 i11, F32 i12, F32 i13, F32 i14, F32 i15, U32 i16, U32 i17, F32 i18, F32 i19, F32 i20, F32 i21, F32 i22), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { F32 fi1 = i1; F32 fi2 = i2; ! logprintf( "%g %g %g %g %d %g %g %g %g %g %g %g %g %g %g %d %d %g %g %g %g %g", ! fi1, fi2, i3, i4, U32(i5), i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22); } TNL_IMPLEMENT_RPC(RPCTestConnection, rpcVectorTest, ! (IPAddressRef theIP, ByteBufferRef buf, const Vector<IPAddress> &v0, const Vector<const char *> &v1, const Vector<F32> &v2), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { logprintf("Vector 0 size: %d, Vector 1 size: %d, Vector 2 size: %d", v0.size(), v1.size(), v2.size()); Address anAddress(theIP); ! logprintf("BB: %d - %s", buf.getBufferSize(), buf.getBuffer()); logprintf("IPAddress = %s", anAddress.toString()); for(S32 i = 0; i < v0.size(); i++) logprintf("Addr: %s", Address(v0[i]).toString()); for(S32 i = 0; i < v1.size(); i++) ! logprintf("%s", v1[i]); for(S32 i = 0; i < v2.size(); i++) logprintf("%g", v2[i]); --- 94,136 ---- /// Test RPC function for long argument lists, especially useful in debugging architectures that pass some arguments in registers, and some on the stack. ! TNL_DECLARE_RPC(rpcLongArgChainTest, (Float<7> i1, Float<6> i2, F32 i3, F32 i4, RangedU32<0,40> i5, F32 i6, U32 i7, F32 i8, U32 i9)); ! TNL_DECLARE_RPC(rpcVectorTest, (IPAddress theIP, ByteBufferPtr buf, Vector<IPAddress> v0, Vector<StringPtr> v1, Vector<F32> v2)); ! TNL_DECLARE_RPC(rpcVectorTest2, (Vector<F32> v, F32 v2)); ! TNL_DECLARE_RPC(rpcSTETest, (StringTableEntry e1, Vector<StringTableEntry> v2)); }; ! TNL_IMPLEMENT_RPC(RPCTestConnection, rpcLongArgChainTest, (Float<7> i1, Float<6> i2, F32 i3, F32 i4, RangedU32<0,40> i5, F32 i6, U32 i7, F32 i8, U32 i9), ! (i1, i2, i3, i4, i5, i6, i7, i8, i9), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { F32 fi1 = i1; F32 fi2 = i2; ! logprintf( "%g %g %g %g %d %g %d %g %d", ! fi1, fi2, i3, i4, U32(i5), i6, i7, i8, i9); ! } ! ! TNL_IMPLEMENT_RPC(RPCTestConnection, rpcVectorTest2, (Vector<F32> floatVec, F32 floatVal), (floatVec, floatVal), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) ! { ! logprintf("val = %g", floatVal); ! for(S32 i = 0; i < floatVec.size(); i++) ! logprintf("floatVec[%d] = %g", i, floatVec[i]); } TNL_IMPLEMENT_RPC(RPCTestConnection, rpcVectorTest, ! (IPAddress theIP, ByteBufferPtr buf, Vector<IPAddress> v0, Vector<StringPtr> v1, Vector<F32> v2), ! (theIP, buf, v0, v1, v2), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { logprintf("Vector 0 size: %d, Vector 1 size: %d, Vector 2 size: %d", v0.size(), v1.size(), v2.size()); Address anAddress(theIP); ! logprintf("BB: %d - %s", buf->getBufferSize(), buf->getBuffer()); logprintf("IPAddress = %s", anAddress.toString()); for(S32 i = 0; i < v0.size(); i++) logprintf("Addr: %s", Address(v0[i]).toString()); for(S32 i = 0; i < v1.size(); i++) ! logprintf("%s", v1[i].getString()); for(S32 i = 0; i < v2.size(); i++) logprintf("%g", v2[i]); *************** *** 127,131 **** TNL_IMPLEMENT_RPC(RPCTestConnection, rpcSTETest, ! (StringTableEntryRef e1, const Vector<StringTableEntry> &v2), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { --- 138,143 ---- TNL_IMPLEMENT_RPC(RPCTestConnection, rpcSTETest, ! (StringTableEntry e1, Vector<StringTableEntry> v2), ! (e1, v2), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { *************** *** 172,177 **** fflush(stdout); ! tc->rpcLongArgChainTest_test(0.25, 0.5, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22); ! Vector<const char *> v1; Vector<IPAddress> v0; v0.push_back(Address("IP:192.168.0.1:1").toIPAddress()); --- 184,189 ---- fflush(stdout); ! tc->rpcLongArgChainTest_test(0.25, 0.5, 3, 4, 5, 6, 7, 8, 9); ! Vector<StringPtr> v1; Vector<IPAddress> v0; v0.push_back(Address("IP:192.168.0.1:1").toIPAddress()); *************** *** 189,194 **** v2.push_back(4.5); v2.push_back(5.5); Address theAddress("IP:192.168.0.23:6969"); ! ByteBuffer buf((U8 *) "Simple test buffer.", 20); Vector<StringTableEntry> v3; --- 201,208 ---- v2.push_back(4.5); v2.push_back(5.5); + + tc->rpcVectorTest2_test(v2, 50); Address theAddress("IP:192.168.0.23:6969"); ! ByteBufferPtr buf = new ByteBuffer((U8 *) "Simple test buffer.", 20); Vector<StringTableEntry> v3; Index: testGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/test/testGame.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testGame.cpp 19 Aug 2004 21:20:14 -0000 1.8 --- testGame.cpp 21 Feb 2005 07:48:13 -0000 1.9 *************** *** 256,260 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(Player, rpcPlayerIsInScope, (TNL::Float<6> x, TNL::Float<6> y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCToGhost, 0) { --- 256,294 ---- } ! /* ! class RPCEV_Player_rpcPlayerIsInScope : ! public TNL::NetObjectRPCEvent ! { ! public: TNL::FunctorDecl<void (Player::*)(TNL::Float<6> x, TNL::Float<6> y)> mFunctorDecl; ! RPCEV_Player_rpcPlayerIsInScope() : ! mFunctorDecl(Player::rpcPlayerIsInScope_remote), ! RPCEvent(TNL::RPCGuaranteedOrdered, TNL::RPCToGhost) ! { mFunctor = &mFunctorDecl; } ! static TNL::NetClassRepInstance<RPCEV_Player_rpcPlayerIsInScope> dynClassRep; ! virtual TNL::NetClassRep* getClassRep() const; ! bool checkClassType(TNL::Object *theObject) ! { return dynamic_cast<Player *>(theObject) != __null; } ! }; ! TNL::NetClassRep* RPCEV_Player_rpcPlayerIsInScope::getClassRep() ! const { return &RPCEV_Player_rpcPlayerIsInScope::dynClassRep; } ! TNL::NetClassRepInstance<RPCEV_Player_rpcPlayerIsInScope> RPCEV_Player_rpcPlayerIsInScope::dynClassRep("RPCEV_Player_rpcPlayerIsInScope",TNL::NetClassGroupGameMask, TNL::NetClassTypeEvent, 0); ! void Player::rpcPlayerIsInScope (TNL::Float<6> x, TNL::Float<6> y) ! { ! RPCEV_Player_rpcPlayerIsInScope *theEvent = new RPCEV_Player_rpcPlayerIsInScope; ! theEvent->mFunctorDecl.set (x, y) ; ! postNetEvent(theEvent); ! } ! ! TNL::NetEvent * Player::rpcPlayerIsInScope_construct (TNL::Float<6> x, TNL::Float<6> y) { RPCEV_Player_rpcPlayerIsInScope *theEvent = new RPCEV_Player_rpcPlayerIsInScope; theEvent->mFunctorDecl.set (x, y) ; return theEvent; } void Player::rpcPlayerIsInScope_test (TNL::Float<6> x, TNL::Float<6> y) { RPCEV_Player_rpcPlayerIsInScope *theEvent = new RPCEV_Player_rpcPlayerIsInScope; theEvent->mFunctorDecl.set (x, y) ; TNL::PacketStream ps; theEvent->pack(this, &ps); ps.setBytePosition(0); theEvent->unpack(this, &ps); theEvent->process(this); } void Player::rpcPlayerIsInScope_remote (TNL::Float<6> x, TNL::Float<6> y) ! ! ! { ! TNL::F32 fx = x, fy = y; ! TNL::logprintf("A player is now in scope at %g, %g", fx, fy); ! } ! ! */ ! TNL_IMPLEMENT_NETOBJECT_RPC(Player, rpcPlayerIsInScope, ! (TNL::Float<6> x, TNL::Float<6> y), (x, y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCToGhost, 0) { *************** *** 263,267 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(Player, rpcPlayerWillMove, (const char *testString), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCToGhostParent, 0) { --- 297,302 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(Player, rpcPlayerWillMove, ! (TNL::StringPtr testString), (testString), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCToGhostParent, 0) { *************** *** 269,273 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(Player, rpcPlayerDidMove, (TNL::Float<6> x, TNL::Float<6> y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCToGhost, 0) { --- 304,309 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(Player, rpcPlayerDidMove, ! (TNL::Float<6> x, TNL::Float<6> y), (x, y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCToGhost, 0) { *************** *** 358,364 **** TNL_IMPLEMENT_NETCONNECTION(TestConnection, TNL::NetClassGroupGame, true); ! TNL_DECLARE_MEMBER_ENUM(TestConnection, PlayerPosReplyBitSize); ! ! TNL_IMPLEMENT_RPC(TestConnection, rpcGotPlayerPos, (bool b1, bool b2, TNL::StringTableEntryRef string, TNL::Float<TestConnection::PlayerPosReplyBitSize> x, TNL::Float<TestConnection::PlayerPosReplyBitSize> y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCDirAny, 0) { --- 394,399 ---- TNL_IMPLEMENT_NETCONNECTION(TestConnection, TNL::NetClassGroupGame, true); ! TNL_IMPLEMENT_RPC(TestConnection, rpcGotPlayerPos, ! (bool b1, bool b2, TNL::StringTableEntry string, TNL::Float<TestConnection::PlayerPosReplyBitSize> x, TNL::Float<TestConnection::PlayerPosReplyBitSize> y), (b1, b2, string, x, y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCDirAny, 0) { *************** *** 367,371 **** } ! TNL_IMPLEMENT_RPC(TestConnection, rpcSetPlayerPos, (TNL::F32 x, TNL::F32 y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCDirClientToServer, 0) { --- 402,407 ---- } ! TNL_IMPLEMENT_RPC(TestConnection, rpcSetPlayerPos, ! (TNL::F32 x, TNL::F32 y), (x, y), TNL::NetClassGroupGameMask, TNL::RPCGuaranteedOrdered, TNL::RPCDirClientToServer, 0) { --- server.dsp DELETED --- --- TNLTest.dsp DELETED --- |