Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/synchronizeable.cc @ 5992

Last change on this file since 5992 was 5992, checked in by bwuest, 18 years ago

Synchronizeable.h and Synchronizeable.cc changed: state and functions to get/set the state added

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
[5992]14   co-programmer: Benjamin Wuest
[5547]15*/
[5523]16
[5547]17#include "synchronizeable.h"
18#include "netdefs.h"
[5529]19
[5829]20
[5547]21/**
[5807]22 *  default constructor
[5547]23 */
[5829]24Synchronizeable::Synchronizeable()
[5992]25{
[5829]26
[5992]27  //owner = ?;
28  //hostID = ?;
29  //state = ?;
30
31}
32
[5829]33/**
34 *  default constructor
35 */
[5804]36Synchronizeable::Synchronizeable(const char* name)
[5523]37{
[5807]38  this->setName(name);
[5523]39}
40
[5829]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 */
[5829]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{}
[5992]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.