Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/data_stream.cc @ 5719

Last change on this file since 5719 was 5719, checked in by bknecht, 18 years ago

updated function names in DataStream and made some minor changes

File size: 4.3 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: Benjamin Knecht
13   co-programmer: ...
14*/
15
16/* include Data_stream Header */
17#include "data_stream.h"
18
19
20
21
22/* using namespace std is default, this needs to be here */
23using namespace std;
24
25
26
27/**
28 * This is the empty construktor
29 */
30DataStream::DataStream()
31{
32  this->setClassID(CL_DATA_STREAM, "DataStream");
33}
34
35
36
37/**
38 * This is the empty construktor
39 */
40DataStream::DataStream(Synchronizeable& sync)
41{
42  this->setClassID(CL_DATA_STREAM, "DataStream");
43  this->synchronizeable = &sync;
44                       
45}
46
47/**
48 * This constructor creates a new DataStream and connects it to both streams (upStream, downStream)
49 */
50DataStream::DataStream(DataStream& inStream, DataStream& outStream)
51{
52    this->setClassID(CL_DATA_STREAM, "DataStream");
53    this->downStream = &outStream;
54    this->upStream = &inStream;
55}
56
57/**
58 * This constructor creates a new DataStream and connects it to a synchronizeable object and the NetworkSocket
59 */
60DataStream::DataStream(Synchronizeable& sync, NetworkSocket& socket)
61{
62    this->setClassID(CL_DATA_STREAM, "DataStream");
63    this->networkSocket = &socket;
64}
65
66/**
67 * This constructor creates a new DataStream and connects the Synchronizeable to it
68 */
69DataStream::DataStream(Synchronizeable& sync, DataStream& outStream)
70{
71    this->setClassID(CL_DATA_STREAM, "DataStream");
72    this->downStream = &outStream;
73}
74
75/**
76 * This constructor creates a new DataStream and connects the NetworkSocket to it
77 */
78DataStream::DataStream(DataStream& inStream, NetworkSocket& socket)
79{
80     this->setClassID(CL_DATA_STREAM, "DataStream");
81     this->upStream = &inStream;
82     this->networkSocket = &socket;
83}
84
85/**
86 *  standart deconstructor
87 */
88DataStream::~DataStream()
89{
90
91}
92
93/**
94 * This funtion connects this stream to a Synchronizable object. This stream is the top of the stream-chain.
95 */
96void DataStream::connectSynchronizeable(Synchronizeable& sync)
97{
98     
99}
100   
101/**
102 * And this function disconnects the Synch-object and sets it to NULL   
103 */
104void DataStream::disconnectSynchronizeable()
105{
106     
107}
108
109/**
110 * This function connects the stream to a NetworkSocket. This stream is the bottom of the stream-chain
111 */   
112void DataStream::connectNetworkSocket(NetworkSocket& socket)
113{
114     
115}
116   
117/**
118 * And this function disconnects the Socket and sets it to NULL
119 */   
120void DataStream::disconnectNetworkSocket()
121{
122     
123}
124
125/**
126 * This function connects this stream to another stream. The connected DataStream is an up-stream, meaning
127 * that the stream is "further away" from the NetworkSocket. The local reference upStream will be set to this
128 * Stream
129 */
130void DataStream::connectUpStream(DataStream& upStream)
131{
132
133}
134
135/**
136 * This function connects this stream to another stream. The connected DataStream is an down-stream, meaning
137 * that the stream is "closer" to the NetworkSocket.
138 */
139void DataStream::connectDownStream(DataStream& upStream)
140{
141
142}
143
144/**
145 * This function disconnects the upStream and sets it to NULL
146 */
147void DataStream::disconnectUpStream()
148{
149
150}
151
152/**
153 * This function disconnects the downStream and sets it to NULL
154 */
155void DataStream::disconnectDownStream()
156{
157
158}
159
160
161/**
162 * Following functions are protected and only visible inside the object and from derived classes
163 */
164
165/**
166 * This function writes the binary data to the local data. You will have to copy each byte and not only dublicate
167 * it.
168 *
169 * @param data: the binary array
170 * @param length: the length of the array
171 */
172void passDown(byte* data, int length)
173{
174     
175}
176
177
178/**
179 * This function returns a reference to the local upData data array. So it can be read by an upper Stream
180 * The reading function will have to copy the whole data and musn't just reference it!
181 * This function is only called from other connected DataStreams to read the data.
182 *
183 * @param data: the binary array
184 * @return: the length of the data
185 */
186int passUp(byte* data)
187{
188   
189}
Note: See TracBrowser for help on using the repository browser.