Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

"synchronized" DataStream with NetworkStream

File size: 2.6 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 constructor
29 */
30DataStream::DataStream()
31{
32  this->setClassID(CL_DATA_STREAM, "DataStream");
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    this->downStream = &outStream;
42    this->upStream = &inStream;
43}
44
45/**
46 *  standart deconstructor
47 */
48DataStream::~DataStream()
49{
50
51}
52
53
54/**
55 * This function connects this stream to another stream. The connected DataStream is an up-stream, meaning
56 * that the stream is "further away" from the NetworkSocket. The local reference upStream will be set to this
57 * Stream
58 */
59void DataStream::connectUpStream(DataStream& upStream)
60{
61
62}
63
64/**
65 * This function connects this stream to another stream. The connected DataStream is an down-stream, meaning
66 * that the stream is "closer" to the NetworkSocket.
67 */
68void DataStream::connectDownStream(DataStream& upStream)
69{
70
71}
72
73/**
74 * This function disconnects the upStream and sets it to NULL
75 */
76void DataStream::disconnectUpStream()
77{
78
79}
80
81/**
82 * This function disconnects the downStream and sets it to NULL
83 */
84void DataStream::disconnectDownStream()
85{
86
87}
88
89
90/**
91 * Following functions are protected and only visible inside the object and from derived classes
92 */
93
94/**
95 * This function writes the binary data to the local data. You will have to copy each byte and not only dublicate
96 * it.
97 *
98 * @param data: the binary array
99 * @param length: the length of the array
100 */
101void passDown(byte* data, int length)
102{
103     
104}
105
106
107/**
108 * This function returns a reference to the local upData data array. So it can be read by an upper Stream
109 * The reading function will have to copy the whole data and musn't just reference it!
110 * This function is only called from other connected DataStreams to read the data.
111 *
112 * @param data: the binary array
113 * @return: the length of the data
114 */
115int passUp(byte* data)
116{
117   
118}
Note: See TracBrowser for help on using the repository browser.