Changeset 5647 in orxonox.OLD for branches/network
- Timestamp:
- Nov 20, 2005, 12:25:50 AM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/collision_detection/lin_alg.h
r5493 r5647 5 5 compute the eigenpairs (eigenvalues and eigenvectors) of a real symmetric matrix "A" by the Jacobi method 6 6 */ 7 8 9 /** 10 * function that calculates the eigenvectors from a given symmertical 3x3 Matrix 11 * @arg A: Matrix 12 * @arg D: Eigenvectors 13 */ 14 void eigenVectors(float** matrix, float **vectors) 15 { 16 /* map variables to other names, so they can be processed more easely */ 17 float a = matrix[0][0]; 18 float b = matrix[0][1]; 19 float c = matrix[0][2]; 20 float d = matrix[1][1]; 21 float e = matrix[1][2]; 22 float f = matrix[2][2]; 23 24 /* first eigenvector */ 25 vectors[0][0] = -1/c * (f - /*Root*/ (c*c*d - 2*b*c + a*e*e + b*b*f - a*d*f - 26 b*b - c*c + a*d - e*e + a*f )); 27 } 7 28 8 29 -
branches/network/src/lib/network/network_manager.cc
r5609 r5647 31 31 #include "network_manager.h" 32 32 33 /* include this file, it contains some default definitions */34 #include "netdefs.h"35 33 36 34 /* using namespace std is default, this needs to be here */ … … 116 114 /** 117 115 * creates a connection from one object to a host 116 * @param hostName: the name of the destination host 117 * @param synchronizeable: reference to the sync object 118 */ 119 NetworkStream& establishConnection(const char& hostName, const Synchronizeable& sync) 120 {} 121 122 123 /** 124 * creates a connection from one object to a host 118 125 * @param address: the address of the destination host 119 126 * @param synchronizeable: reference to the sync object 120 127 */ 121 NetworkStream& NetworkManager::establishConnection( /* address, port, object reference*/)128 NetworkStream& NetworkManager::establishConnection(const IPaddress& address, const Synchronizeable& sync) 122 129 { 123 130 PRINTF(0)("Establish connection...\n"); 124 131 /* creating a new network stream, it will register itself automaticaly to the class list */ 125 NetworkStream* netStream = new NetworkStream();132 // NetworkStream* netStream = new NetworkStream(); 126 133 } 127 134 -
branches/network/src/lib/network/network_manager.h
r5575 r5647 9 9 #define _NETWORK_MANAGER 10 10 11 /* include this file, it contains some default definitions */ 12 #include "netdefs.h" 11 13 12 14 /* include base_object.h since all classes are derived from this one */ 13 15 #include "base_object.h" 16 14 17 15 18 /* forward declarations for the header file (include the header via #include "bla.h" in the source file) */ … … 30 33 void shutdown(); 31 34 32 NetworkStream& establishConnection(/* address, port, object reference*/); 35 NetworkStream& establishConnection(const IPaddress& address, const Synchronizeable& sync); 36 NetworkStream& establishConnection(const char& hostName, const Synchronizeable& sync); 33 37 void shutdownConnection(); 34 38 -
branches/network/src/lib/network/network_stream.cc
r5615 r5647 21 21 22 22 23 #include "base_object.h" 24 //#include "network_protocol.h" 25 #include "network_socket.h" 26 #include "connection_monitor.h" 27 #include "synchronizeable.h" 28 #include "list.h" 29 30 23 31 /* include your own header */ 24 32 #include "network_stream.h" … … 28 36 29 37 38 NetworkStream::NetworkStream(DataStream& inStream, DataStream& outStream) 39 : DataStream(inStream, outStream) 40 { 41 this->init(); 42 } 43 44 NetworkStream::NetworkStream(Synchronizeable& sync, NetworkSocket& socket) 45 : DataStream(sync, socket) 46 { 47 this->init(); 48 } 49 50 NetworkStream::NetworkStream(DataStream& inStream, NetworkSocket& socket) 51 : DataStream(inStream, socket) 52 { 53 this->init(); 54 } 55 56 NetworkStream::NetworkStream(Synchronizeable& sync, DataStream& outStream) 57 : DataStream(sync, outStream) 58 { 59 this->init(); 60 } 61 30 62 NetworkStream::NetworkStream() 63 { 64 this->init(); 65 /* initialize the references */ 66 this->networkSocket = new NetworkSocket(); 67 this->synchronizeables = new Synchronizeable(); 68 this->connectionMonitor = new ConnectionMonitor(); 69 } 70 71 72 void NetworkStream::init() 31 73 { 32 74 /* set the class id for the base object */ 33 75 this->setClassID(CL_NETWORK_STREAM, "NetworkStream"); 76 } 34 77 35 /* initialize the references */36 this->networkSockets = new NetworkSocket();37 this->synchronizeables = new Synchronizeable();38 this->connectionMonitor = new ConnectionMonitor();39 40 41 42 }43 78 44 79 NetworkStream::~NetworkStream() -
branches/network/src/lib/network/network_stream.h
r5610 r5647 7 7 #define _NETWORK_STREAM 8 8 9 #include "base_object.h"10 9 #include "data_stream.h" 11 //#include "network_protocol.h"12 #include "network_socket.h"13 #include "connection_monitor.h"14 #include "synchronizeable.h"15 #include "list.h"16 10 11 class Synchronizeable; 12 class NetworkSocket; 13 class ConnectionMonitor; 17 14 18 15 class NetworkStream : public virtual DataStream … … 21 18 public: 22 19 NetworkStream(); 20 NetworkStream(DataStream& inStream, DataStream& outStream); 21 NetworkStream(Synchronizeable& sync, NetworkSocket& socket); 22 NetworkStream(DataStream& inStream, NetworkSocket& socket); 23 NetworkStream(Synchronizeable& sync, DataStream& outStream); 24 23 25 ~NetworkStream(); 24 virtual void processData(); 26 27 void init(); 28 29 virtual void processData(); 25 30 26 31 private: -
branches/network/src/subprojects/network/network_unit_test.cc
r5630 r5647 8 8 #include "network_manager.h" 9 9 #include "network_socket.h" 10 #include "synchronizeable.h" 10 11 11 12 int verbose = 4; 12 13 13 14 15 /* outputs the help */ 14 16 int startHelp(int argc, char** argv) 15 17 { … … 17 19 printf(" --help: this output\n"); 18 20 printf(" --sockettest test network_socket\n"); 21 printf(" --frameworktest test the network module\n"); 19 22 printf("\n"); 20 23 } 21 24 25 26 /* test SDL network socket */ 22 27 int testSocket(int argc, char** argv) 23 28 { … … 107 112 } 108 113 114 115 int testFramework(int argc, char** argv) 116 { 117 printf("=================\n"); 118 printf("TestFramework\n"); 119 printf("=================\n"); 120 121 IPaddress ip; 122 //SDLNet_ResolveHost(&ip, "127.0.0.1", 9999); 123 SDLNet_ResolveHost(&ip, "localhost", 9999); 124 Synchronizeable sync; 125 126 /* create the network manager */ 127 NetworkManager* nm = new NetworkManager(); 128 129 /* initialize the network manager */ 130 nm->initialize(); 131 132 /* esatblish a connection */ 133 nm->establishConnection(ip, sync); 134 135 /* delete the network manager again */ 136 delete nm; 137 138 return 0; 139 } 140 141 109 142 /** 110 143 * … … 119 152 for(i = 1; i < argc; ++i) 120 153 { 121 if(! strcmp( "--help", argv[i]) || !strcmp("-h", argv[i])) return startHelp(argc, argv);122 154 //else if(!strcmp( "--gui", argv[i]) || !strcmp("-g", argv[i])) showGui = true; 123 else if (! strcmp( "--sockettest", argv[i]) || !strcmp("-s", argv[i])) return testSocket(argc, argv); 155 if (! strcmp( "--sockettest", argv[i]) || !strcmp("-s", argv[i])) return testSocket(argc, argv); 156 else if (! strcmp( "--frameworktest", argv[i]) || !strcmp("-s", argv[i])) return testFramework(argc, argv); 124 157 } 125 158 126 /* create the network manager */ 127 NetworkManager* nm = new NetworkManager(); 128 129 /* initialize the network manager */ 130 nm->initialize(); 131 132 /* esatblish a connection */ 133 nm->establishConnection(); 134 135 //ClassList::debug(3, 0); 136 159 startHelp(argc, argv); 160 137 161 return 0; 138 162 }
Note: See TracChangeset
for help on using the changeset viewer.