[5530] | 1 | /* |
---|
[5520] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Patrick Boenzli |
---|
| 13 | co-programmer: ... |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | |
---|
[5525] | 17 | /* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module |
---|
[5530] | 18 | For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput |
---|
[5525] | 19 | */ |
---|
[5530] | 20 | #define DEBUG_MODULE_NETWORK |
---|
[5525] | 21 | |
---|
| 22 | |
---|
[5566] | 23 | #include "network_stream.h" |
---|
| 24 | #include "list.h" |
---|
[5572] | 25 | #include "class_list.h" |
---|
[5566] | 26 | |
---|
| 27 | |
---|
[5525] | 28 | /* include your own header */ |
---|
[5520] | 29 | #include "network_manager.h" |
---|
| 30 | |
---|
[5530] | 31 | /* include this file, it contains some default definitions */ |
---|
| 32 | #include "netdefs.h" |
---|
| 33 | |
---|
[5525] | 34 | /* using namespace std is default, this needs to be here */ |
---|
[5520] | 35 | using namespace std; |
---|
| 36 | |
---|
| 37 | |
---|
[5525] | 38 | /************************************ |
---|
| 39 | What you will see here are the function definitions from the header file (network_manager.h) with doxygen documentation. Here is an example: |
---|
[5520] | 40 | |
---|
[5530] | 41 | |
---|
| 42 | In file network_manager.h |
---|
| 43 | |
---|
[5525] | 44 | class NetworkManager |
---|
| 45 | { |
---|
| 46 | int doSomeStuff(float argument, float* pointer); |
---|
[5530] | 47 | } |
---|
[5520] | 48 | |
---|
[5525] | 49 | will be implemented in the source file as follows: |
---|
| 50 | |
---|
| 51 | In file network_manager.cc |
---|
| 52 | |
---|
| 53 | / ** |
---|
| 54 | * this is the short description for this function: it just does some stuff |
---|
| 55 | * @param argument: this is the first argument, stuff... |
---|
[5530] | 56 | * @param pointer: this is the pointer to nowhereland |
---|
| 57 | * return: whatever the function returns: for example an index, number, etc. |
---|
| 58 | * / |
---|
[5525] | 59 | int NetworkManager::doSomeStuff(float argument, float* pointer) |
---|
| 60 | { |
---|
[5530] | 61 | // whaterver you want to do |
---|
| 62 | } |
---|
[5525] | 63 | |
---|
[5530] | 64 | |
---|
[5525] | 65 | if you want to make automake compile your files: you will want to add the file names to the local Makefile.am |
---|
[5530] | 66 | |
---|
[5525] | 67 | ************************************/ |
---|
| 68 | |
---|
[5530] | 69 | |
---|
[5520] | 70 | /** |
---|
| 71 | * standard constructor |
---|
| 72 | */ |
---|
| 73 | NetworkManager::NetworkManager() |
---|
[5566] | 74 | { |
---|
[5572] | 75 | /* set the class id for the base object */ |
---|
[5575] | 76 | this->setClassID(CL_NETWORK_MANAGER, "NetworkManager"); |
---|
[5572] | 77 | /* initialize the references */ |
---|
| 78 | this->netStreamList = NULL; |
---|
| 79 | this->syncList = NULL; |
---|
[5566] | 80 | } |
---|
[5520] | 81 | |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * standard deconstructor |
---|
| 85 | */ |
---|
| 86 | NetworkManager::~NetworkManager() |
---|
| 87 | {} |
---|
| 88 | |
---|
[5522] | 89 | |
---|
| 90 | /** |
---|
| 91 | * initializes the network manager |
---|
| 92 | */ |
---|
| 93 | void NetworkManager::initialize() |
---|
[5572] | 94 | { |
---|
| 95 | /* get the synchronizeable list from the class list */ |
---|
[5575] | 96 | this->netStreamList = ClassList::getList(CL_SYNCHRONIZEABLE); |
---|
[5572] | 97 | } |
---|
[5522] | 98 | |
---|
[5530] | 99 | |
---|
[5522] | 100 | /** |
---|
| 101 | * shutsdown the network manager |
---|
| 102 | */ |
---|
| 103 | void NetworkManager::shutdown() |
---|
| 104 | {} |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | /** |
---|
| 108 | * creates a connection from one object to a host |
---|
| 109 | * @param address: the address of the destination host |
---|
| 110 | * @param synchronizeable: reference to the sync object |
---|
| 111 | */ |
---|
[5572] | 112 | NetworkStream& NetworkManager::establishConnection(/* address, port, object reference*/) |
---|
| 113 | { |
---|
| 114 | /* creating a new network stream */ |
---|
| 115 | NetworkStream* netStream = new NetworkStream(); |
---|
| 116 | } |
---|
[5522] | 117 | |
---|
| 118 | |
---|
| 119 | /** |
---|
| 120 | * teardown a connection |
---|
| 121 | */ |
---|
| 122 | void NetworkManager::shutdownConnection() |
---|
| 123 | {} |
---|
| 124 | |
---|
[5530] | 125 | |
---|
[5522] | 126 | |
---|
| 127 | /** |
---|
| 128 | * sync the network |
---|
| 129 | */ |
---|
| 130 | void NetworkManager::synchronize() |
---|
| 131 | {} |
---|
| 132 | |
---|
| 133 | |
---|