Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5562 in orxonox.OLD for branches


Ignore:
Timestamp:
Nov 14, 2005, 5:02:13 PM (19 years ago)
Author:
bknecht
Message:

Corrected Errors in DataStream-Files according patrick and updated according https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DataStream

Location:
branches/network/src/lib/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/data_stream.cc

    r5554 r5562  
    1515
    1616/* include Data_stream Header */
    17 #include "Data_stream.h"
     17#include "data_stream.h"
    1818
    1919
    20 #include "netdefs.h"
     20
    2121
    2222/* using namespace std is default, this needs to be here */
     
    2525
    2626/**
    27  *  standart constructor
     27 * This constructor creates a new DataStream and connects it to both streams (upStream, downStream)
    2828 */
    29 void DataStream::DataStream()
     29DataStream::DataStream(DataStream& upStream, DataStream& downStream)
    3030{
    3131     
     
    3333
    3434/**
     35 * This constructor creates a new DataStream and connects it to a synchronizeable object and the NetworkSocket
     36 */
     37DataStream::DataStream(Synchronizeable& sync, NetworkSocket& socket)
     38{
     39 
     40}
     41
     42/**
    3543 *  standart deconstructor
    3644 */
    37 void DataStream::~DataStream()
     45DataStream::~DataStream()
    3846{
    3947     
     
    4149
    4250/**
    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
    4454 */
    45 void DataStream::connectStream()
     55void DataStream::connectUpStream(DataStream& upStream)
    4656{
    4757     
    4858}
    4959
    50 
    5160/**
    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.
    5363 */
    54 void DataStream::disconnectStream()
     64void DataStream::connectDownStream(DataStream& upStream)
    5565{
    5666     
    5767}
    5868
     69/**
     70 * This function disconnects the upStream and sets it to NULL
     71 */
     72void DataStream::disconnectUpStream()
     73{
     74     
     75}
    5976
    6077/**
    61  *  processing incoming or outgoing data
     78 * This function disconnects the downStream and sets it to NULL
     79 */
     80void 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
    6288 */
    6389void DataStream::processData()
     
    6894
    6995/**
    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.
    7198 */
    7299void DataStream::write()
     
    77104
    78105/**
    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.
    80109 */
    81 void DataStream::read()
     110byte& DataStream::read()
    82111{
    83112     
  • branches/network/src/lib/network/data_stream.h

    r5554 r5562  
    1111
    1212#include "base_object.h"
     13#include "netdefs.h"
    1314
    1415class DataStream : public BaseObject
    1516{
    16       DataStream();
     17      DataStream(DataStream& upStream, DataStream& downStream);
     18      DataStream(Synchronizeable& sync, NetworkSocket& socket);
    1719      ~DataStream();
    1820     
     
    2022      byte inBuffer [];
    2123      byte outBuffer [];
     24      unsigned int bufferSize;
     25      DataStream& upStream;
     26      DataStream& downStream;
    2227     
    23       public void connectStream();
     28      public:
     29      void connectUpStream(DataStream& upStream);
    2430     
    25       public void disconnectStream();
     31      void disconnectUpStream();
    2632     
    27       public virtual void processData();
     33      void connectDownStream(DataStream& downStream);
    2834     
    29       protected virtual void write();
     35      void disconnectDownStream();
    3036     
    31       protected virtual void read();     
    32 }
     37      virtual void processData() = 0;
     38     
     39      protected:
     40      void write(byte& data);
     41     
     42      byte& read();     
     43};
    3344
    3445#endif /* _DATA_STREAM_ */
Note: See TracChangeset for help on using the changeset viewer.