Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/data_stream.cc @ 10689

Last change on this file since 10689 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.8 KB
RevLine 
[9406]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/* using namespace std is default, this needs to be here */
21
[9869]22ObjectListDefinition(DataStream);
[9406]23
24/**
25 * This is the empty constructor
26 */
27DataStream::DataStream()
28{
29  this->upBuffer = new byte[DATA_STREAM_BUFFER_SIZE];
30  this->downBuffer = new byte[DATA_STREAM_BUFFER_SIZE];
31}
32
33/**
34 * This constructor creates a new DataStream and connects it to both streams (upStream, downStream)
35 */
36DataStream::DataStream(DataStream& inStream, DataStream& outStream)
37{
[9869]38  this->registerObject(this, DataStream::_objectList);
[9406]39    this->downStream = &outStream;
40    this->upStream = &inStream;
41
42    if( this->upBuffer)
43      delete[] this->upBuffer;
44    if( this->downBuffer)
45      delete[] this->downBuffer;
46}
47
48/**
49 *  standart deconstructor
50 */
51DataStream::~DataStream()
52{
53  delete [] this->upBuffer;
54  this->upBuffer = NULL;
55  delete [] this->downBuffer;
56  this->downBuffer = NULL;
57}
58
59
60/**
61 * This function connects this stream to another stream. The connected DataStream is an up-stream, meaning
62 * that the stream is "further away" from the NetworkSocket. The local reference upStream will be set to this
63 * Stream
64 */
65void DataStream::connectUpStream(DataStream& upStream)
66{
67
68}
69
70/**
71 * This function connects this stream to another stream. The connected DataStream is an down-stream, meaning
72 * that the stream is "closer" to the NetworkSocket.
73 */
74void DataStream::connectDownStream(DataStream& upStream)
75{
76
77}
78
79/**
80 * This function disconnects the upStream and sets it to NULL
81 */
82void DataStream::disconnectUpStream()
83{
84
85}
86
87/**
88 * This function disconnects the downStream and sets it to NULL
89 */
90void DataStream::disconnectDownStream()
91{
92
93}
94
95
96/**
97 * Following functions are protected and only visible inside the object and from derived classes
98 */
99
100/**
101 * This function writes the binary data to the local data. You will have to copy each byte and not only dublicate
102 * it.
103 *
104 * @param data: the binary array
105 * @param length: the length of the array
106 */
107void passDown(byte* data, int length)
108{
109
110}
111
112
113/**
114 * This function returns a reference to the local upData data array. So it can be read by an upper Stream
115 * The reading function will have to copy the whole data and musn't just reference it!
116 * This function is only called from other connected DataStreams to read the data.
117 *
118 * @param data: the binary array
119 * @return: the length of the data
120 */
121int passUp(byte* data)
122{
123  return 0;
124}
Note: See TracBrowser for help on using the repository browser.