Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

network: some more constructor/interface work

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