Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/network_manager.cc @ 5605

Last change on this file since 5605 was 5605, checked in by patrick, 18 years ago

network: added debug informations to the network manager, watch it :D

File size: 3.5 KB
Line 
1/*
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
17/* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module
18   For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput
19*/
20#define DEBUG_MODULE_NETWORK
21
22
23#include "network_stream.h"
24#include "list.h"
25#include "class_list.h"
26
27#include "debug.h"
28
29
30/* include your own header */
31#include "network_manager.h"
32
33/* include this file, it contains some default definitions */
34#include "netdefs.h"
35
36/* using namespace std is default, this needs to be here */
37using namespace std;
38
39
40/************************************
41  What you will see here are the function definitions from the header file (network_manager.h) with doxygen documentation. Here is an example:
42
43
44 In file network_manager.h
45
46 class NetworkManager
47 {
48   int doSomeStuff(float argument, float* pointer);
49 }
50
51 will be implemented in the source file as follows:
52
53 In file network_manager.cc
54
55 / **
56  *  this is the short description for this function: it just does some stuff
57  * @param argument: this is the first argument, stuff...
58  * @param pointer:  this is the pointer to nowhereland
59  * return: whatever the function returns: for example an index, number, etc.
60  * /
61 int NetworkManager::doSomeStuff(float argument, float* pointer)
62 {
63   // whaterver you want to do
64 }
65
66
67 if you want to make automake compile your files: you will want to add the file names to the local Makefile.am
68
69 ************************************/
70
71
72
73/**
74 *  standard constructor
75 */
76NetworkManager::NetworkManager()
77{
78  /* set the class id for the base object */
79  this->setClassID(CL_NETWORK_MANAGER, "NetworkManager");
80 
81  /* initialize the references */
82  this->netStreamList = NULL;
83  this->syncList = NULL;
84 
85  PRINTF(0)("NetworkManager created\n");
86}
87
88
89/**
90 *  standard deconstructor
91 */
92NetworkManager::~NetworkManager()
93{}
94
95
96/**
97 *  initializes the network manager
98 */
99void NetworkManager::initialize()
100{
101  /* get the synchronizeable list from the class list */
102  this->netStreamList = ClassList::getList(CL_SYNCHRONIZEABLE);
103  PRINTF(0)("NetworkManager initzalized\n");
104}
105
106
107/**
108 *  shutsdown the network manager
109 */
110void NetworkManager::shutdown()
111{
112
113}
114
115
116/**
117 *  creates a connection from one object to a host
118 * @param address: the address of the destination host
119 * @param synchronizeable: reference to the sync object
120 */
121NetworkStream& NetworkManager::establishConnection(/* address, port, object reference*/)
122{
123  PRINTF(0)("Creating network socket\n");
124  /* creating a new network stream, it will register itself automaticaly to the class list */
125  NetworkStream* netStream = new NetworkStream();
126}
127
128
129/**
130 *  teardown a connection
131 */
132void NetworkManager::shutdownConnection()
133{
134  PRINTF(0)("Shutdown connection\n");
135}
136
137
138
139/**
140 *  sync the network
141 */
142void NetworkManager::synchronize()
143{
144  PRINTF(0)("NetworkManager synchronizes\n");
145  if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL)
146  {
147   
148  }
149
150}
151
152
Note: See TracBrowser for help on using the repository browser.