Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

network: some little more error checking in the sync function

File size: 3.2 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
28/* include your own header */
29#include "network_manager.h"
30
31/* include this file, it contains some default definitions */
32#include "netdefs.h"
33
34/* using namespace std is default, this needs to be here */
35using namespace std;
36
37
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:
40
41
42 In file network_manager.h
43
44 class NetworkManager
45 {
46   int doSomeStuff(float argument, float* pointer);
47 }
48
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...
56  * @param pointer:  this is the pointer to nowhereland
57  * return: whatever the function returns: for example an index, number, etc.
58  * /
59 int NetworkManager::doSomeStuff(float argument, float* pointer)
60 {
61   // whaterver you want to do
62 }
63
64
65 if you want to make automake compile your files: you will want to add the file names to the local Makefile.am
66
67 ************************************/
68
69
70/**
71 *  standard constructor
72 */
73NetworkManager::NetworkManager()
74{
75  /* set the class id for the base object */
76  this->setClassID(CL_NETWORK_MANAGER, "NetworkManager");
77 
78  /* initialize the references */
79  this->netStreamList = NULL;
80  this->syncList = NULL;
81}
82
83
84/**
85 *  standard deconstructor
86 */
87NetworkManager::~NetworkManager()
88{}
89
90
91/**
92 *  initializes the network manager
93 */
94void NetworkManager::initialize()
95{
96  /* get the synchronizeable list from the class list */
97  this->netStreamList = ClassList::getList(CL_SYNCHRONIZEABLE);
98}
99
100
101/**
102 *  shutsdown the network manager
103 */
104void NetworkManager::shutdown()
105{
106
107}
108
109
110/**
111 *  creates a connection from one object to a host
112 * @param address: the address of the destination host
113 * @param synchronizeable: reference to the sync object
114 */
115NetworkStream& NetworkManager::establishConnection(/* address, port, object reference*/)
116{
117  /* creating a new network stream, it will register itself automaticaly to the class list */
118  NetworkStream* netStream = new NetworkStream();
119}
120
121
122/**
123 *  teardown a connection
124 */
125void NetworkManager::shutdownConnection()
126{}
127
128
129
130/**
131 *  sync the network
132 */
133void NetworkManager::synchronize()
134{
135  if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL)
136  {
137   
138  }
139
140}
141
142
Note: See TracBrowser for help on using the repository browser.