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 */ |
---|
23 | using namespace std; |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | /** |
---|
28 | * This is the empty constructor |
---|
29 | */ |
---|
30 | DataStream::DataStream() |
---|
31 | { |
---|
32 | this->setClassID(CL_DATA_STREAM, "DataStream"); |
---|
33 | } |
---|
34 | |
---|
35 | |
---|
36 | /** |
---|
37 | * This constructor creates a new DataStream and connects it to both streams (upStream, downStream) |
---|
38 | */ |
---|
39 | DataStream::DataStream(DataStream& inStream, DataStream& outStream) |
---|
40 | { |
---|
41 | this->setClassID(CL_DATA_STREAM, "DataStream"); |
---|
42 | this->downStream = &outStream; |
---|
43 | this->upStream = &inStream; |
---|
44 | } |
---|
45 | |
---|
46 | /** |
---|
47 | * standart deconstructor |
---|
48 | */ |
---|
49 | DataStream::~DataStream() |
---|
50 | { |
---|
51 | |
---|
52 | } |
---|
53 | |
---|
54 | /** |
---|
55 | * This funtion connects this stream to a Synchronizable object. This stream is the top of the stream-chain. |
---|
56 | */ |
---|
57 | void DataStream::connectSynchronizeable(Synchronizeable& sync) |
---|
58 | { |
---|
59 | |
---|
60 | } |
---|
61 | |
---|
62 | /** |
---|
63 | * And this function disconnects the Synch-object and sets it to NULL |
---|
64 | */ |
---|
65 | void DataStream::disconnectSynchronizeable() |
---|
66 | { |
---|
67 | |
---|
68 | } |
---|
69 | |
---|
70 | /** |
---|
71 | * This function connects the stream to a NetworkSocket. This stream is the bottom of the stream-chain |
---|
72 | */ |
---|
73 | void DataStream::connectNetworkSocket(NetworkSocket& socket) |
---|
74 | { |
---|
75 | |
---|
76 | } |
---|
77 | |
---|
78 | /** |
---|
79 | * And this function disconnects the Socket and sets it to NULL |
---|
80 | */ |
---|
81 | void DataStream::disconnectNetworkSocket() |
---|
82 | { |
---|
83 | |
---|
84 | } |
---|
85 | |
---|
86 | /** |
---|
87 | * This function connects this stream to another stream. The connected DataStream is an up-stream, meaning |
---|
88 | * that the stream is "further away" from the NetworkSocket. The local reference upStream will be set to this |
---|
89 | * Stream |
---|
90 | */ |
---|
91 | void DataStream::connectUpStream(DataStream& upStream) |
---|
92 | { |
---|
93 | |
---|
94 | } |
---|
95 | |
---|
96 | /** |
---|
97 | * This function connects this stream to another stream. The connected DataStream is an down-stream, meaning |
---|
98 | * that the stream is "closer" to the NetworkSocket. |
---|
99 | */ |
---|
100 | void DataStream::connectDownStream(DataStream& upStream) |
---|
101 | { |
---|
102 | |
---|
103 | } |
---|
104 | |
---|
105 | /** |
---|
106 | * This function disconnects the upStream and sets it to NULL |
---|
107 | */ |
---|
108 | void DataStream::disconnectUpStream() |
---|
109 | { |
---|
110 | |
---|
111 | } |
---|
112 | |
---|
113 | /** |
---|
114 | * This function disconnects the downStream and sets it to NULL |
---|
115 | */ |
---|
116 | void DataStream::disconnectDownStream() |
---|
117 | { |
---|
118 | |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | /** |
---|
123 | * Following functions are protected and only visible inside the object and from derived classes |
---|
124 | */ |
---|
125 | |
---|
126 | /** |
---|
127 | * This function writes the binary data to the local data. You will have to copy each byte and not only dublicate |
---|
128 | * it. |
---|
129 | * |
---|
130 | * @param data: the binary array |
---|
131 | * @param length: the length of the array |
---|
132 | */ |
---|
133 | void passDown(byte* data, int length) |
---|
134 | { |
---|
135 | |
---|
136 | } |
---|
137 | |
---|
138 | |
---|
139 | /** |
---|
140 | * This function returns a reference to the local upData data array. So it can be read by an upper Stream |
---|
141 | * The reading function will have to copy the whole data and musn't just reference it! |
---|
142 | * This function is only called from other connected DataStreams to read the data. |
---|
143 | * |
---|
144 | * @param data: the binary array |
---|
145 | * @return: the length of the data |
---|
146 | */ |
---|
147 | int passUp(byte* data) |
---|
148 | { |
---|
149 | |
---|
150 | } |
---|