Changeset 5562 in orxonox.OLD for branches/network
- Timestamp:
- Nov 14, 2005, 5:02:13 PM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/data_stream.cc
r5554 r5562 15 15 16 16 /* include Data_stream Header */ 17 #include " Data_stream.h"17 #include "data_stream.h" 18 18 19 19 20 #include "netdefs.h" 20 21 21 22 22 /* using namespace std is default, this needs to be here */ … … 25 25 26 26 /** 27 * standart constructor27 * This constructor creates a new DataStream and connects it to both streams (upStream, downStream) 28 28 */ 29 void DataStream::DataStream()29 DataStream::DataStream(DataStream& upStream, DataStream& downStream) 30 30 { 31 31 … … 33 33 34 34 /** 35 * This constructor creates a new DataStream and connects it to a synchronizeable object and the NetworkSocket 36 */ 37 DataStream::DataStream(Synchronizeable& sync, NetworkSocket& socket) 38 { 39 40 } 41 42 /** 35 43 * standart deconstructor 36 44 */ 37 voidDataStream::~DataStream()45 DataStream::~DataStream() 38 46 { 39 47 … … 41 49 42 50 /** 43 * connects the stream to write and read on sockets 51 * This function connects this stream to another stream. The connected DataStream is an up-stream, meaning 52 * that the stream is "further away" from the NetworkSocket. The local reference upStream will be set to this 53 * Stream 44 54 */ 45 void DataStream::connect Stream()55 void DataStream::connectUpStream(DataStream& upStream) 46 56 { 47 57 48 58 } 49 59 50 51 60 /** 52 * disconnects the running stream 61 * This function connects this stream to another stream. The connected DataStream is an down-stream, meaning 62 * that the stream is "closer" to the NetworkSocket. 53 63 */ 54 void DataStream:: disconnectStream()64 void DataStream::connectDownStream(DataStream& upStream) 55 65 { 56 66 57 67 } 58 68 69 /** 70 * This function disconnects the upStream and sets it to NULL 71 */ 72 void DataStream::disconnectUpStream() 73 { 74 75 } 59 76 60 77 /** 61 * processing incoming or outgoing data 78 * This function disconnects the downStream and sets it to NULL 79 */ 80 void DataStream::disconnectDownStream() 81 { 82 83 } 84 85 /** 86 * This function moves the data from the downStream object to the upStream object and changes the data if necessary. 87 * This function is virtual and therefore needs to be extended by the derived class 62 88 */ 63 89 void DataStream::processData() … … 68 94 69 95 /** 70 * method to write data into a networksocket 96 * This function writes the binary data to the local data. You will have to copy each byte and not only dublicate 97 * it. 71 98 */ 72 99 void DataStream::write() … … 77 104 78 105 /** 79 * method to read data from a networksocket 106 * This function returns a reference to the local upData data array. So it can be read by an upper Stream 107 * The reading function will have to copy the whole data and musn't just reference it! 108 * This function is only called from other connected DataStreams to read the data. 80 109 */ 81 voidDataStream::read()110 byte& DataStream::read() 82 111 { 83 112 -
branches/network/src/lib/network/data_stream.h
r5554 r5562 11 11 12 12 #include "base_object.h" 13 #include "netdefs.h" 13 14 14 15 class DataStream : public BaseObject 15 16 { 16 DataStream(); 17 DataStream(DataStream& upStream, DataStream& downStream); 18 DataStream(Synchronizeable& sync, NetworkSocket& socket); 17 19 ~DataStream(); 18 20 … … 20 22 byte inBuffer []; 21 23 byte outBuffer []; 24 unsigned int bufferSize; 25 DataStream& upStream; 26 DataStream& downStream; 22 27 23 public void connectStream(); 28 public: 29 void connectUpStream(DataStream& upStream); 24 30 25 public void disconnectStream();31 void disconnectUpStream(); 26 32 27 public virtual void processData();33 void connectDownStream(DataStream& downStream); 28 34 29 protected virtual void write();35 void disconnectDownStream(); 30 36 31 protected virtual void read(); 32 } 37 virtual void processData() = 0; 38 39 protected: 40 void write(byte& data); 41 42 byte& read(); 43 }; 33 44 34 45 #endif /* _DATA_STREAM_ */
Note: See TracChangeset
for help on using the changeset viewer.