Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/gui/src/subprojects/network/read_sync.cc @ 7903

Last change on this file since 7903 was 6634, checked in by bensch, 19 years ago

orxonox/trunk: merged the network-branche back to the trunk

merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/network . -r6500:HEAD
minor conflicts in texture and one Makefile resolved to the trunk

also made a small patch to texture, so it Modulates with GL_REPEAT

File size: 1.9 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: Patrick Boenzli
13    co-programmer:
14*/
15
16
17/* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module
18          For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput
19*/
20#define DEBUG_MODULE_NETWORK
21
22#include "read_sync.h"
23
24#include "debug.h"
25
26
27/**
28 *  default constructor
29 */
30ReadSync::ReadSync(const char* name)
31  : Synchronizeable()
32{
33  /* define the local buffer size */
34
35  this->inLength = 100;
36  this->recLength = 0;
37  this->inData = new byte[this->inLength];
38
39  /* init the buffer data */
40  for( int i = 0; i < this->inLength; i++)
41  {
42    this->inData[i] = 0;
43  }
44
45}
46
47
48/**
49 *  default destructor deletes all unneded stuff
50 */
51ReadSync::~ReadSync()
52{
53
54  if( this->inData)
55    delete[] this->inData;
56}
57
58
59/**
60 *  write data to Synchronizeable
61 */
62int ReadSync::writeBytes(const byte* data, int length, int sender)
63{
64  PRINTF(0)("ReadSync: got %i bytes of data\n", length);
65  this->recLength = length;
66  if(this->inLength < length)
67    PRINTF(0)("ERROR: local buffer is smaller than the data to receive.\n");
68
69  /* copy the data localy */
70  for( int i = 0; i < length; i++)
71  {
72    this->inData[i] = data[i];
73  }
74  /* and debug output */
75  this->writeDebug();
76}
77
78
79/**
80 *  read data from Synchronizeable
81 */
82int ReadSync::readBytes(byte* data, int maxLength, int * reciever)
83{
84  return 0;
85}
86
87
88void ReadSync::writeDebug() const
89{
90  PRINTF(0)("Write in bytes: \t(0 <-) |");
91  for(int i = 0; i < this->recLength; i++)
92  {
93    PRINT(0)(" [%u] ",this->inData[i]);
94  }
95  PRINT(0)("|\n");
96}
97
98
99void ReadSync::readDebug() const
100{}
Note: See TracBrowser for help on using the repository browser.