Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/synchronizeable.cc @ 6080

Last change on this file since 6080 was 5997, checked in by patrick, 19 years ago

merged the network branche a second time because there where some more changes in the code: svn merge -r5991:HEAD branches/network trunk

File size: 2.0 KB
RevLine 
[5523]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
[5547]11
[5523]12### File Specific:
13   main-programmer: Silvan Nellen
[5997]14   co-programmer: Benjamin Wuest
[5547]15*/
[5523]16
[5547]17#include "synchronizeable.h"
18#include "netdefs.h"
[5529]19
[5996]20
[5547]21/**
[5807]22 *  default constructor
[5547]23 */
[5996]24Synchronizeable::Synchronizeable()
[5997]25{
[5996]26
[5997]27  //owner = ?;
28  //hostID = ?;
29  //state = ?;
30
31}
32
[5996]33/**
34 *  default constructor
35 */
[5804]36Synchronizeable::Synchronizeable(const char* name)
[5523]37{
[5807]38  this->setName(name);
[5523]39}
40
[5996]41
[5547]42/**
[5807]43 *  default destructor deletes all unneded stuff
[5547]44 */
45Synchronizeable::~Synchronizeable()
[5807]46{}
[5523]47
[5547]48/**
[5807]49 *  write data to NetworkStream
[5547]50 */
[5807]51void Synchronizeable::writeBytes(const byte* data, int length)
52{}
[5523]53
[5547]54/**
[5807]55 *  read data from NetworkStream
[5547]56 */
[5996]57int Synchronizeable::readBytes(byte* data)
[5807]58{}
[5547]59
60
[5807]61void Synchronizeable::writeDebug() const
62{}
[5547]63
64
[5807]65void Synchronizeable::readDebug() const
66{}
[5997]67
68
69
70
71
72/**
73 * Sets the server flag to a given value
74 * @param isServer: the boolean value which the server flag is to set to
75 */
76void Synchronizeable::setIsServer(bool isServer)
77{
78  if( isServer )
79    this->state = this->state | STATE_SERVER;
80  else
81    this->state = this->state & (~STATE_SERVER);
82}
83
84/**
85 * Sets the outofsync flag to a given value
86 * @param outOfSync: the boolean value which the outofsync flag is to set to
87 */
88void Synchronizeable::setIsOutOfSync(bool outOfSync)
89{
90  if( outOfSync )
91    this->state = this->state | STATE_OUTOFSYNC;
92  else
93    this->state = this->state & (~STATE_OUTOFSYNC);
94}
95
96/**
97 * Determines if the server flag is set
98 * @return true, if the server flag is true, false else
99 */
100bool Synchronizeable::isServer()
101{
102  return this->state & STATE_SERVER == STATE_SERVER;
103}
104
105/**
106 * Determines if the outofsync flag is set
107 * @return true, if the outofsync flag is true, false else
108 */
109bool Synchronizeable::isOutOfSync()
110{
111  return this->state & STATE_OUTOFSYNC == STATE_OUTOFSYNC;
112}
Note: See TracBrowser for help on using the repository browser.